Req #61066 [Opn->Fbk]: clones an object if using unserialize,spl_autoload_register
| From: | cmb@php.net | Date: | Sun, 26 Jul 2015 17:59:06 +0000 |
| Subject: | Req #61066 [Opn->Fbk]: clones an object if using unserialize,spl_autoload_register | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-194725@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=61066&edit=1
ID: 61066
Updated by: cmb@php.net
Reported by: arni at tsumi dot ru
Summary: clones an object if using
unserialize,spl_autoload_register
-Status: Open
+Status: Feedback
Type: Feature/Change Request
Package: SPL related
Operating System: FreeBSD
PHP Version: 5.3.10
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves.
A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external
resources such as databases, etc. If the script requires a
database to demonstrate the issue, please make sure it creates
all necessary tables, stored procedures etc.
Please avoid embedding huge scripts into the report.
Previous Comments:
------------------------------------------------------------------------
[2012-08-16 09:21:14] daniel dot beardsley at gmail dot com
It's pretty difficult to understand this without a reproducable testcase, but it
sounds very similar to this bug: https://bugs.php.net/bug.php?id=62836
------------------------------------------------------------------------
[2012-02-12 22:37:21] arni at tsumi dot ru
Description:
------------
clones an object if using unserialize,spl_autoload_register. This confuses the understanding of.
Test script:
---------------
spl_autoload_register(function($Class){
/* Include file */
});
/* File Core.php */
class Core{
public $field;
public function __construct(){
$this->field = time();
}
}
/* File Lite.php */
class Lite{
protected $Core;
public function __construct($Core){
$this->Core = $Core;
}
}
$Core = new Core();
if(!$Lite = $Cache->Load('Lite')){
$Lite = new Lite(); // Ok ...
}
echo $Core->field; // Ok ...
echo $Lite->Core->field; // Out null. $Core != $Core. $Core new object.
Expected result:
----------------
if($Core->field == $Lite->Core->field){
echo 'Ok!';
}else{
echo 'poorly';
}
Actual result:
--------------
$Core->field != $Lite->Core->field
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=61066&edit=1