ID: 50638 User updated by: cullin dot wible at cullinwible dot com Reported By: cullin dot wible at cullinwible dot com Status: Bogus Bug Type: *General Issues Operating System: CentOS 5.4 x86_64 PHP Version: 5.3.1 New Comment:
You are correct. This is not a bug. Thanks for the follow-up. Previous Comments: ------------------------------------------------------------------------ [2010-01-03 00:12:45] bj...@php.net bj...@jessica:~$ php foobar.php Open Context: resource(5) of type (stream-context) Fix your parse error and change $context to $this->context ------------------------------------------------------------------------ [2010-01-02 23:10:26] cullin dot wible at cullinwible dot com 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 this bug report at http://bugs.php.net/?id=50638&edit=1