ID:               35093
 User updated by:  tony at marston-home dot demon dot co dot uk
 Reported By:      tony at marston-home dot demon dot co dot uk
 Status:           Bogus
 Bug Type:         Arrays related
 Operating System: Windows XP
 PHP Version:      4.4.1
 New Comment:

Bug 35084 reports a problem with current() and next() whereas my
problem happens with key(). How am I supposed to know they are the
same?

The term BOGUS means 'this is not a bug, you idiot' whereas DUPLICATE
means 'this has already been reported before'. Two different meanings
require two different headings otherwise it could lead people to
believe that all those bugs marked BOGUS are not bugs at all but down
to incompetent programming. There is a difference, you know.

If your bug reporting software can't handle it then I suggest you
update it immediately.


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

[2005-11-03 21:31:11] [EMAIL PROTECTED]

1. policy is to mark duplicates bogus (you should search better)
2. foreach is not the problem (key() is)
3. see bug #35084 (yes, this is the same)

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

[2005-11-03 21:25:45] tony at marston-home dot demon dot co dot uk

Duplicate of what bug?

I searched the bug database before submitting this, and none of the
descriptions were anywhere near what I was experiencing. How am I
supposed to know that the source of the bug is the same if the
descriptions are different?

Your response is uninformative, and you really should introduce the
status of DUPLICATE instead of BOGUS.

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

[2005-11-03 21:11:23] [EMAIL PROTECTED]

Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.



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

[2005-11-03 21:10:23] tony at marston-home dot demon dot co dot uk

Description:
------------
When I use foreach($array as $key => $value) on an indexed array,
afterwards the index value, when viewed with key($array) is null
instead of an integer. This means that when my code tests the array to
see if it is either indexed or associative it is given the wrong
answer.

Reproduce code:
---------------
<?php
$array[] = 'string of data';

if (is_int(key($array))) {
        echo "array is indexed\n";
} else {
        echo "array is associativ\/n";
} // if

foreach ($array as $key => $value) {
    if ($key === key($array)) {
        echo "they are the same\n";
    } else {
        echo "they are NOT the same\n";
    } // if
} // foreach

if (is_int(key($array))) {
        echo "array is indexed\n";
} else {
        echo "array is associative\n";
} // if
?>

Expected result:
----------------
The output 'array is indexed' should be produced both before and after
the foreach() statement.

Actual result:
--------------
The key of an indexed array, when viewed with key($array), is not being
reported as an integer.


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


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

Reply via email to