#34998 [Asn->WFx]: zend.ze1_compatibility_mode doesn't implict clone when passed in array

From: Date: Wed, 24 May 2006 08:03:24 +0000
Subject: #34998 [Asn->WFx]: zend.ze1_compatibility_mode doesn't implict clone when passed in array
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-97493@lists.php.net to get a copy of this message
 ID:               34998
 Updated by:       dmitry@php.net
 Reported By:      jason at jasonjustman dot com
-Status:           Assigned
+Status:           Wont fix
 Bug Type:         Scripting Engine problem
 Operating System: *
 PHP Version:      5CVS-2005-10-27 (snap)
 Assigned To:      dmitry
 New Comment:

zend.ze1_compatibility_mode was removed from HEAD and PHP_5_2 branches.


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

[2005-11-26 09:02:15] jason at jasonjustman dot com

still present in:

PHP Version 5.1.0
System 	SunOS apache 5.10 Generic sun4u

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

[2005-10-27 10:12:02] jason at jasonjustman dot com

Description:
------------
Again, with zend.ze1_compatibility_mode, it fails to properly clone
objects when calling as an argument for the array() function.  

This BC break is getting annoying...

Reproduce code:
---------------
<?
$single_container = array();
$double_container = array();

class base_object {};
$x = new base_object;

$x->value = 5;
$single_container[1] = $x;
$double_container[1] = array($x);

$x->value = 10;
$single_container[2] = $x;
$double_container[2] = array($x);

$x->value = 15;
$single_container[3] = $x;
$double_container[3] = array($x);

print_r($single_container);
print_r($double_container);


Expected result:
----------------
//single
Array
(
    [1] => base_object Object
        (
            [value] => 5
        )

    [2] => base_object Object
        (
            [value] => 10
        )

    [3] => base_object Object
        (
            [value] => 15
        )

)
//double, values are correct
Array
(
    [1] => Array
        (
            [0] => base_object Object
                (
                    [value] => 5
                )

        )

    [2] => Array
        (
            [0] => base_object Object
                (
                    [value] => 10
                )

        )

    [3] => Array
        (
            [0] => base_object Object
                (
                    [value] => 15
                )

        )

)

Actual result:
--------------
//single
Array
(
    [1] => base_object Object
        (
            [value] => 5
        )

    [2] => base_object Object
        (
            [value] => 10
        )

    [3] => base_object Object
        (
            [value] => 15
        )

)

//double - values are incorrect
Array
(
    [1] => Array
        (
            [0] => base_object Object
                (
                    [value] => 15
                )

        )

    [2] => Array
        (
            [0] => base_object Object
                (
                    [value] => 15
                )

        )

    [3] => Array
        (
            [0] => base_object Object
                (
                    [value] => 15
                )

        )

)


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


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


Thread (6 messages)

« previous php.bugs (#97493) next »