Bug #81216 [NEW]: Nullsafe operator leaks dynamic property name
| From: | nikic@php.net | Date: | Thu, 01 Jul 2021 14:42:34 +0000 |
| Subject: | Bug #81216 [NEW]: Nullsafe operator leaks dynamic property name | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-234740@lists.php.net to get a copy of this message | ||
From: nikic
Operating system:
PHP version: 8.0.8
Package: Scripting Engine problem
Bug Type: Bug
Bug description:Nullsafe operator leaks dynamic property name
Description:
------------
Split off from bug #81190:
<?php
$str = "foo";
null?->{$str . "bar"};
leaks the property name. The opcodes look like this:
0000 ASSIGN CV0($str) string("foo")
0001 T2 = CONCAT CV0($str) string("bar")
0002 T3 = JMP_NULL null 0004
0003 T3 = FETCH_OBJ_R null T2
0004 FREE T3
0005 RETURN int(1)
Note that the CONCAT happens before the JMP_NULL. This is JMP_NULL is
part of the delayed opline stack.
Possibly we could get away with not using delayed oplines with nullsafe,
because nullsafe cannot be used in write context, so not delaying should
be safe. It will result in different evaluation order than non-nullsafe
properties though.
--
Edit bug report at https://bugs.php.net/bug.php?id=81216&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=81216&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=81216&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=81216&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=81216&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=81216&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=81216&r=support
Expected behavior: https://bugs.php.net/fix.php?id=81216&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=81216&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=81216&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=81216&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=81216&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=81216&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=81216&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=81216&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=81216&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=81216&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=81216&r=mysqlcfg