[RFC][Post-Discussion]: E_WARNING when using array-index on non valid container

php.internals

David Walker

9 years ago
Hi all, Joe had requested renewed discussion on the accepted RFC[1] and my proposed PR[2] be brought forward again for implementation discussion, and to come up with a resolution. The RFC, though accepted, had concerns with implementation specifically related to suppression of multiple warnings for nested access of dim-fetching. I tried to mitigate and resolve the problems raised during the RFC process by ensuring only to raise for non-list() access, and only if the op1 of the next opcode is VAR and is the same opcode as the current one. This seems to suppress all warnings I could think of testing, but am not sure all potential use-cases of when we attempt to fetch for read. Any thoughts on a better implementation, or other use cases that need attention would be appreciated. Cheers
-- Dave [1] - wiki [dot] php [dot] net/rfc/notice-for-non-valid-array-container [2] - github [dot] com/php/php-src/pull/2031

David Walker

9 years ago
[Sorry if this is a second time you get this, but email issues and all] Hi all, Joe had requested renewed discussion on the accepted RFC[1] and my proposed PR[2] be brought forward again for implementation discussion, and to come up with a resolution. The RFC, though accepted, had concerns with implementation specifically related to suppression of multiple warnings for nested access of dim-fetching. I tried to mitigate and resolve the problems raised during the RFC process by ensuring only to raise for non-list() access, and only if the op1 of the next opcode is VAR and is the same opcode as the current one. This seems to suppress all warnings I could think of testing, but am not sure all potential use-cases of when we attempt to fetch for read. Any thoughts on a better implementation, or other use cases that need attention would be appreciated. Cheers
-- Dave [1] - wiki [dot] php [dot] net/rfc/notice-for-non-valid-array-container [2] - github [dot] com/php/php-src/pull/2031

Dan Ackroyd

9 years ago
Hi David, On 11 January 2017 at 15:42, David Walker <dave@mudsite.com> wrote:
> Joe had requested renewed discussion on the accepted RFC[1] and my proposed > PR[2] be brought forward again for implementation discussion, and to come > up with a resolution. > > Any > thoughts on a better implementation, or other use cases that need attention > would be appreciated. >
Please could you give us an update on the status of the implementation, and are you still looking for advice on how what would be needed to complete it? cheers Dan Ack ps for the record, I just spent an hour today trying to figure out why code equivalent to $foo = null; echo $foo['bar'] wasn't triggering an error, so I hope this can make it for 7.2

lists@rhsoft.net

9 years ago
Am 31.05.2017 um 18:16 schrieb Dan Ackroyd:
> On 11 January 2017 at 15:42, David Walker <dave@mudsite.com> wrote: >> Joe had requested renewed discussion on the accepted RFC[1] and my proposed >> PR[2] be brought forward again for implementation discussion, and to come >> up with a resolution. >> >> Any >> thoughts on a better implementation, or other use cases that need attention >> would be appreciated. > > Please could you give us an update on the status of the > implementation, and are you still looking for advice on how what would > be needed to complete it? > > ps for the record, I just spent an hour today trying to figure out why > code equivalent to > > $foo = null; > echo $foo['bar'] > > wasn't triggering an error, so I hope this can make it for 7.2
because otherwise you couldn't do something like below with a 1-liner and so that PHP5.4 feature becomes pretty useless because for a isset() you need to store it in a var function GetKatMaxSort(): int { global $db; return (int)$db->fetch_row($db->query('select max(hsort) from ' . sql_prefix . 'haupt', 1, 0))[0]; }

David Walker

9 years ago
On Wed, May 31, 2017 at 10:16 AM Dan Ackroyd <danack@basereality.com> wrote:
> Hi David, > > On 11 January 2017 at 15:42, David Walker <dave@mudsite.com> wrote: > > Joe had requested renewed discussion on the accepted RFC[1] and my > proposed > > PR[2] be brought forward again for implementation discussion, and to come > > up with a resolution. > > > > Any > > thoughts on a better implementation, or other use cases that need > attention > > would be appreciated. > > > > Please could you give us an update on the status of the > implementation, and are you still looking for advice on how what would > be needed to complete it? >
I had sent out messages on the subject a while back and heard nothing in response. So I had assumed without more discussion it would have been merged at some point when prepping for 7.2. So if there's continued problems, and or issues, I'd be receptive to hearing about them. However my time to dedicate at it currently is pretty minimal, having recently taken a new job, most of my free cycles have been going to read/learn where i'm at now. cheers
-- Dave