CopernicaMarketingSoftware / PHP-JS

A library to integrate the Google V8 Javascript Engine in PHP
GNU General Public License v2.0
119 stars 25 forks source link

cropped response content #5

Open hugdx opened 8 years ago

hugdx commented 8 years ago

Hi, i am going to run lessjs in v8. this is my php code:

if( !function_exists('xh_pre')){
    function xh_pre($sHeader, $Message = ""){?>
        <pre>
            <style type="text/css">pre.xh_debug{border: 1px solid #ccc;padding: 3px;margin: 3px;}pre.xh_debug>h4{border-bottom: 1px solid #bbb;margin-top: 5px;margin-bottom: 5px;background-color: #ccc;color: #000;}pre.xh_debug>h4>span{ cursor: pointer;}</style><script>function xh_pre(oEle){ if( oEle.parentNode.parentNode.children[1] == undefined || oEle.parentNode.parentNode.children[1].tagName.toLowerCase() != 'div' ){return ;} var display = oEle.parentNode.parentNode.children[1].style.display =='none'? 'block':'none'; oEle.parentNode.parentNode.children[1].style.display = display; oEle.innerHTML = display=='none' ? '[ + ]':'[ - ]'; }</script>
            <pre class="xh_debug">
                <h4> <span onclick='xh_pre(this)'>[ - ]</span> <?php echo $sHeader; ?> </h4>
                <div><?php echo htmlspecialchars($Message); ?></div>
            </pre>
        </pre>
    <?php
    }
}

$context = new JS\Context;

$js = file_get_contents('js/less-v8.js');
xh_pre('$js', $js);
$b = $context->evaluate($js);
xh_pre('$b', $b);

$js = file_get_contents('js/process.js');
xh_pre('$js', $js);
$b = $context->evaluate($js);
xh_pre('$b', $b);
var_dump($b);

js/less-v8.js https://gist.github.com/hugdx/ce73ddd7a64fa0a332c03a2a4ee6a7d9

js/process.js https://gist.github.com/hugdx/9c54707435e576188d2d09ff4d13eb65

when i run above script,, response was cropped. screen

full html response after run: https://gist.github.com/hugdx/1f2625b7379032c4c2dbebb81b98abcb

it should be like this screen2 (i added more phpinfo() to end of php file to get above image)

i am running: php7-fpm, nginx Thanks

hugdx commented 8 years ago

This is log of nginx

2016/08/13 01:32:03 [error] 64980#0: *3 readv() failed (104: Connection reset by peer) while reading upstream, client: 127.0.0.1, server: *****.***, request: "GET /index.php?m=true HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm/****.sock:", host: "*****.***"

i think may be it came from PHP-CPP, because i got same issue before with PHP-CPP(for php5-fpm)