From: brandon at ambitious dot tech
Operating system: Gentoo
PHP version: 7.0.9
Package: Unknown/Other Function
Bug Type: Bug
Bug description:declare(ticks=1) and register_tick_function() together cause PHP7 to seg fault
Description:
------------
PHP version: 7.0.9-r2
Configure line: './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.0.9-r2'
'--htmldir=/usr/share/doc/php-7.0.9-r2/html'
'--prefix=/usr/lib64/php7.0' '--mandir=/usr/lib64/php7.0/man'
'--infodir=/usr/lib64/php7.0/info' '--libdir=/usr/lib64/php7.0/lib'
'--with-libdir=lib64' '--localstatedir=/var' '--without-pear'
'--enable-maintainer-zts' '--disable-bcmath' '--with-bz2=/usr'
'--disable-calendar' '--enable-ctype' '--without-curl'
'--disable-dom'
'--without-enchant' '--disable-exif' '--disable-fileinfo'
'--disable-filter' '--disable-ftp' '--with-gettext=/usr'
'--without-gmp'
'--enable-hash' '--without-mhash' '--with-iconv'
'--disable-intl'
'--disable-ipv6' '--enable-json' '--without-kerberos'
'--disable-libxml'
'--without-libxml-dir' '--enable-mbstring' '--with-mcrypt=/usr'
'--with-onig=/usr' '--with-openssl=/usr' '--with-openssl-dir=/usr'
'--disable-pcntl' '--disable-phar' '--enable-pdo'
'--disable-opcache'
'--without-pgsql' '--enable-posix' '--without-pspell'
'--without-recode'
'--disable-simplexml' '--disable-shmop' '--without-snmp'
'--disable-soap' '--disable-sockets' '--without-sqlite3'
'--disable-sysvmsg' '--disable-sysvsem' '--disable-sysvshm'
'--without-fpm-systemd' '--without-tidy' '--disable-tokenizer'
'--disable-wddx' '--disable-xml' '--disable-xmlreader'
'--disable-xmlwriter' '--without-xmlrpc' '--without-xsl'
'--disable-zip'
'--with-zlib=/usr' '--disable-debug' '--enable-dba'
'--without-cdb'
'--with-db4=/usr' '--disable-flatfile' '--without-gdbm'
'--disable-inifile' '--without-qdbm' '--without-freetype-dir'
'--disable-gd-jis-conv' '--without-jpeg-dir' '--without-png-dir'
'--without-xpm-dir' '--without-gd' '--without-interbase'
'--without-mysqli' '--with-mysql-sock=/var/run/mysqld/mysqld.sock'
'--without-unixODBC' '--without-iodbc' '--without-oci8'
'--without-pdo-dblib' '--with-pdo-mysql=mysqlnd' '--without-pdo-pgsql'
'--without-pdo-sqlite' '--without-pdo-firebird' '--without-pdo-odbc'
'--without-pdo-oci' '--with-readline=/usr' '--without-libedit'
'--without-mm' '--with-pic' '--with-pcre-regex=/usr'
'--with-pcre-dir=/usr' '--with-config-file-path=/etc/php/apache2-php7.0'
'--with-config-file-scan-dir=/etc/php/apache2-php7.0/ext-active'
'--disable-embed' '--disable-cli' '--disable-cgi'
'--disable-fpm'
'--with-apxs2=/usr/bin/apxs' '--disable-phpdbg'
'build_alias=x86_64-pc-linux-gnu' 'host_alias=x86_64-pc-linux-gnu'
'CPPFLAGS='
Basically, the declare(ticks=1); line and register_tick_function
line together cause PHP to throw a segmentation fault. Having just one
line or the other works as expected. The function passed to
register_ticks_function() doesn't seem to make any difference. I'm
almost entirely sure PHP is throwing a seg fault because the Apache
error logs say "AH00052: child pid YYYYY exit signal Segmentation fault
(11)
Test script:
---------------
<?php
declare(ticks=1);
$ticks = 0;
register_tick_function(
function() use (&$ticks){
$ticks++;
}
);
var_dump($ticks);
Expected result:
----------------
The result above should dump 0 or an int counting the number of ticks it
takes ti run the code.
Actual result:
--------------
The actual result is that the web browser claims the page was reset and
nothing is ever loaded.
--
Edit bug report at https://bugs.php.net/bug.php?id=72832&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=72832&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=72832&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=72832&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=72832&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=72832&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=72832&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=72832&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=72832&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=72832&r=support
Expected behavior: https://bugs.php.net/fix.php?id=72832&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=72832&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=72832&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=72832&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=72832&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=72832&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=72832&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=72832&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=72832&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=72832&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=72832&r=mysqlcfg