ID:               39922
 Updated by:       [EMAIL PROTECTED]
 Reported By:      willem at fkkc dot nl
-Status:           Open
+Status:           Bogus
 Bug Type:         Scripting Engine problem
 Operating System: Debian
 PHP Version:      5.2.0
 New Comment:

5.2.0 - Position = 0
5.1.6 - Position = 0
5.0.3 - Position = 0
4.4.4 - Position = 0



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

[2006-12-22 11:09:14] willem at fkkc dot nl

I'm sorry for the typo in the reproduce-code, here's a correct one.

$array = array('a1','b2','c3');
array_unshift($array,'d4');
$pos = array_search('d4',$array);
if($pos === FALSE){
    print implode(',',$array);
}else{
    print 'Position = '.$pos;
}

I've re-opened the bug-report because it's not a bogus to my opninion.

The code worked fine in php 5.1.4, in php 5.2 not anymore.
The only work-around to fix the problem was to implode the array and
use regular expressions to check if the value is there.

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

[2006-12-21 14:31:29] [EMAIL PROTECTED]

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.



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

[2006-12-21 13:51:29] smlerman at gmail dot com

Fix your error_reporting and/or display_errors settings.

Warning: Wrong parameter count for array_search() in ... on line 4

http://www.php.net/manual/en/function.array-search.php

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

[2006-12-21 11:40:41] willem at fkkc dot nl

Description:
------------
array_search returns incorrect position-value when an array is modified
with array_push or array_unshift

Reproduce code:
---------------
$array = array('a1','b2','c3');
array_unshift($array,'d4');
$pos = array_search('d4');
if($pos === FALSE){
    print implode(',',$array);
}else{
    print 'Position = '.$pos;
}

Expected result:
----------------
Position = 0

Actual result:
--------------
d4,a1,b2,c3


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


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

Reply via email to