#35895 [NoF-Opn]: __sleep and private property
ID: 35895 User updated by: f dot hardy at origami-systems dot com Reported By: f dot hardy at origami-systems dot com -Status: No Feedback +Status: Open Bug Type: Scripting Engine problem Operating System: Freebsd 6 PHP Version: 5.1.2 New Comment: Bug is always alive in php 5.1.5 under freebsd 6.0. Previous Comments: [2006-06-18 17:43:46] jona at oismail dot com Reproduced on Windows 2000 when using __sleept() with aggregated objects as private memembers. The bug has been reproduced in both PHP 5.2-dev (from link below) and PHP 5.1.4. The following script can be used to reproduce the error: ?php class TestParent { private $parentPrivateVar; protected $parentProtectedVar; public $parentPublicVar; public function __construct($private, $protected, $public) { $this-parentPrivateVar = $private; $this-parentProtectedVar = $protected; $this-parentPublicVar = $public; } function __sleep() { return array(parentPrivateVar, parentProtectedVar, parentPublicVar); } } class TestChild extends TestParent { private $childPrivateVar; protected $childProtectedVar; public $childPublicVar; public function __construct($private, $protected, $public) { $this-childPrivateVar = child_. $private; $this-childProtectedVar = child_. $protected; $this-childPublicVar = child_. $public; parent::__construct(parent_. $private, parent_. $protected, parent_. $public); } function __sleep() { return array_merge(array(childPrivateVar, childProtectedVar, childPublicVar), parent::__sleep() ); } } class WebSession { private $privateVar; private $privateAggregatedObject; public function __construct($private, TestChild $o) { $this-privateVar = $private; $this-privateAggregatedObject = $o; } public function __sleep() { return array(privateVar, privateAggregatedObject); } public function getPrivateVar() { return $this-privateVar; } public function getObject() { return $this-privateAggregatedObject; } } // Report simple running errors error_reporting(E_ERROR | E_PARSE | E_WARNING | E_NOTICE | E_STRICT | E_USER_ERROR | E_USER_WARNING | E_USER_NOTICE); // Start user session session_start(); if(isset($_SESSION['obj_Info']) === false) { $_SESSION['obj_Info'] = new WebSession(private variable, new TestChild(private, protected, public) ); } echo pre; var_dump($_SESSION['obj_Info']); echo /pre; echo hr /; echo TEST: . $_SESSION['obj_Info']-getPrivateVar() .br /; echo OBJECT: . $_SESSION['obj_Info']-getObject() .br /; echo OBJECT PUBLIC VAR: . $_SESSION['obj_Info']-getObject()-childPublicVar .br /; ? GIVES THE FOLLOWING OUTPUT IN PHP 5.1.4: object(WebSession)#1 (2) { [privateVar:private]= string(16) private variable [privateAggregatedObject:private]= object(TestChild)#2 (6) { [childPrivateVar:private]= string(13) child_private [childProtectedVar:protected]= string(15) child_protected [childPublicVar]= string(12) child_public [parentPrivateVar:private]= string(14) parent_private [parentProtectedVar:protected]= string(16) parent_protected [parentPublicVar]= string(13) parent_public } } TEST: private variable OBJECT: Object id #2 OBJECT PUBLIC VAR: child_public Notice: Unknown: parentPrivateVar returned as member variable from __sleep() but does not exist in Unknown on line 0 The notice is only thrown on the initial run with parentPrivateVar is actually set. The notice is not thrown if parentPrivateVar is null. In PHP 5.2-dev the scrip dies line 76: echo OBJECT: . $_SESSION['obj_Info']-getObject() .br /; The notice is still thrown when parentPrivateVar is set though. [2006-05-31 01:00:00] php-bugs at lists dot php dot net No feedback was provided for this bug for over a week, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to Open. [2006-05-23 17:54:08] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php5.2-latest.tar.gz For Windows: http://snaps.php.net/win32/php5.2-win32-latest.zip I cannot reproduce (on Linux) using latest 5.2 CVS. Can you please try a snapshot from the 5.2 series and let me know if it's fixed for you
#33744 [Com]: Concerning ini_set session.save_path reregistering an id under windows.
ID: 33744 Comment by: f dot hardy at origami-systems dot com Reported By: d43m0n at shaw dot ca Status: No Feedback Bug Type: Session related Operating System: win32 linux PHP Version: 5.0.4 New Comment: Sorry, i have ommited an important informations : I am ussing session_save_path() instead of ini_set(). Previous Comments: [2006-07-18 15:13:55] f dot hardy at origami-systems dot com I have the same issue under windows XP Pro and php 5.1.4. [2005-07-26 01:00:05] php-bugs at lists dot php dot net No feedback was provided for this bug for over a week, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to Open. [2005-07-18 18:43:44] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php5-latest.tar.gz For Windows: http://snaps.php.net/win32/php5-win32-latest.zip [2005-07-18 11:05:45] d43m0n at shaw dot ca Description: Hello, While developing a new security fix for a script I am working on, I found this issue corrisponding with Windows 2000 NT, which causes the sessions to not reregister a id if the ini_set redefines teh session.save_path to a relitive location. The following code when used in the windows environment will cause the error which follows: [CODE]?php define(_PATH_TMP, ./tmp); ini_set('session.save_path', _PATH_TMP); session_start(); $_SESSION['sid']['obsolete'] = session_id(); session_regenerate_id(); $_SESSION['sid']['replaced'] = session_id(); ? [/CODE] [ERROR]Warning: Unknown: open(./tmp\sess_3c0fe03c61bac80ca57a1193d3e54aa8, O_RDWR) failed: No such file or directory (2) in Unknown on line 0 Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (./tmp) in Unknown on line 0 [/ERROR] Of course I have takin the proper precautions to be sure the directory existed in the first place... of course, if I dont re-define the the session.save_path, and use the default, it gets created secessfully, like as follows: [CODE] ?php session_start(); $_SESSION['sid']['obsolete'] = session_id(); session_regenerate_id(); $_SESSION['sid']['replaced'] = session_id(); print_r($_SESSION); ? [/CODE] Now, ill take it another step further, I tried using an exact file location when I defined the session.save_path like so: [CODE] ?php define(_PATH_TMP, X:/dir/to/my/tmp); ini_set('session.save_path', _PATH_TMP); session_start(); $_SESSION['sid']['obsolete'] = session_id(); session_regenerate_id(); $_SESSION['sid']['replaced'] = session_id(); print_r($_SESSION); ? [/CODE] Of course this prooved successful, except for the obvious change of my directory location to my tmp... Now I did have a chance to try out the same script on a Linux OS with PHP and had no troubles with ./tmp as the tmp directory, so like really, wtf is the problem? -- Edit this bug report at http://bugs.php.net/?id=33744edit=1
#33744 [Com]: Concerning ini_set session.save_path reregistering an id under windows.
ID: 33744 Comment by: f dot hardy at origami-systems dot com Reported By: d43m0n at shaw dot ca Status: No Feedback Bug Type: Session related Operating System: win32 linux PHP Version: 5.0.4 New Comment: I have the same issue under windows XP Pro and php 5.1.4. Previous Comments: [2005-07-26 01:00:05] php-bugs at lists dot php dot net No feedback was provided for this bug for over a week, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to Open. [2005-07-18 18:43:44] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php5-latest.tar.gz For Windows: http://snaps.php.net/win32/php5-win32-latest.zip [2005-07-18 11:05:45] d43m0n at shaw dot ca Description: Hello, While developing a new security fix for a script I am working on, I found this issue corrisponding with Windows 2000 NT, which causes the sessions to not reregister a id if the ini_set redefines teh session.save_path to a relitive location. The following code when used in the windows environment will cause the error which follows: [CODE]?php define(_PATH_TMP, ./tmp); ini_set('session.save_path', _PATH_TMP); session_start(); $_SESSION['sid']['obsolete'] = session_id(); session_regenerate_id(); $_SESSION['sid']['replaced'] = session_id(); ? [/CODE] [ERROR]Warning: Unknown: open(./tmp\sess_3c0fe03c61bac80ca57a1193d3e54aa8, O_RDWR) failed: No such file or directory (2) in Unknown on line 0 Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (./tmp) in Unknown on line 0 [/ERROR] Of course I have takin the proper precautions to be sure the directory existed in the first place... of course, if I dont re-define the the session.save_path, and use the default, it gets created secessfully, like as follows: [CODE] ?php session_start(); $_SESSION['sid']['obsolete'] = session_id(); session_regenerate_id(); $_SESSION['sid']['replaced'] = session_id(); print_r($_SESSION); ? [/CODE] Now, ill take it another step further, I tried using an exact file location when I defined the session.save_path like so: [CODE] ?php define(_PATH_TMP, X:/dir/to/my/tmp); ini_set('session.save_path', _PATH_TMP); session_start(); $_SESSION['sid']['obsolete'] = session_id(); session_regenerate_id(); $_SESSION['sid']['replaced'] = session_id(); print_r($_SESSION); ? [/CODE] Of course this prooved successful, except for the obvious change of my directory location to my tmp... Now I did have a chance to try out the same script on a Linux OS with PHP and had no troubles with ./tmp as the tmp directory, so like really, wtf is the problem? -- Edit this bug report at http://bugs.php.net/?id=33744edit=1
#35895 [NoF-Opn]: __sleep and private property
ID: 35895 User updated by: f dot hardy at origami-systems dot com Reported By: f dot hardy at origami-systems dot com -Status: No Feedback +Status: Open Bug Type: Scripting Engine problem Operating System: Freebsd 6 PHP Version: 5.1.2 New Comment: Bug is still alive in php 5.1.4 under freebsd. Please correct it ! Previous Comments: [2006-01-28 01:00:04] php-bugs at lists dot php dot net No feedback was provided for this bug for over a week, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to Open. [2006-01-20 14:49:04] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php5.1-latest.tar.gz For Windows: http://snaps.php.net/win32/php5.1-win32-latest.zip [2006-01-20 14:39:01] f dot hardy at origami-systems dot com This bugs is always alive in php 5.1.2. Please correct it ! [2006-01-04 20:41:27] [EMAIL PROTECTED] 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. [2006-01-04 18:57:38] f dot hardy at origami-systems dot com It is the same bug than #26737, which is closed !! The workaround return array(a, // \0*\0b, // \0 . __CLASS__ . \0c); is ok ! The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/35895 -- Edit this bug report at http://bugs.php.net/?id=35895edit=1
#35895 [Csd-Opn]: __sleep and private property
ID: 35895 User updated by: f dot hardy at origami-systems dot com Reported By: f dot hardy at origami-systems dot com -Status: Closed +Status: Open Bug Type: Scripting Engine problem Operating System: Freebsd 6 -PHP Version: 5.1.1 +PHP Version: 5.1.2 New Comment: This bugs is always alive in php 5.1.2. Please correct it ! Previous Comments: [2006-01-04 20:41:27] [EMAIL PROTECTED] 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. [2006-01-04 18:57:38] f dot hardy at origami-systems dot com It is the same bug than #26737, which is closed !! The workaround return array(a, // \0*\0b, // \0 . __CLASS__ . \0c); is ok ! [2006-01-04 17:36:20] f dot hardy at origami-systems dot com Description: if __sleep return a private property in its array, php say : Unknown: foo returned as member variable from __sleep() but does not exist Reproduce code: --- ?php class foo { private $foo = array(); public function __construct() { ; } public function __sleep() { return array('foo'); } } ? Expected result: php must find a private property wich is return by __sleep. Actual result: -- Unknown: foo returned as member variable from __sleep() but does not exist -- Edit this bug report at http://bugs.php.net/?id=35895edit=1
#35895 [NEW]: __sleep and private property
From: f dot hardy at origami-systems dot com Operating system: Freebsd 6 PHP version: 5.1.1 PHP Bug Type: Scripting Engine problem Bug description: __sleep and private property Description: if __sleep return a private property in its array, php say : Unknown: foo returned as member variable from __sleep() but does not exist Reproduce code: --- ?php class foo { private $foo = array(); public function __construct() { ; } public function __sleep() { return array('foo'); } } ? Expected result: php must find a private property wich is return by __sleep. Actual result: -- Unknown: foo returned as member variable from __sleep() but does not exist -- Edit bug report at http://bugs.php.net/?id=35895edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=35895r=trysnapshot44 Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=35895r=trysnapshot51 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=35895r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=35895r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=35895r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=35895r=needtrace Need Reproduce Script:http://bugs.php.net/fix.php?id=35895r=needscript Try newer version:http://bugs.php.net/fix.php?id=35895r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=35895r=support Expected behavior:http://bugs.php.net/fix.php?id=35895r=notwrong Not enough info: http://bugs.php.net/fix.php?id=35895r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=35895r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=35895r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=35895r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=35895r=dst IIS Stability:http://bugs.php.net/fix.php?id=35895r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=35895r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=35895r=float No Zend Extensions: http://bugs.php.net/fix.php?id=35895r=nozend MySQL Configuration Error:http://bugs.php.net/fix.php?id=35895r=mysqlcfg
#35895 [Opn]: __sleep and private property
ID: 35895 User updated by: f dot hardy at origami-systems dot com Reported By: f dot hardy at origami-systems dot com Status: Open Bug Type: Scripting Engine problem Operating System: Freebsd 6 PHP Version: 5.1.1 New Comment: It is the same bug than #26737, which is closed !! The workaround return array(a, // \0*\0b, // \0 . __CLASS__ . \0c); is ok ! Previous Comments: [2006-01-04 17:36:20] f dot hardy at origami-systems dot com Description: if __sleep return a private property in its array, php say : Unknown: foo returned as member variable from __sleep() but does not exist Reproduce code: --- ?php class foo { private $foo = array(); public function __construct() { ; } public function __sleep() { return array('foo'); } } ? Expected result: php must find a private property wich is return by __sleep. Actual result: -- Unknown: foo returned as member variable from __sleep() but does not exist -- Edit this bug report at http://bugs.php.net/?id=35895edit=1
#35678 [NEW]: php -l doest not report parse error correctly
From: f dot hardy at origami-systems dot com Operating system: freebsd PHP version: 5.1.1 PHP Bug Type: CGI related Bug description: php -l doest not report parse error correctly Description: php -l aFile.php does not report correctly parse error. PHP 5.0.4 say : PHP Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in selects.php on line 6 PHP 5.1.1 say : Errors parsing selects.php Reproduce code: --- if ($_SERVER['REQUEST_METHOD'] == 'POST') { echo 'pre' var_dump($_POST); echo '/pre'; } Expected result: PHP Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in selects.php on line 6 Actual result: -- Errors parsing selects.php -- Edit bug report at http://bugs.php.net/?id=35678edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=35678r=trysnapshot44 Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=35678r=trysnapshot51 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=35678r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=35678r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=35678r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=35678r=needtrace Need Reproduce Script:http://bugs.php.net/fix.php?id=35678r=needscript Try newer version:http://bugs.php.net/fix.php?id=35678r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=35678r=support Expected behavior:http://bugs.php.net/fix.php?id=35678r=notwrong Not enough info: http://bugs.php.net/fix.php?id=35678r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=35678r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=35678r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=35678r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=35678r=dst IIS Stability:http://bugs.php.net/fix.php?id=35678r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=35678r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=35678r=float No Zend Extensions: http://bugs.php.net/fix.php?id=35678r=nozend MySQL Configuration Error:http://bugs.php.net/fix.php?id=35678r=mysqlcfg
#33661 [NEW]: Header and _POST problem
From: f dot hardy at origami-systems dot com Operating system: freebsd 4.10 PHP version: 5.0.4 PHP Bug Type: HTTP related Bug description: Header and _POST problem Description: I have a problem with $_POST and the header() function. If I make a test on $_POST, my 404 http header is replaced by a 2OO OK header. If I make a test on $_GET (with a get action in html form), or an another variable, I receive the 404 http header. Reproduce code: --- ?php if (isset($_POST['test']) == true) { header(HTTP/1.1 404 Not Found, true); die(); } else { ? form method=post input type=text name=test value= / input type=submit name=modify value=Modify / /form ?php } ? Expected result: A 404 HTTP header in response. Actual result: -- A 200 OK HTTP header in response. -- Edit bug report at http://bugs.php.net/?id=33661edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33661r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33661r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33661r=trysnapshot51 Fixed in CVS:http://bugs.php.net/fix.php?id=33661r=fixedcvs Fixed in release:http://bugs.php.net/fix.php?id=33661r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=33661r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=33661r=needscript Try newer version: http://bugs.php.net/fix.php?id=33661r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=33661r=support Expected behavior: http://bugs.php.net/fix.php?id=33661r=notwrong Not enough info: http://bugs.php.net/fix.php?id=33661r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=33661r=submittedtwice register_globals:http://bugs.php.net/fix.php?id=33661r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33661r=php3 Daylight Savings:http://bugs.php.net/fix.php?id=33661r=dst IIS Stability: http://bugs.php.net/fix.php?id=33661r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=33661r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=33661r=float No Zend Extensions: http://bugs.php.net/fix.php?id=33661r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=33661r=mysqlcfg
#33661 [Fbk-Opn]: Header and _POST problem
ID: 33661 User updated by: f dot hardy at origami-systems dot com Reported By: f dot hardy at origami-systems dot com -Status: Feedback +Status: Open Bug Type: HTTP related Operating System: freebsd 4.10 PHP Version: 5.0.4 New Comment: I am using firefox 1.0.4 on freebsd. Response Headers - http://xxx.local/update.php Date: Tue, 12 Jul 2005 14:14:53 GMT Server: Apache/1.3.33 (Unix) PHP/5.0.4 X-Powered-By: PHP/5.0.4 Keep-Alive: timeout=15, max=96 Connection: Keep-Alive Transfer-Encoding: chunked Content-Type: text/html 200 OK Previous Comments: [2005-07-12 16:12:38] [EMAIL PROTECTED] You don't need an action there. But if you set it explicitly it doesn't change the result. [2005-07-12 16:04:00] [EMAIL PROTECTED] Whats happend after you add the missing action tag ot the form? [2005-07-12 16:03:36] [EMAIL PROTECTED] Are you sure? I tested your code under both PHP 4.4 and 5.1 and it works nicely. With a request like: POST /abc.php HTTP/1.1 Host: localhost User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7.8) Gecko/20050511 Firefox/1.0.4 Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: UTF-8,* Keep-Alive: 300 Connection: keep-alive Referer: http://localhost/abc.php Content-Type: application/x-www-form-urlencoded Content-Length: 19 test=modify=Modify I get back: HTTP/1.x 404 Not Found Date: Tue, 12 Jul 2005 13:59:21 GMT Server: Apache/1.3.33 (Debian GNU/Linux) PHP/5.1.0-dev X-Powered-By: PHP/5.1.0-dev Content-Type: text/html; charset=utf-8 Keep-Alive: timeout=1, max=100 Connection: Keep-Alive Transfer-Encoding: chunked Of course, there is no body to the 404 response, because you are not sending any. So how exactly did you check that you were getting a 200 back on the POST request? [2005-07-12 15:38:58] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php5-latest.tar.gz For Windows: http://snaps.php.net/win32/php5-win32-latest.zip [2005-07-12 15:33:03] f dot hardy at origami-systems dot com Description: I have a problem with $_POST and the header() function. If I make a test on $_POST, my 404 http header is replaced by a 2OO OK header. If I make a test on $_GET (with a get action in html form), or an another variable, I receive the 404 http header. Reproduce code: --- ?php if (isset($_POST['test']) == true) { header(HTTP/1.1 404 Not Found, true); die(); } else { ? form method=post input type=text name=test value= / input type=submit name=modify value=Modify / /form ?php } ? Expected result: A 404 HTTP header in response. Actual result: -- A 200 OK HTTP header in response. -- Edit this bug report at http://bugs.php.net/?id=33661edit=1