php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69949 microtime crashes
Submitted: 2015-06-27 03:25 UTC Modified: 2015-07-18 06:04 UTC
From: neuro at interx dot net Assigned:
Status: Closed Package: Reproducible crash
PHP Version: 7.0.0alpha2 OS: OSX 10.6
Private report: No CVE-ID: None
 [2015-06-27 03:25 UTC] neuro at interx dot net
Description:
------------
php-7.0.0alpha2

./configure --with-config-file-path=/usr/local/etc --with-apxs2=/usr/sbin/apxs --with-mysql=/usr/local --with-mssql=../freetds-0.82 --with-gd --with-freetype-dir=../freetype-2.1.10 --with-tiff-dir=/usr/local --with-zlib-dir=/usr --with-mcrypt=/usr/local --with-mhash --enable-ftp --with-zlib --with-pcre-regex --with-curl=/usr/local --enable-sockets --enable-sigchild --enable-pcntl --enable-iconv --enable-memory-limit --with-png-dir=/usr/local --disable-phar

I disabled all extensions (and zend extensions) due to previous experience with PHP alphas.

sh-3.2# gdb sapi/cli/php
GNU gdb 6.3.50-20050815 (Apple version gdb-1708) (Mon Aug 15 16:03:10 UTC 2011)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin"...Reading symbols for shared libraries ............... done

(gdb) run ~test.php
Starting program: /10.6/local/src/php-7.0.0alpha2/sapi/cli/php ~rtharp/Sites/sites/agi/webroot/index.php

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000010
zend_try_compile_cv (result=0x7fff5fbfe6c8, ast=0x101684000) at zend_compile.c:2190
2190			if (zend_string_equals_literal(name, "this")) {
(gdb) bt
#0  zend_try_compile_cv (result=0x7fff5fbfe6c8, ast=0x101684000) at zend_compile.c:2190
#1  0x00000001003083b5 in zend_compile_simple_var [inlined] () at /10.6/local/src/php-7.0.0alpha2/Zend/zend_compile.c:2238
#2  0x00000001003083b5 in zend_delayed_compile_var (result=0x7fff5fbfe6c8, ast=0x101684000, type=1) at zend_compile.c:7120
#3  0x00000001003086ed in zend_delayed_compile_prop (result=0x7fff5fbfe860, ast=0x101684000, type=1) at zend_compile.c:2341
#4  0x0000000100305944 in zend_compile_assign (result=0x7fff5fbfe860, ast=0x101684000) at zend_compile.c:2571
#5  0x000000010030491b in zend_compile_expr (result=0x7fff5fbfe860, ast=0x101684000) at zend_compile.c:6973
#6  0x0000000100301af1 in zend_compile_stmt (ast=0x101674188) at zend_compile.c:6939
#7  0x0000000100304f30 in zend_compile_top_stmt (ast=0x101674188) at zend_compile.c:6829
#8  0x0000000100304f1d in zend_compile_top_stmt (ast=0x101678338) at zend_compile.c:6824
#9  0x00000001002ebb77 in compile_file (file_handle=0x7fff5fbfe958, type=23528096) at zend_language_scanner.l:607
#10 0x000000010031adbe in zend_execute_scripts (type=8, retval=0x7fff5fbfec10, file_count=1606413328) at zend.c:1383
#11 0x00000001002b50f2 in php_execute_script (primary_file=0x7fff5fbff958) at main.c:2475
#12 0x00000001003afbf4 in do_cli [inlined] () at /10.6/local/src/php-7.0.0alpha2/sapi/cli/php_cli.c:967
#13 0x00000001003afbf4 in main (argc=1606416992, argv=0x7fff5fbffa60) at php_cli.c:1334
(gdb) 


Test script:
---------------
<?php phpinfo; ?> works

<?php
microtime(true);
?>
works

<?php
$loader=microtime(true);
?>
doesn't

<?php
$loader=microtime();
?>
doesn't

Expected result:
----------------
sh-3.2# /usr/local/src/php-7.0.0alpha2/sapi/cli/php test.php
sh-3.2#

Actual result:
--------------
sh-3.2# /usr/local/src/php-7.0.0alpha2/sapi/cli/php test.php
Segmentation fault
sh-3.2# 


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-06-27 17:02 UTC] ab@php.net
I don't repro this on Linux/Windows. Might be Mac or compiler specific. Probably need someone with OSX, but you could also play with the configure options to at least figure out a direction.

Thanks.
 [2015-07-02 03:32 UTC] neuro at interx dot net
Using GCC 4.6.0 from the HPC project:

Using built-in specs.
COLLECT_GCC=./gcc
COLLECT_LTO_WRAPPER=/10.6/local/src/usr/local/bin/../libexec/gcc/x86_64-apple-darwin10.7.0/4.6.0/lto-wrapper
Target: x86_64-apple-darwin10.7.0
Configured with: ../gcc-4.6.0/configure --enable-languages=fortran,c++
Thread model: posix
gcc version 4.6.0 (GCC)

and upgrading my auto tools including libtool has seem to fix the crashes.
 [2015-07-16 16:36 UTC] cmb@php.net
-Status: Open +Status: Feedback
 [2015-07-16 16:36 UTC] cmb@php.net
So, can this ticket be closed?
 [2015-07-18 06:04 UTC] neuro at interx dot net
-Status: Feedback +Status: Closed
 [2015-07-18 06:04 UTC] neuro at interx dot net
Yes, closing it
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Wed Feb 19 16:01:32 2020 UTC