From: ariel at liveinteractive dot net
Operating system: Fedora
PHP version: 4.3.11
PHP Bug Type: Class/Object related
Bug description: Error creatin object not asigned with array parameters Error
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*
)
)
--
Edit bug report at http://bugs.php.net/?id=33129&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33129&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=33129&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=33129&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=33129&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=33129&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=33129&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=33129&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=33129&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=33129&r=support
Expected behavior: http://bugs.php.net/fix.php?id=33129&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=33129&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=33129&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=33129&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33129&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=33129&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=33129&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=33129&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=33129&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=33129&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=33129&r=mysqlcfg