PHP 4.0 Bug #6507: in_array never returns a proper value

From: Date: Sun, 03 Sep 2000 04:08:43 +0000
Subject: PHP 4.0 Bug #6507: in_array never returns a proper value
Groups: php.dev 
Request: Send a blank email to php-dev+get-31716@lists.php.net to get a copy of this message
From: darron@froese.org Operating system: Linux (Mandrake 7.0, 7.1) PHP version: 4.0.2 PHP Bug Type: Misbehaving function Bug description: in_array never returns a proper value This script works just fine in PHP 4.0.0 but fails in 4.0.1pl2, 4.0.2, PHP from CVS as of 8PM 09/02/2000. It's online and works here: PHP 4.0.0 <http://www.gary-campbell.com/test.php> Mandrake 7.0, Apache 1.3.12, Compiled as a DSO. It fails on this machine: PHP 4.0.2-cvs <http://www.educ8r.net/~darron/test.php> Mandrake 7.1, Apache 1.3.12, Compiled as a DSO. I tried it on a machine just now with the CVS version of PHP and it still fails. I've also tried it on a 4.0.2-release machine - it fails there too. <? for ($counter = 0; $counter < 11; $counter++) { $items[$counter] = $counter; } for ($counter = 0; $counter < 11; $counter++) { print "$counter = $items[$counter]<BR>\n"; } print "<P>"; for ($counter = 0; $counter < 11; $counter++) { print "$counter = $items[$counter]<BR>\n"; if (in_array("$counter", $items)) { $current_item = current($items); $previous_item = prev($items); print "Current: $current_item<BR>\n"; print "Previous: $previous_item<BR>\n"; } if (in_array("$counter", $items)) { $next_item = next($items); print "Next: $next_item<BR>\n"; } if ($prev_item) { print "Prev Item Exists<BR>\n"; } else { print "Prev Item Does NOT Exist<BR>\n"; } if ($next_item) { print "Next Item Exists<BR>\n"; } else { print "Next Item Does NOT Exist<P>\n"; } } ?> The php-4.0.0 was compiled with: ./configure \ --with-apxs=/usr/local/apache/bin/apxs \ --with-mysql=/usr/local/mysql-prod \ --with-pdflib \ --enable-ftp \ --with-ldap \ --with-imap=../imap-4.5 \ --with-zlib \ --with-jpeg-dir=/usr/lib \ --with-tiff-dir=/usr/lib \ --with-zlib-dir=/usr/lib \ --with-png-dir=/usr/lib \ --with-gd \ --with-ttf \ --with-xml \ --enable-trans-sid \ --enable-track-vars=yes \ --enable-magic-quotes=yes The php-4.0.2 was compiled with: ./configure \ --with-apxs=/usr/local/apache/bin/apxs \ --with-mysql=/usr/local/mysql-prod \ --with-pdflib \ --enable-ftp \ --with-ldap \ --with-imap=../imap-4.5 \ --with-zlib \ --with-jpeg-dir=/usr/lib \ --with-tiff-dir=/usr/lib \ --with-zlib-dir=/usr/lib \ --with-png-dir=/usr/lib \ --with-gd \ --with-ttf \ --with-xml \ --enable-trans-sid \ --enable-track-vars=yes \ --enable-magic-quotes=yes

« previous php.dev (#31716) next »