From:             daniel at rozsnyo dot com
Operating system: WinXP
PHP version:      5CVS-2004-04-26 (dev)
PHP Bug Type:     Zend Engine 2 problem
Bug description:  Missing implicit object to integer conversion

Description:
------------
While the docs says that i can use use objects as needle, i actually can
not - it might be missing some implicit conversion to integer from
objects.
(I use the published RC2 version (for win32), not the CVS version, the RC2
option is not available in the listbox for posting a bug-report)

Another problem is the notice (in RC1 there was no notice, here is a
notice... so I am posting as bug... by the way, it would be nice to have
functions like __toInteger() [in_array], __toArray() [for]  besides the
known __toString [echo,print]

Daniel

Reproduce code:
---------------
<?php

  class A { }
  $a = Array( new A, new A, new A );
  echo $x = new A; // should be object # 4
  echo (in_array($x,$a)) ? 'There' : 'NOT there';

?>

Expected result:
----------------
I am expecting this result:
---
Object id #4
NOT there


Actual result:
--------------
Look to notices:
---
Object id #4
Notice: Object of class A could not be converted to integer in
C:\www\default\test\index.php on line 9

Notice: Object of class A could not be converted to integer in
C:\www\default\test\index.php on line 9
There

-- 
Edit bug report at http://bugs.php.net/?id=28165&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=28165&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=28165&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=28165&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=28165&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=28165&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=28165&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=28165&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=28165&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=28165&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=28165&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=28165&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=28165&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28165&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=28165&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=28165&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=28165&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=28165&r=float

Reply via email to