Bug #78946 [NEW]: args missing in Exception within __get
From: php at usox dot org
Operating system: Gentoo x64
PHP version: 7.4.0
Package: *General Issues
Bug Type: Bug
Bug description:args missing in Exception within __get
Description:
------------
Hi
Exceptions thrown within a __get method lack the args array key in the
exception backtrace.
This behaviour has been reproduced on three independent systems running
Gentoo Linux with different configs. It was _not_ reproducible on 3v4l
(see https://3v4l.org/to1qQ).
It looks like the same issue reported in here 10 years ago
https://bugs.php.net/bug.php?id=47284
Removing all extensions and modules (last try was a build with just
readline enabled) didn't solve the issue.
Ini Changes:
- error_reporting = E_ALL & ~E_STRICT
- memory_limit = 4294967296
Compiler: gcc 9.2
Configuration:
./configure --prefix=/usr --build=x86_64-pc-linux-gnu
--host=x86_64-pc-linux-gnu --mandir=/usr/share/man
--infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc
--localstatedir=/var/lib --docdir=/usr/share/doc/php-7.4.0
--htmldir=/usr/share/doc/php-7.4.0/html --prefix=/usr/lib64/php7.4
--mandir=/usr/lib64/php7.4/man --infodir=/usr/lib64/php7.4/info
--libdir=/usr/lib64/php7.4/lib --with-libdir=lib64 --localstatedir=/var
--without-pear --disable-maintainer-zts --without-password-argon2
--enable-bcmath --with-bz2=/usr --disable-calendar --disable-gcov
--enable-ctype --with-curl --enable-dom --without-enchant --disable-exif
--without-ffi --enable-fileinfo --enable-filter --disable-ftp
--with-gettext=/usr --without-gmp --without-mhash --with-iconv
--enable-intl --enable-ipv6 --enable-json --without-kerberos
--with-libxml --enable-mbstring --with-openssl --enable-pcntl
--enable-phar --enable-pdo --enable-opcache --with-pgsql=/usr
--enable-posix --without-pspell --enable-simplexml --disable-shmop
--without-snmp --enable-soap --enable-sockets --without-sodium
--with-sqlite3 --disable-sysvmsg --disable-sysvsem --disable-sysvshm
--with-tidy=/usr --enable-tokenizer --enable-xml --enable-xmlreader
--enable-xmlwriter --with-xmlrpc --with-xsl --with-zip --with-zlib=/usr
--enable-debug --enable-dba --without-cdb --with-db4=/usr
--enable-flatfile --with-gdbm=/usr --disable-inifile --without-qdbm
--without-tcadb --without-lmdb --with-freetype --disable-gd-jis-conv
--with-jpeg --without-xpm --without-webp --enable-gd
--with-mysqli=mysqlnd --without-mysql-sock --without-unixODBC
--without-iodbc --without-pdo-odbc --without-oci8 --without-pdo-dblib
--without-pdo-mysql --with-pdo-pgsql --with-pdo-sqlite
--without-pdo-firebird --without-pdo-oci --with-readline=/usr
--without-libedit --without-mm --with-pic --with-external-pcre
--without-pcre-jit
--cache-file=/var/tmp/portage/dev-lang/php-7.4.0/temp/config.cache
--with-config-file-path=/etc/php/cli-php7.4
--with-config-file-scan-dir=/etc/php/cli-php7.4/ext-active
--disable-embed --enable-cli --disable-cgi --disable-fpm --without-apxs2
--disable-phpdbg
Test script:
---------------
class FooBar {
public function __get($text) {
throw new \Exception();
}
}
try {
$foobar = new FooBar();
$foobar->hello;
} catch (\Exception $e) {
var_dump($e);
}
Expected result:
----------------
object(Exception)#2 (7) {
["message":protected]=>
string(0) ""
["string":"Exception":private]=>
string(0) ""
["code":protected]=>
int(0)
["file":protected]=>
string(28) "/tmp/bug.php"
["line":protected]=>
int(6)
["trace":"Exception":private]=>
array(1) {
[0]=>
array(6) {
["file"]=>
string(28) "/tmp/bug.php"
["line"]=>
int(12)
["function"]=>
string(5) "__get"
["class"]=>
string(6) "FooBar"
["type"]=>
string(2) "->"
["args"]=>
array(1) {
[0]=>
string(5) "hello"
}
}
}
["previous":"Exception":private]=>
NULL
}
Actual result:
--------------
object(Exception)#2 (7) {
["message":protected]=>
string(0) ""
["string":"Exception":private]=>
string(0) ""
["code":protected]=>
int(0)
["file":protected]=>
string(28) "/tmp/bug.php"
["line":protected]=>
int(6)
["trace":"Exception":private]=>
array(1) {
[0]=>
array(5) {
["file"]=>
string(28) "/tmp/bug.php"
["line"]=>
int(12)
["function"]=>
string(5) "__get"
["class"]=>
string(6) "FooBar"
["type"]=>
string(2) "->"
}
}
["previous":"Exception":private]=>
NULL
}
--
Edit bug report at https://bugs.php.net/bug.php?id=78946&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=78946&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=78946&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=78946&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=78946&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=78946&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=78946&r=support
Expected behavior: https://bugs.php.net/fix.php?id=78946&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=78946&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=78946&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=78946&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=78946&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=78946&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=78946&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=78946&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=78946&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=78946&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=78946&r=mysqlcfg
Thread (1 message)
- php at usox dot org