ID:               23935
 Comment by:       tater at potatoe dot com
 Reported By:      dave at codewhore dot org
 Status:           Closed
 Bug Type:         Arrays related
 Operating System: Linux 2.4
 PHP Version:      5CVS-2003-05-31 (dev)
 Assigned To:      sterling
 New Comment:

I am still seeing this on the latest CVS code. It goes beyond
array_flip(), too. I first saw this in an array value from $_REQUEST,
and array_combine() will produce the same effect - anything that can
get a numeric array key to be a string rather than a number.


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

[2003-06-30 13:51:56] [EMAIL PROTECTED]

This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.



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

[2003-06-06 16:08:35] dave at codewhore dot org

I should clarify that it looks like the problem is in array_flip, not
array_key_exists. Is it okay to keep this here?

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

[2003-06-06 16:07:23] dave at codewhore dot org

Hi Sterling:

I think there's a remaining (related) problem, this time with array
keys that are strings. I've enclosed a test case.

<?php
  /* This works */
  $f = array('7' => 0);
  var_dump($f);
  var_dump(array_key_exists(7, $f));

  /* This doesn't */
  $f = array_flip(array('7'));
  var_dump($f);
  var_dump(array_key_exists(7, $f));
?>

On PHP 5, I get:

array(1) {
  [7]=>
  int(0)
}
bool(true)
array(1) {
  ["7"]=>
  int(0)
}
bool(false)

On PHP 4 I get:
array(1) {
  [7]=>
  int(0)
}
bool(true)
array(1) {
  [7]=>
  int(0)
}
bool(true)


Thanks in advance,
- Dave

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

[2003-06-05 11:16:09] [EMAIL PROTECTED]

This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.

fixed in cvs, thanks.

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

[2003-05-31 23:12:32] dave at codewhore dot org

Hi:

The following script produces different output with PHP 5 HEAD than it
does with the PHP 4.3 stable branch:

<?php
  $f[1] = 1;
  var_dump(array_key_exists('1', $f));
?>

With PHP 4.3 stable, I get:
  bool(true)

With PHP 5 HEAD, I get:
  bool(false)

It appears that PHP 5 HEAD is missing the call to HANDLE_NUMERIC() in
zend_hash_exists (Zend/zend_hash.c). The ZE2 changelog shows that it
was moved:

  move HANDLE_NUMERIC() from the hash table
  implementation upstream to the places that
  actually need to use it.

But I'm unable to figure out where the equivalent functionality was
added back. Am I missing something?

Thanks in advance,

- Dave


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


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

Reply via email to