#23076 [NEW]: in_array generates error when using object as needle
| From: | colin at omenmedia dot com | Date: | Mon, 07 Apr 2003 02:06:51 +0000 |
| Subject: | #23076 [NEW]: in_array generates error when using object as needle | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-37234@lists.php.net to get a copy of this message | ||
From: colin at omenmedia dot com
Operating system: Windows 2000
PHP version: 4.3.1
PHP Bug Type: Arrays related
Bug description: in_array generates error when using object as needle
PHP is reporting a "Wrong datatype for first argument" error when using an
object as the needle argument for the in_array() function. The code below
will generate the error:
<?php
class Foo
{
}
$foo = new Foo();
$test = array(1,2,3,4,5);
if (in_array($foo,$test))
{
print "Yes";
}
else
{
print "No";
}
?>
--
Edit bug report at http://bugs.php.net/?id=23076&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=23076&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=23076&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=23076&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=23076&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=23076&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=23076&r=support
Expected behavior: http://bugs.php.net/fix.php?id=23076&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=23076&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=23076&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=23076&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=23076&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=23076&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=23076&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=23076&r=gnused