php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41645 php crashes with an empty function (works with --enable-debug !!)
Submitted: 2007-06-09 22:44 UTC Modified: 2007-06-17 16:38 UTC
From: slogster at gmail dot com Assigned:
Status: Not a bug Package: Reproducible crash
PHP Version: 5.2.3 OS: FreeBSD 6-STABLE
Private report: No CVE-ID: None
 [2007-06-09 22:44 UTC] slogster at gmail dot com
Description:
------------
php crashes with segmentation fault after executing a dummy function with some default vars

Reproduce code:
---------------
<?php
function get_links($category = -1,
			$before = '',
			$after = '<br />',
			$between = ' ',
			$show_images = true,
			$orderby = 'name',
			$show_description = true,
			$show_rating = false,
			$limit = -1,
			$show_updated = -1,
			$echo = true) {
};
get_links(-1, '<li>','</li>', '', false, 'name', false, false, -1);
?>

Expected result:
----------------
a function with this prototype exists in wordpress. this one here should exit normally, but it crashes php. if you execute it without the last argument (corresponding to the $limit var): get_links(-1, '<li>','</li>', '', false, 'name', false, false) php doesn`t crash

Actual result:
--------------
there is a core dump here http://xaxo.eu/php.core

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-06-09 23:12 UTC] scottmac@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php for *NIX and
http://bugs.php.net/bugs-generating-backtrace-win32.php for Win32

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.

I however can't reproduce this with the provided test case.
 [2007-06-09 23:54 UTC] slogster at gmail dot com
(gdb) bt
#0  0x0814ed7c in _zval_ptr_dtor ()
#1  0x08182072 in zend_do_fcall_common_helper_SPEC ()
#2  0x08181b6c in execute ()
#3  0x081615cf in zend_execute_scripts ()
#4  0x081175a6 in php_execute_script ()
#5  0x00000000 in ?? ()
#6  0x00000003 in ?? ()
#7  0x00000000 in ?? ()
#8  0xbfbfec00 in ?? ()
#9  0x00000000 in ?? ()
#10 0x00000002 in ?? ()
#11 0x65646f63 in ?? ()
#12 0x00000000 in ?? ()
#13 0xbfbfe85c in ?? ()
#14 0x00000002 in ?? ()
#15 0x08164e67 in zend_register_functions ()
Previous frame inner to this frame (corrupt stack?)
(gdb) frame 2
#2  0x08181b6c in execute ()
 [2007-06-10 01:42 UTC] scottmac@php.net
Can you recompile PHP with --enable-debug please so we can get some more useful information.

Also do you have any sort of third party zend extensions like APC, eAccelerator or Zend Optimizer? If so they should be disabled as well and test again.
 [2007-06-10 11:45 UTC] slogster at gmail dot com
Hm, this is strange. When I compile it with debug it works! Doesn`t do Segmentation Fault. I don`t have any third party extentions. Can you please test it without debug enabled?
 [2007-06-11 20:11 UTC] stas@php.net
Such simple code is unlikely to crash as a result of any bug in PHP engine. The problem is probably elsewhere - such as incompatible extensions linked together, wrong library versions, broken compilation, compiler bug, using module/extension of incompatible version, etc.
 [2007-06-12 15:57 UTC] scottmac@php.net
Definately unable to reproduce without a debug build, if you can then 
recompile PHP without debug mode but leave debug symbols in to give a 
more detailed back trace.

export CFLAGS="-g"

make clean, configure and compile.

If you can disable all extensions and only enable the minimum you 
require.
 [2007-06-17 10:39 UTC] slogster at gmail dot com
I compiled php-5.2.3 directly from source (not from freebsd ports) and it doesn`t crash without debug. Then I made "make all" in ports/lang/php5 and tried the sapi/cgi/php against that code and it crashes. I suppose some of the freebsd patches cause php to crash. I will try those one by one to catch which one is responsible for the crash and report back here and to the freebsd port maintainer.

Since it seems to be related to the freebsd ports and not stock php-5.2.3 should I change the status of this report to closed?
 [2007-06-17 16:38 UTC] sniper@php.net
This is bogus then. :)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue May 07 09:01:31 2024 UTC