ID: 36566
User updated by: stochnagara at hotmail dot com
Reported By: stochnagara at hotmail dot com
Status: Bogus
Bug Type: Class/Object related
Operating System: win xp
PHP Version: 5CVS-2006-03-01 (CVS)
New Comment:
Yes, it seems that it is bogus.
Sorry for wasting your time:(
Previous Comments:
------------------------------------------------------------------------
[2006-03-01 10:29:22] [EMAIL PROTECTED]
Notice the difference between:
1) unset (objectPool()->{$module}[$id]);
and
2) unset (objectPool()->{$module[$id]});
No bug here.
------------------------------------------------------------------------
[2006-03-01 10:26:52] stochnagara at hotmail dot com
And about
<?php
$m = 'o';
$p = 5;
var_dump($m[$p]);
?>
What do you expect to get in this case?
NOT empty result? Why?
So it seems that [] has a higher priority than -> in this case. It
seems that is rather counterintuitive:(
------------------------------------------------------------------------
[2006-03-01 10:20:14] stochnagara at hotmail dot com
Here is a more detailed sample:
http://debian.fmi.uni-sofia.bg/~kapitancho/phpbug2.php
------------------------------------------------------------------------
[2006-03-01 09:44:46] [EMAIL PROTECTED]
You didn't answer my question.
And I don't get why did you give the code that is not supposed to work
at all.
Provide a real reproduce code.
------------------------------------------------------------------------
[2006-03-01 09:25:28] stochnagara at hotmail dot com
I've just simplified that test example to match bug reporting
requirements for a short example.
I will extend it a little so you can understand what I mean.
I have a function called objectPool which returns an object of class
Pool. Class Pool has a method
__get which return an instance of an ORM class. The ORM class itself
binds offsetUnset($id) to
DELETE FROM table WHERE id=$id.
I have a function that gets two parametes - $id and $module. I
guarantee that this function receives correct
parameters. I intended to use 'unset (objectPool()->$module[$id]);' so
i get the ORM class for the module $module
and delete its record with id $id. Unfortunately, PHP echoes the fatal
error about the empty property.
Now my workaround is this:
$q = objectPool()->$module;
unset ($q[$id]);
which works perfect. I think that 'unset (objectPool()->$module[$id]);'
should also work perfect.
P.S. I've tested offsetExists, offsetSet and offsetUnset are also
buggy. offsetSet also raises a fatal error,
offsetExists always returns false and offsetGet returns as if it were
'objectPool()->$module' instead of
'objectPool()->$module[$id]'
------------------------------------------------------------------------
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/36566
--
Edit this bug report at http://bugs.php.net/?id=36566&edit=1