#44683 [Opn->Asn]: popen with modes such as "e" or "er" cause php.exe to crash

[email protected]
Newsgroups php.bugs
Message-ID <[email protected]>
 ID:               44683
 Updated by:       [email protected]
 Reported By:      d_kelsey at uk dot ibm dot com
-Status:           Open
+Status:           Assigned
 Bug Type:         Reproducible crash
 Operating System: Windows XP
 PHP Version:      5.2CVS-2008-04-18
-Assigned To:      
+Assigned To:      pajoye


Previous Comments:
------------------------------------------------------------------------

[2008-04-18 12:51:46] d_kelsey at uk dot ibm dot com

fails on latest snapshot. Backtrace is

>	ntdll.dll!7c9010f3() 	
 	[Frames below may be incorrect and/or missing, no symbols loaded for
ntdll.dll]	
 	msvcrt.dll!77c3b974() 	
 	msvcrt.dll!77c3eb23() 	
 	msvcrt.dll!77c3eb13() 	
 	msvcrt.dll!77c2e556() 	
 	php5ts.dll!popen_ex(const char * command=0x0122c9c0, const char *
type=0x0122db18, const char * cwd=0x00301cc0, char * env=0x00000000) 
Line 239	C
 	php5ts.dll!virtual_popen(const char * command=0x0122c9c0, const char
* type=0x0122db18, void * * * tsrm_ls=0x00301c80)  Line 1172 + 0x24
bytes	C
 	php5ts.dll!zif_popen(int ht=19015924, _zval_struct *
return_value=0x0122c9f0, _zval_struct * * return_value_ptr=0x00000000,
_zval_struct * this_ptr=0x00000000, int return_value_used=1, void * * *
tsrm_ls=0x00301c80)  Line 986 + 0x10 bytes	C
 	php5ts.dll!zend_do_fcall_common_helper_SPEC(_zend_execute_data *
execute_data=0x00c0fbd0, void * * * tsrm_ls=0x00301c80)  Line 200 + 0x3d
bytes	C
 	php5ts.dll!ZEND_DO_FCALL_SPEC_CONST_HANDLER(_zend_execute_data *
execute_data=0x00000000, void * * * tsrm_ls=0x00301c80)  Line 1679 + 0xe
bytes	C
 	php5ts.dll!execute(_zend_op_array * op_array=0x00000008, void * * *
tsrm_ls=0x00301c80)  Line 92 + 0xc bytes	C
 	php5ts.dll!php_execute_script(_zend_file_handle *
primary_file=0x00c0fec8, void * * * tsrm_ls=0x00301c80)  Line 2005 +
0x12 bytes	C
 	php.exe!main(int argc=2, char * * argv=0x00301cf0)  Line 1141	C
 	php.exe!_mainCRTStartup()  + 0xe3 bytes	
 	kernel32.dll!7c816fd7()

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

[2008-04-12 01:19:32] [email protected]

Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows (zip):
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip

For Windows (installer):

  http://snaps.php.net/win32/php5.2-win32-installer-latest.msi

And if it stil crashes, provide a backtrace. 

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

[2008-04-10 11:58:45] d_kelsey at uk dot ibm dot com

opps, looks like modes supplemented with b should also work on linux.

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

[2008-04-10 11:51:18] d_kelsey at uk dot ibm dot com

One thing I missed, on windows you should be able to specify b or t as
a supplement to r and w, ie rb, rt, wb, wt, so modes of 2 characters
should be allowed on windows.

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

[2008-04-10 11:43:38] d_kelsey at uk dot ibm dot com

Description:
------------
trying different modes on php.exe on windows. I tried "e" and "er".
Both cause php to crash. a mode of "re" works.
This is also different from linux where it seems that only "r" or "w"
are valid modes. Anything else or more than 1 character result in a php
warning of invalid argument.

Reproduce code:
---------------
<?php
$t1 = popen("echo hello", "e");
pclose($t1);
$t2 = popen("echo hello", "re");
pclose($t2);
$t3 = popen("echo hello", "er");
pclose($t3);
?>

Expected result:
----------------
Expected output would be the same as linux.
Warning: popen(echo hello,e): Invalid argument in
/data/workspace/phpcode/popen/badpopen.php on line 2

Warning: popen(echo hello,re): Invalid argument in
/data/workspace/phpcode/popen/badpopen.php on line 4

Warning: popen(echo hello,er): Invalid argument in
/data/workspace/phpcode/popen/badpopen.php on line 6


Actual result:
--------------
Windows crashes on "e" and "er" but allows "re"


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


-- 
Edit this bug report at http://bugs.php.net/?id=44683&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.