php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #47673 calling phpinfo() after tokenizer token_get_all() results in Segfault
Submitted: 2009-03-16 12:18 UTC Modified: 2009-03-18 10:14 UTC
From: serhii dot piddubchak at gmail dot com Assigned:
Status: Not a bug Package: Reproducible crash
PHP Version: 5.2.9 OS: FreeBSD 7.1
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: serhii dot piddubchak at gmail dot com
New email:
PHP Version: OS:

 

 [2009-03-16 12:18 UTC] serhii dot piddubchak at gmail dot com
Description:
------------
I'm getting a segmentation fault when trying to call phpinfo() after token_get_all();
phpinfo() works fine if called before token_get_all();

Here is a short information about my system:
PHP Version 5.2.8
FreeBSD medved.hvosting.ua 7.1-RELEASE FreeBSD 7.1-RELEASE #0: Thu Jan 22 09:27:15 UTC 2009 root@free.ds:/usr/obj/usr/src/sys/ISPSYSTEM amd64

Build Date 	Feb 11 2009 15:20:04

Configure Command 	'./configure' '--with-layout=GNU' '--with-config-file-scan-dir=/usr/local/etc/php' '--disable-all' '--enable-libxml' '--with-libxml-dir=/usr/local' '--with-pcre-regex=yes' '--enable-reflection' '--program-prefix=' '--enable-fastcgi' '--with-regex=php' '--with-zend-vm=CALL' '--enable-zend-multibyte' '--disable-ipv6' '--prefix=/usr/local' '--mandir=/usr/local/man' '--infodir=/usr/local/info/' '--build=amd64-portbld-freebsd7.1'

Server API 	CGI/FastCGI

Also there is no extensions like eAccelerator or ZendOptimizer.
Also I tried it on another FreeBSD 6.1 system, PHP5.2.8 configured as apache module, the bug wasn't reproducible. So, it looks like CGI/FastCGI or 64bit arch issue. Thanks in advance for any help.

I can't install PHP5.2.9 because I don't own the server, it is a hosting account but I think it is reproducible in 5.2.9 since I didn't notice something relevant fixed in Changelog for 5.2.9

Reproduce code:
---------------
<?php

$tokens = token_get_all('/* comment */');
phpinfo();

?>

Expected result:
----------------
Expected result is to see full output from phpinfo()

Actual result:
--------------
The first summary table of phpinfo is printed, then process crashes with core dump.

Here is a backtrace:
This GDB was configured as "amd64-marcel-freebsd"...(no debugging symbols found)...
Core was generated by `php-cgi'.
Program terminated with signal 11, Segmentation fault.

...

Reading symbols from /lib/libc.so.7...(no debugging symbols found)...done.
Loaded symbols for /lib/libc.so.7
Reading symbols from /usr/local/lib/php/20060613/tokenizer.so...(no debugging symbols found)...done.
Loaded symbols for /usr/local/lib/php/20060613/tokenizer.so

...

#0  0x000000080121ee80 in ?? ()
[New Thread 0x8012b5180 (LWP 100392)]
(gdb) bt
#0  0x000000080121ee80 in ?? ()
#1  0x00000000005065e1 in zend_html_puts ()
#2  0x0000000000494738 in php_print_info ()
#3  0x00000000004948ae in zif_phpinfo ()
#4  0x00000000005397d2 in zend_do_fcall_common_helper_SPEC ()
#5  0x000000000052ba87 in execute ()
#6  0x000000000050f177 in zend_execute_scripts ()
#7  0x00000000004d2767 in php_execute_script ()
#8  0x0000000000586773 in main ()

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-03-16 12:23 UTC] serhii dot piddubchak at gmail dot com
I've found this bug:
http://bugs.php.net/bug.php?id=38449
It is exactly the same problem, but the latest comment was "Please report FreeBSD bugs to FreeBSD peoples.". It doesn't look like a solution since FreeBSD people won't fix this issue, It would be very surprising if FreeBSD people must fix bugs in every piece of software that is available for FreeBSD.
Moreover, previous bug was reported more then 2.5 years ago, PHP got a 5.2.8 version and FreeBSD got a 7.1 version. Looks for me that PHP doesn't handle FreeBSD that well as Linux or Windows. If PHP compiles on FreeBSD I expect it to work.
 [2009-03-16 13:14 UTC] jani@php.net
What if you compile the tokenizer as normal (static) extension when you compile PHP _yourself_ from sources, does it work then?
 [2009-03-16 13:18 UTC] jani@php.net
For the record: It does not crash for me..
 [2009-03-16 21:10 UTC] crrodriguez at opensuse dot org
Works for me, uing shared tokenizer and 5_2.
 [2009-03-18 09:18 UTC] serhii dot piddubchak at gmail dot com
Sorry, it works now after hosting support have rebuilded tokenizer extension.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 05 14:01:31 2024 UTC