#36566 [Opn->Fbk]: offsetUnset after __get with dynamic params fails.

From: Date: Wed, 01 Mar 2006 07:37:49 +0000
Subject: #36566 [Opn->Fbk]: offsetUnset after __get with dynamic params fails.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-93785@lists.php.net to get a copy of this message
ID: 36566 Updated by: tony2001@php.net Reported By: stochnagara at hotmail dot com -Status: Open +Status: Feedback Bug Type: Class/Object related Operating System: win xp PHP Version: 5CVS-2006-03-01 (CVS) New Comment: <?php $m = 'o'; $p = 5; var_dump($m[$p]); ?> What do you expect to get in this case? NOT empty result? Why? Previous Comments: ------------------------------------------------------------------------ [2006-03-01 08:29:18] stochnagara at hotmail dot com Description: ------------ when property and array overloading is used in a combination with a property and array offset taken from variable, not from constants, PHP fails with 'cannot access empty property message' which is wrong. Reproduce code: --------------- <? class foo_1 implements ArrayAccess { function offsetGet($q){} function offsetSet($q,$r){} function offsetExists($q){} function offsetUnset ($q) { echo "unset successful"; } } class foo_2 { function __get($q) { return new foo_1; } } $f = new foo2; $m = 'o'; $p = 5; unset ($f->$m[$p]); Expected result: ---------------- unset successful Actual result: -------------- Cannot access empty property ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=36566&edit=1

« previous php.bugs (#93785) next »