From:             jason at jasonjustman dot com
Operating system: irrelv
PHP version:      5CVS-2005-10-27 (snap)
PHP Bug Type:     Scripting Engine problem
Bug description:  zend.ze1_compatibility_mode doesn't implict clone when passed 
in array

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 bug report at http://bugs.php.net/?id=34998&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=34998&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=34998&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=34998&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=34998&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=34998&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=34998&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=34998&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=34998&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=34998&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=34998&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=34998&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=34998&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=34998&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=34998&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=34998&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=34998&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=34998&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=34998&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=34998&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=34998&r=mysqlcfg

Reply via email to