Bug 104215

Summary: Segfault with PHP function call when the tokenizer extension is built as an external module
Product: Ports & Packages Reporter: Scott MacVicar <scottmacvicar>
Component: Individual Port(s)Assignee: Alex Dupre <ale>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   

Description Scott MacVicar 2006-10-09 16:00:39 UTC
I've already reported this to the PHP bug list and they've decided its got nothing to do with them, I tend to disagree though.

When using the token_get_all function there is a segfault, the back trace is as follows.

Program received signal SIGSEGV, Segmentation fault.
0x80d216d in _efree ()
(gdb) bt
#0  0x80d216d in _efree ()
#1  0x80de408 in _zval_dtor ()
#2  0x4861f8e6 in tokenize () from
/usr/local/lib/php/20020429/tokenizer.so
#3  0x48620041 in zif_token_get_all () from
/usr/local/lib/php/20020429/tokenizer.so
#4  0x80f14bb in execute ()
#5  0x80df699 in zend_execute_scripts ()
#6  0x80ba79f in php_execute_script ()
#7  0x80f8241 in main ()
#8  0x805cf86 in _start ()

Sorry its not very informative.

To fix this I forced the tokenizer to be compiled into PHP by adding it to the configure line.

PHP Bug report is: http://bugs.php.net/bug.php?id=38449

How-To-Repeat: Place this in a file.

<?php
$tokens = token_get_all('<?php $var = 2; ?>');
var_dump($tokens);
?>

run via command line
php foo.php
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2006-10-09 22:56:09 UTC
Responsible Changed
From-To: freebsd-ports-bugs->ale

Over to maintainer
Comment 2 Alex Dupre freebsd_committer freebsd_triage 2006-10-10 07:16:35 UTC
State Changed
From-To: open->feedback

I've just tried with php-4.4.4+suhosin on a 6-STABLE and 
it works like a charm. Can you reproduce the bug on a 
6.x machine?
Comment 3 Alex Dupre freebsd_committer freebsd_triage 2006-11-08 08:25:32 UTC
State Changed
From-To: feedback->closed

No feedback.