Re: PHP 4.4.1 "array_set_current" bug?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Dec 16, 2005 at 09:09:08AM -0500, Eric Butera wrote:
> Hello all,
> 
> I have an image gallery script I created and I seem to be having some
> difficulties with it.  I am using this script on many different platforms
> and different PHP versions.  I have tried it on 4.4.0 (linux) and
> 4.3.11(entrophy osx).  The problem is with PHP version
> 4.4.1 from what I can tell.  That is what I am emailing for, to verify. =)
> 
> The problem is this function:
>     function array_set_current(&$array, $key) {
> 
>         reset($array);
> 
>         while(current($array)) {
> 
>             if (key($array) == $key) {
>                 break;
>             } // if
> 
>             next($array);
>         } // while
> 
>     } // function
> 
> 
> On 4.4.0 and 4.3.11 I can pass an array and key and it will match the key
> and break perfectly.  Recently one of our servers upgraded to 4.4.1.  This
> script was working previously and now does not.  I ended up echoing out the
> value of key().  On 4.4.1 the key is always 0. Next() does not goto the next
> key.  On 4.4.0 and 4.3.11 the next() works fine.

well, this works perfectly fine on php 4.4.1:

<?php

$a = array('a' => 'a', 'b' => 'b', 'c' => 'c');

array_set_current($a, 'b');

var_dump(current($a));
// prints  string(1) "b"


Curt.
--
cat .signature: No such file or directory

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux