|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #61066 clones an object if using unserialize,spl_autoload_register
Submitted: 2012-02-12 22:37 UTC Modified: 2015-08-09 04:22 UTC
From: arni at tsumi dot ru Assigned: cmb (profile)
Status: No Feedback Package: SPL related
PHP Version: 5.3.10 OS: FreeBSD
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2012-02-12 22:37 UTC] arni at tsumi dot ru
clones an object if using unserialize,spl_autoload_register. This confuses the understanding of.

Test script:
     /* 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!';
     echo 'poorly';

Actual result:
$Core->field != $Lite->Core->field


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2012-08-16 09:21 UTC] 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:
 [2015-07-26 17:59 UTC]
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2015-07-26 17:59 UTC]
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.

 [2015-08-09 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sun Jun 07 10:01:24 2020 UTC