#46388 [Asn->Csd]: stream_notification_callback inside of object destroys object variables

From: Date: Sun, 26 Oct 2008 13:29:27 +0000
Subject: #46388 [Asn->Csd]: stream_notification_callback inside of object destroys object variables
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-130127@lists.php.net to get a copy of this message
ID: 46388 Updated by: felipe@php.net Reported By: bbc dot quincy at gmx dot de -Status: Assigned +Status: Closed Bug Type: Streams related Operating System: Linux PHP Version: 5.2.6 Assigned To: felipe New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [2008-10-25 23:35:01] 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" ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=46388&edit=1

« previous php.bugs (#130127) next »