Bug #72832 [Opn->Fbk]: declare(ticks=1) and register_tick_function() together cause PHP7 to seg fault

From: Date: Sun, 14 Aug 2016 21:06:15 +0000
Subject: Bug #72832 [Opn->Fbk]: declare(ticks=1) and register_tick_function() together cause PHP7 to seg fault
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-203281@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=72832&edit=1

 ID:                 72832
 Updated by:         kalle@php.net
 Reported by:        brandon at ambitious dot tech
 Summary:            declare(ticks=1) and register_tick_function()
                     together cause PHP7 to seg fault
-Status:             Open
+Status:             Feedback
 Type:               Bug
 Package:            Unknown/Other Function
 Operating System:   Gentoo
 PHP Version:        7.0.9
 Block user comment: N
 Private report:     N

 New Comment:

Is this only for Apache, and does this happen in non-TS builds? I remember back in 5.3 we did have
some improvements to make ticks work in TS environments, but it could be a regression from 5.x


Previous Comments:
------------------------------------------------------------------------
[2016-08-14 09:42:59] brandon at ambitious dot tech

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=/us!
 r' '--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 this bug report at https://bugs.php.net/bug.php?id=72832&edit=1


Thread (5 messages)

« previous php.bugs (#203281) next »