Bug #73973 [Opn]: debug_zval_dump() assertion error for resource consts with --enable-debug

From: Date: Tue, 24 Jan 2017 10:43:00 +0000
Subject: Bug #73973 [Opn]: debug_zval_dump() assertion error for resource consts with --enable-debug
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-206910@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73973&edit=1 ID: 73973 Updated by: nikic@php.net Reported by: tandre at ifwe dot co Summary: debug_zval_dump() assertion error for resource consts with --enable-debug Status: Open Type: Bug Package: Reproducible crash Operating System: All/Linux PHP Version: 7.1.1 Block user comment: N Private report: N New Comment: Something very fishy is being done when defining resources: https://github.com/php/php-src/blob/master/Zend/zend_builtin_functions.c#L928 Previous Comments: ------------------------------------------------------------------------ [2017-01-23 00:40:00] tandre at ifwe dot co Description: ------------ This happens when a constant is define()d to be a value with the type resource. This affects php 7.0.14 and 7.1.0 and 7.1.1, other versions weren't tested. php-config used: --prefix [/php-7.1.1-install] --includes [-I/php-7.1.1-install/include/php -I/php-7.1.1-install/include/php/main -I/php-7.1.1-install/include/php/TSRM -I/php-7.1.1-install/include/php/Zend -I/php-7.1.1-install/include/php/ext -I/php-7.1.1-install/include/php/ext/date/lib] --ldflags [ -L/usr/lib/x86_64-linux-gnu] --libs [-lcrypt -lexslt -ltidy -lresolv -lcrypt -lreadline -ltermcap -lrt -lstdc++ -lpng -lz -lcurl -lbz2 -lz -lrt -lm -ldl -lnsl -lapparmor -lpthread -lxml2 -lssl -lcrypto -lcurl -lxml2 -licui18n -licuuc -licudata -licuio -lxml2 -lxml2 -lcrypt -lxml2 -lxml2 -lxml2 -lxml2 -lxslt -lxml2 -lcrypt ] --extension-dir [/php-7.1.1-install/lib/php/extensions/debug-zts-20160303] --include-dir [/php-7.1.1-install/include/php] --man-dir [/php-7.1.1-install/php/man] --php-binary [/php-7.1.1-install/bin/php] --php-sapis [ cli fpm phpdbg cgi] --configure-options [--prefix=/php-7.1.1-install --enable-debug --enable-maintainer-zts --enable-fpm --enable-intl --with-pear --with-gd --with-zlib --enable-soap --enable-xmlreader --with-xsl --with-curl --with-tidy --with-xmlrpc --enable-sysvsem --enable-sysvshm --enable-shmop --enable-pcntl --with-readline --enable-mbstring --with-gettext --enable-sockets --with-bz2 --with-openssl --enable-bcmath --enable-sysvmsg] --version [7.1.1] --vernum [70101] Test script: --------------- // In CLI, with --enable-debug --enable-maintainer-zts define('myerr', fopen('php://stderr', 'w')); var_dump(myerr); // resource(2) of type (stream) debug_zval_dump(myerr); // php: /php-7.1.1/Zend/zend_types.h:822: zval_refcount_p: Assertion `(((*(pz)).u1.v.type_flags & (1<<2)) != 0) || // (((*(pz)).u1.v.type_flags & (1<<1)) != 0)' failed. // [1] 4964 abort /php-7.1.1-install/bin/php -a Expected result: ---------------- debug_zval_dump should print information about constant resource and reference counting information without crashing. (When compiled with --enable-debug) Actual result: -------------- php crashes because of an assertion error when debug_zval_dump is called with a resource assigned to a constant. (Only when compiled with --enable-debug) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=73973&edit=1

« previous php.bugs (#206910) next »