php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34998 zend.ze1_compatibility_mode doesn't implict clone when passed in array
Submitted: 2005-10-27 10:12 UTC Modified: 2006-05-25 02:31 UTC
Votes:3
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: jason at jasonjustman dot com Assigned: dmitry (profile)
Status: Wont fix Package: Scripting Engine problem
PHP Version: 5CVS-2005-10-27 (snap) OS: *
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2005-10-27 10:12 UTC] 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
                )

        )

)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-11-26 09:02 UTC] jason at jasonjustman dot com
still present in:

PHP Version 5.1.0
System 	SunOS apache 5.10 Generic sun4u
 [2006-05-24 08:03 UTC] dmitry@php.net
zend.ze1_compatibility_mode was removed from HEAD and PHP_5_2 branches.
 [2006-05-25 02:31 UTC] jason at jasonjustman dot com
Please tell me this is because the php5.2 object model will operate like php 4 if this flag is going to be removed.

thanks,
jason
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 04 11:01:32 2024 UTC