#35281 [Opn->Fbk]: Session extension does not respect visibility of __sleep()

From: Date: Fri, 18 Nov 2005 18:25:08 +0000
Subject: #35281 [Opn->Fbk]: Session extension does not respect visibility of __sleep()
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-88491@lists.php.net to get a copy of this message
 ID:               35281
 Updated by:       tony2001@php.net
 Reported By:      mike at naberezny dot com
-Status:           Open
+Status:           Feedback
 Bug Type:         Class/Object related
 Operating System: Windows XP
 PHP Version:      5.0.5
 New Comment:

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




Previous Comments:
------------------------------------------------------------------------

[2005-11-18 19:08:13] mike at naberezny dot com

Description:
------------
The session extension does not respect the visibility of the __sleep()
method.  If __sleep() is protected or private, calling serialize() will
raise a fatal error.  However, the session extension will still
serialize it.

Reproduce code:
---------------
<?php
class Foo { protected function __sleep() {} }

$_SESSION['foo'] = new Foo();
var_dump($_SESSION['foo']);
?>

Expected result:
----------------
"Fatal error:  Call to protected method Foo::__sleep() from context..."
at the time of assignment.

Actual result:
--------------
object(Foo)#1 (0) {
}


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=35281&edit=1


Thread (5 messages)

« previous php.bugs (#88491) next »