Bug #78031 [Opn->Dup]: __toString segmentation fault

From: Date: Sat, 18 May 2019 08:13:01 +0000
Subject: Bug #78031 [Opn->Dup]: __toString segmentation fault
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-220889@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=78031&edit=1 ID: 78031 Updated by: cmb@php.net Reported by: gmblar+php at gmail dot com Summary: __toString segmentation fault -Status: Open +Status: Duplicate Type: Bug -Package: PDO related +Package: Scripting Engine problem Operating System: macOS 10.14.5 PHP Version: Irrelevant -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: This is actually a duplicate of the mentioned tickets. In this case trying to convert the variable property name $this to string calls Foobar::__toString() again, and so on, till the machine stack is exhausted. Note that we consider infinite recursion to be a userland programming error. Previous Comments: ------------------------------------------------------------------------ [2019-05-18 01:45:57] gmblar+php at gmail dot com Description: ------------ PHP crashes with "Segmentation fault: 11" if you access $this->$this in __toString. maybe related to: * https://bugs.php.net/bug.php?id=53858 * https://bugs.php.net/bug.php?id=67319 https://3v4l.org/Rt2Qj/perf#output Test script: --------------- <?php class Foobar { public function __toString() { $this->$this; } } $foobar = new Foobar(); (string) $foobar; Expected result: ---------------- no segmentation fault Actual result: -------------- Segmentation fault: 11 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=78031&edit=1

« previous php.bugs (#220889) next »