|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72832 declare(ticks=1) and register_tick_function() together cause PHP7 to seg fault
Submitted: 2016-08-14 09:42 UTC Modified: 2016-08-28 04:25 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: brandon at ambitious dot tech Assigned:
Status: Open Package: Unknown/Other Function
PHP Version: 7.0.9 OS: Gentoo
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
50 - 40 = ?
Subscribe to this entry?

 [2016-08-14 09:42 UTC] brandon at ambitious dot tech
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:

$ticks = 0;
	function() use (&$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.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-08-14 21:06 UTC]
-Status: Open +Status: Feedback
 [2016-08-14 21:06 UTC]
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
 [2016-08-15 05:40 UTC] brandon at ambitious dot tech
I disabled multi-threading, and the code worked just fine. I tried PHP cli, and it worked just fine there as well. After re-enabling threading, I found that the code doesn't work in Apache, however, it does work when run from the PHP cli.

Also, I'm not able to disable threading in just Apache or PHP with Gentoo, so I'm not sure if the bug is being caused by Apache's threading or PHP's threading. If there's anything else you need, let me know.
 [2016-08-28 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 [2016-08-28 04:25 UTC]
-Status: No Feedback +Status: Open
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Thu Nov 14 16:01:42 2019 UTC