From: cullin dot wible at cullinwible dot com Operating system: CentOS 5.4 x86_64 PHP version: 5.3.1 PHP Bug Type: *General Issues Bug description: User Stream $context is Not Populated
Description: ------------ When creating a user stream using the streamWrapper format, the $context variable is NOT set during the stream_open method call. Reproduce code: --------------- class TestStream { public $context; public function __construct() { /* do nothing */ } public function stream_open($path, $mode, $options, &$opened_path) { echo "Open Context: "; var_dump($context); return(true); } } stream_wrapper_register('test, 'TestStream', 0); $options = array( 'test' => array( 'option1' => 'option1_value')); $myContext = stream_context_create($options); fopen('test://test', 'r', false, $myContext); Expected result: ---------------- the $this->context variable should equal $myContext. Actual result: -------------- The $this->context variable is NULL. Please NOTE the following: 1. The $context is set on an fread, however, it should be set during the fopen call. 2. If you look at the PHP-c-code, it appears that the userstream.c class is attempting to set the $context property just after class construction and prior to calling stream_open. Also, after modifying the C-code it appears that the context in the C-code is defined and calls the Zend add_property_resource function. However, there is clearly a bug somewhere as the property is still NULL. -- Edit bug report at http://bugs.php.net/?id=50638&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=50638&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=50638&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=50638&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=50638&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=50638&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=50638&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=50638&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=50638&r=needscript Try newer version: http://bugs.php.net/fix.php?id=50638&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=50638&r=support Expected behavior: http://bugs.php.net/fix.php?id=50638&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=50638&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=50638&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=50638&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50638&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=50638&r=dst IIS Stability: http://bugs.php.net/fix.php?id=50638&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=50638&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=50638&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=50638&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=50638&r=mysqlcfg