Bug #81698 [Opn->Nab]: getType()->getName() crashes on dynamic properties
| From: | cmb@php.net | Date: | Mon, 06 Dec 2021 11:06:30 +0000 |
| Subject: | Bug #81698 [Opn->Nab]: getType()->getName() crashes on dynamic properties | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-238212@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=81698&edit=1
ID: 81698
Updated by: cmb@php.net
Reported by: richiruizmartinez at gmail dot com
Summary: getType()->getName() crashes on dynamic properties
-Status: Open
+Status: Not a bug
Type: Bug
Package: Reflection related
Operating System: Ubuntu 20.04
PHP Version: 7.4.3
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
> The exact PHP version is 7.4.3
Then consider to update to the latest 7.4.26, where this issue
apparently has been fixed.
Previous Comments:
------------------------------------------------------------------------
[2021-12-06 08:03:28] richiruizmartinez at gmail dot com
The exact PHP version is 7.4.3
You can view the errors here:
https://asciinema.org/a/453949
------------------------------------------------------------------------
[2021-12-05 18:45:38] ilutov@php.net
Hm, both examples don't segfault on 3v4l.
https://3v4l.org/fPM7s
https://3v4l.org/2nH6H
Does it require opcache or something to crash? I tried it on master with opcache and it also worked
fine. Can you provide more information about your environment?
------------------------------------------------------------------------
[2021-12-04 22:23:52] richiruizmartinez at gmail dot com
getType()->__toString() also crashes:
$foo = new stdClass;
$foo->bar = 1;
var_dump((new ReflectionObject($foo))->getProperties()[0]->getType()->__toString());
------------------------------------------------------------------------
[2021-12-04 17:55:06] richiruizmartinez at gmail dot com
Description:
------------
When I run the code shown below, PHP generates a segmentation fault. The object $o has a dynamic
property $p. When trying to find out the type of $p, the segmentation fault appears.
Test script:
---------------
class C { }
$o = new C();
$o->p = 0;
$ro = new \ReflectionObject($o);
foreach ($ro->getProperties() as $rp) {
echo $rp->getType()->getName();
}
Expected result:
----------------
segmentation fault (core dumped)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=81698&edit=1