php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #33129 Error creating object not asigned with array parameters Error
Submitted: 2005-05-24 18:40 UTC Modified: 2005-05-25 11:27 UTC
From: ariel at liveinteractive dot net Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: 4.3.11 OS: Fedora
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: ariel at liveinteractive dot net
New email:
PHP Version: OS:

 

 [2005-05-24 18:40 UTC] ariel at liveinteractive dot net
Description:
------------
If I create an object without asign it wich creator function receive an array of created objects, the last object of the array is replaced with an object *RECURSION*

If I assign the new object it works fine.

I have the same problem with PHP 4.3.10

./configure \
	--enable-xml \
	--enable-wddx \
	--enable-bcmath=shared \
	--enable-calendar=shared \
	--enable-track-vars \
	--enable-trans-sid \
	--with-gd \
	--with-mysql \
	--with-libxml-dir=/usr/local \
	--with-jpeg-dir=/usr/lib \
	--with-png-dir=/usr/lib \
	--with-png-dir=/usr/lib \
	--with-mcrypt=/usr/lib \
	--with-zlib \
	--with-zlib-dir=/usr/lib \
	--enable-sockets \
	--with-apxs=/usr/local/apache/bin/apxs


Reproduce code:
---------------
<?php
echo "<pre>";
class A
{
	function A($a)
	{
		print_r($a);
	}
}
class B
{
	var $b;
	function B($b)
	{
		$this->b = $b;
print_r($this);
	}
}
/* $j = */new A(array(new B('1'), new B('2')));
?>

Expected result:
----------------
b Object
(
    [b] => 1
)
b Object
(
    [b] => 2
)
Array
(
    [0] => b Object
        (
            [b] => 1
        )

    [1] => b Object
        (
            [b] => 2
        )

)



Actual result:
--------------
b Object
(
    [b] => 1
)
b Object
(
    [b] => 2
)
Array
(
    [0] => b Object
        (
            [b] => 1
        )

    [1] => b Object
        (
            [b] =>  *RECURSION*
        )

)



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-05-25 11:27 UTC] sniper@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Jul 12 05:01:33 2025 UTC