#38782 [Csd->Fbk]: Object confusion related to arrays

From: Date: Mon, 11 Sep 2006 18:57:40 +0000
Subject: #38782 [Csd->Fbk]: Object confusion related to arrays
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-102007@lists.php.net to get a copy of this message
 ID:               38782
 Updated by:       tony2001@php.net
 Reported By:      saeven at saeven dot net
-Status:           Closed
+Status:           Feedback
 Bug Type:         Scripting Engine problem
 Operating System: CentOS/Windows/Slackware
 PHP Version:      5.1.6
 New Comment:

Can't reproduce with both 5.1.6 and 5.2.


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

[2006-09-11 18:57:39] saeven at saeven dot net

Issue corrected.

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

[2006-09-11 18:52:30] saeven at saeven dot net

Description:
------------
When specifying a parameter object type in a method signature, if the
object was stored in an array prior to being passed, the method
signature revokes the object type even though var_dump reports it to be
correct!



Reproduce code:
---------------
[file: obj.php]

class Obj1{
  //.. object methods/params herein
}

---------------------------------------
[file: main.php]

function foo( Obj1 $x ){}

$a = array();
$o = new Obj1();
$a[0] = $o;

foo( $a[0] );

Expected result:
----------------
shouldn't see any errors

Actual result:
--------------
Fatal error: Argument 1 passed to foo() must be an object of class Obj1


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


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


Thread (4 messages)

« previous php.bugs (#102007) next »