Bug #60535 [Opn]: php ends prematurely when reading from pipe

2011-12-20 Thread andreas_nordal_4 at hotmail dot com
Edit report at https://bugs.php.net/bug.php?id=60535edit=1

 ID: 60535
 User updated by:andreas_nordal_4 at hotmail dot com
 Reported by:andreas_nordal_4 at hotmail dot com
 Summary:php ends prematurely when reading from pipe
 Status: Open
 Type:   Bug
 Package:*General Issues
 Operating System:   Windows 7 Enterprise SP1
 PHP Version:5.3.8
 Block user comment: N
 Private report: N

 New Comment:

I think I can reproduce bug 26271.

I had to modify the testcase, by setting the second argument of str_repeat 10 
times higher, and adding the suggested sleep.
I don't get a parse error, but the amount of sleep after proc_open determines 
the returnvalue of fwrite. If not sleeping, I always get 8192 no matter the 
argument to str_repeat.


Previous Comments:

[2011-12-16 16:30:41] cataphr...@php.net

Maybe this is the same as bug #52911. Can you check it out? If so, this should 
be marked a duplicate.


[2011-12-15 15:26:26] andreas_nordal_4 at hotmail dot com

Description:

I am using the command-line `php` program in a bash script to generate a html 
file, like so:

# stage 1:
intermediate=$(php doc.php)
# stage 2:
echo $intermediate | php  doc.html

Stage 2 doesn't work on Windows when doc.html gets big (observed sizes in 
bytes: 42033, 42079, 41989, 42856, 41924). Php just ends prematurely, without 
printing any error message to either standard error or out. The size of 
doc.html is consistent every time I try, but depends on, at least, the amount 
of static content (between ? an, d ?) in $intermediate. The output always 
ends on a linefeed.

I also tried piping a pure html file of size 32597 
(https://bugs.php.net/report.php) through php in similar fashion. This time, 
the output size was inconsistent. Mostly, it was truncated to 16423, sometimes 
not truncated, and once truncated to 8945.

Absurdly, this workaround works:
echo $intermediate | tee intermediate.php; cat intermediate.php | php  
doc.html
The fact that tee is able to read everything from the same pipe, and php 
succeeds when its input comes from cat, makes me think this is php's fault 
(likely a timing issue) rather than bash. Of course, I might be wrong.

The same bash script works flawlessly on Linux. I have php version 5.3.8 both 
on Linux and Windows. The installer I used on Windows is named 
php-5.3.8-Win32-VC9-x86.msi, has filesize 40300544 and md5sum 
2eacd59df8d6b46d5538f2935514d77b.

This bug might explain bug 26271 (which deals with named pipes):
In his case, I can imagine that the writer would hang if the reader ends 
prematurely. Just speculating.







-- 
Edit this bug report at https://bugs.php.net/bug.php?id=60535edit=1


[PHP-BUG] Bug #60535 [NEW]: php ends prematurely when reading from pipe

2011-12-15 Thread andreas_nordal_4 at hotmail dot com
From: 
Operating system: Windows 7 Enterprise SP1
PHP version:  5.3.8
Package:  *General Issues
Bug Type: Bug
Bug description:php ends prematurely when reading from pipe

Description:

I am using the command-line `php` program in a bash script to generate a
html file, like so:

# stage 1:
intermediate=$(php doc.php)
# stage 2:
echo $intermediate | php  doc.html

Stage 2 doesn't work on Windows when doc.html gets big (observed sizes in
bytes: 42033, 42079, 41989, 42856, 41924). Php just ends prematurely,
without printing any error message to either standard error or out. The
size of doc.html is consistent every time I try, but depends on, at least,
the amount of static content (between ? an, d ?) in $intermediate. The
output always ends on a linefeed.

I also tried piping a pure html file of size 32597
(https://bugs.php.net/report.php) through php in similar fashion. This
time, the output size was inconsistent. Mostly, it was truncated to 16423,
sometimes not truncated, and once truncated to 8945.

Absurdly, this workaround works:
echo $intermediate | tee intermediate.php; cat intermediate.php | php 
doc.html
The fact that tee is able to read everything from the same pipe, and php
succeeds when its input comes from cat, makes me think this is php's fault
(likely a timing issue) rather than bash. Of course, I might be wrong.

The same bash script works flawlessly on Linux. I have php version 5.3.8
both on Linux and Windows. The installer I used on Windows is named
php-5.3.8-Win32-VC9-x86.msi, has filesize 40300544 and md5sum
2eacd59df8d6b46d5538f2935514d77b.

This bug might explain bug 26271 (which deals with named pipes):
In his case, I can imagine that the writer would hang if the reader ends
prematurely. Just speculating.


-- 
Edit bug report at https://bugs.php.net/bug.php?id=60535edit=1
-- 
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=60535r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=60535r=trysnapshot53
Try a snapshot (trunk):  
https://bugs.php.net/fix.php?id=60535r=trysnapshottrunk
Fixed in SVN:
https://bugs.php.net/fix.php?id=60535r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=60535r=needdocs
Fixed in release:
https://bugs.php.net/fix.php?id=60535r=alreadyfixed
Need backtrace:  
https://bugs.php.net/fix.php?id=60535r=needtrace
Need Reproduce Script:   
https://bugs.php.net/fix.php?id=60535r=needscript
Try newer version:   
https://bugs.php.net/fix.php?id=60535r=oldversion
Not developer issue: 
https://bugs.php.net/fix.php?id=60535r=support
Expected behavior:   
https://bugs.php.net/fix.php?id=60535r=notwrong
Not enough info: 
https://bugs.php.net/fix.php?id=60535r=notenoughinfo
Submitted twice: 
https://bugs.php.net/fix.php?id=60535r=submittedtwice
register_globals:
https://bugs.php.net/fix.php?id=60535r=globals
PHP 4 support discontinued:  
https://bugs.php.net/fix.php?id=60535r=php4
Daylight Savings:https://bugs.php.net/fix.php?id=60535r=dst
IIS Stability:   
https://bugs.php.net/fix.php?id=60535r=isapi
Install GNU Sed: 
https://bugs.php.net/fix.php?id=60535r=gnused
Floating point limitations:  
https://bugs.php.net/fix.php?id=60535r=float
No Zend Extensions:  
https://bugs.php.net/fix.php?id=60535r=nozend
MySQL Configuration Error:   
https://bugs.php.net/fix.php?id=60535r=mysqlcfg