Bug #52911 [Com]: fwrite doesn't write long strings to a php stream

From: Date: Sun, 17 Oct 2010 08:49:10 +0000
Subject: Bug #52911 [Com]: fwrite doesn't write long strings to a php stream
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-155270@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=52911&edit=1

 ID:                 52911
 Comment by:         bouke at webatoom dot nl
 Reported by:        mz dot evgeny at gmail dot com
 Summary:            fwrite doesn't write long strings to a php stream
 Status:             Verified
 Type:               Bug
 Package:            *General Issues
 Operating System:   Windows
 PHP Version:        5.3.3
 Block user comment: N

 New Comment:

I ran into the same problem, but sleep(1) didn't work. I had to use
sleep(2) 
on my machine (Win7 x64 on C2Q9450).


Previous Comments:
------------------------------------------------------------------------
[2010-09-24 04:45:37] cataphract@php.net

Strangely, it works if you sleep(1) after proc_open.

------------------------------------------------------------------------
[2010-09-23 13:36:35] mz dot evgeny at gmail dot com

It will be more correct to say that it does write the whole string, but
php.exe doesn't get the complete string for some reason.

------------------------------------------------------------------------
[2010-09-23 13:18:34] mz dot evgeny at gmail dot com

Description:
------------
fwrite doesn't write long strings to a stream.

When i try to open a php process and write a long-script to it, i get a
parse error.


Test script:
---------------
 $descriptorSpec = array(
      0 => array('pipe', 'r'),
      1 => array('pipe', 'w'),
      2 => array('pipe', 'w')
 );
 $process = proc_open("php.exe", $descriptorSpec, $pipes); 
 var_dump(fwrite($pipes[0], "<?php  '" . str_repeat("1", 8500) .
"';
?>"));
 fclose($pipes[0]);

 $stdout = stream_get_contents($pipes[1]);
 fclose($pipes[1]);
proc_close($process);
 print_r($stdout);


Expected result:
----------------
int 8513
No error.

Actual result:
--------------
int 8513
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE in - on
line 1 


------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=52911&edit=1


Thread (13 messages)

« previous php.bugs (#155270) next »