php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46388 stream_notification_callback inside of object destroys object variables
Submitted: 2008-10-25 23:35 UTC Modified: 2008-10-26 13:29 UTC
From: bbc dot quincy at gmx dot de Assigned: felipe
Status: Closed Package: Streams related
PHP Version: 5.2.6 OS: Linux
Private report: No CVE-ID:
 [2008-10-25 23:35 UTC] bbc dot quincy at gmx dot de
Description:
------------
The stream_notification_callback is being used inside of a class and tries to modify object variables. Inside of the callback function the varibles are returned in the right way. After leaving the function, changed variables are destroyed. (Example 1)

Surprisingly if the variable is modified outside of the switch statement, but still inside of the stream_notification_callback, variable value changes and cannot be overwritten with the following statements. (Example 2)






Reproduce code:
---------------
Example 1: http://quincy.phoenix.net-build.de/example1.txt
Example 2: http://quincy.phoenix.net-build.de/example2.txt

Expected result:
----------------
The function should modify the right variables.

Actual result:
--------------
Example 1 output is:
string(7) "unknown"
Connected to http://www.php.net
MIME-type: text/html;charset=utf-8
NULL

Example 2 output is:
string(7) "unknown"
Connected to http://www.php.net
MIME-type: text/html;charset=utf-8
string(12) "also unknown"

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-10-26 13:29 UTC] felipe@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Wed Apr 16 16:02:23 2014 UTC