ID:               41727
 User updated by:  dan at yes dot lt
 Reported By:      dan at yes dot lt
 Status:           Bogus
 Bug Type:         SPL related
 Operating System: WinXP
 PHP Version:      5.2.3
 New Comment:

I see... you make php for yourself, but not for others... you don't
listen for arguments, just skipping the bugs... without any reason
explanations...

thank you for good support and correct php!


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

[2007-06-22 10:29:15] [EMAIL PROTECTED]

.

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

[2007-06-22 07:46:23] dan at yes dot lt

ok, now think... if you have method to work with array or any object
with ArrayAccess implemented...

function some($list)
{
    if (isset($list[0])) {
       // do something with $list[0]
       return true;
    } else {
       // no $list[0] defined, skipping
       return false;
    }
}

user, who implements this function must not know the real type of the
$list variable - but only that this variable can be accessed as
array...

now - if $list = array(0 => null), then this function works correctly,
but if $list = new ArrayObject(array(0 => null)), then it fails...

now, you say, i must to use offsetGet method... then, i must check
whether $list is instance of ArrayAccess, then add complex checkings
using offsetExists and offsetGet... was the ArrayAccess realy planned to
be such a silly structure to use it in such complex way?.. I don't think
so. I still think, isset() must automaticaly call offsetGet after
offsetExists returns true...

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

[2007-06-22 07:34:01] [EMAIL PROTECTED]

Yes, I still think so.

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

[2007-06-22 04:38:24] dan at yes dot lt

isset — Determine whether a variable is set
[http://php.net/isset]

array_key_exists — Checks if the given key or index exists in the
array
[http://php.net/array-key-exists]

<?php
$a = array(0 => 10, 1 => null);
// so...
var_dump(isset($a[0]));             // bool(true)
var_dump(array_key_exists(0, $a));  // bool(true)
// but...
var_dump(isset($a[1]));             // bool(false)
var_dump(array_key_exists(0, $a));  // bool(true)
?>

now... 

ArrayObject::offsetExists — Returns whether the requested $index
exists
[http://php.net/ArrayObject-offsetExists]

so, offsetExists must return the same as array_key_exists... but how
isset() must work with ArrayAccess?..

<?php
$a = new ArrayObject(array(0 => 10, 1 => null));
// so...
var_dump(isset($a[0]));             // bool(true)
var_dump($a->offsetExists(0));      // bool(true)
var_dump(array_key_exists(0, $a));  // bool(true)
// but...
var_dump(isset($a[1]));             // bool(true) | false expected
var_dump($a->offsetExists(1));      // bool(true)
var_dump(array_key_exists(1, $a));  // bool(true)
?>

in this case isset() returns true, but obviously must return false...
don't you think so?.. isn't this situation silly?..
and do you still think - "this is not a bug"?..

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

[2007-06-21 21:55:36] [EMAIL PROTECTED]

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

You can call offsetGet() yourself if you want.

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

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/41727

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

Reply via email to