Re: [PHP4BETA] it's always segmentation's fault

From: Date: Mon, 14 Feb 2000 19:10:00 +0000
Subject: Re: [PHP4BETA] it's always segmentation's fault
References: 1  Groups: php.version4 
Request: Send a blank email to php-version4+get-10262@lists.php.net to get a copy of this message
Hi, I just commited a patch to the CVS. Thanks for the good bug report. In any case, just so you know (I think you do but it's good for the others to know too), if func_num_args() returns 2 that means that only args 0 and 1 are available. At least it doesn't crash anymore :) Thanks, Andi On Mon, 14 Feb 2000, Teodor Cimpoesu wrote: > [segme.php] > <? > function PT() > { > $numargs = func_num_args(); > $filename = func_get_arg(0); > $variables = func_get_arg(1); > $values = $numargs > 1 ? func_get_arg(2) : $GLOBALS; > > if (sizeof($values) < sizeof ($variable)) > return -1; > > $patterns = array (); > $replaces = array (); > > foreach ( $variables as $key ) { > $patterns[] = "|{" . $key ."}|"; > $replaces[] = $values["$key"]; > } > } > PT("test.tpl", array ("bgcolor","text","info") ); > > > [root@teo play]# php segme.php > Segmentation fault (core dumped) > [root@teo play]# gdb which php core > GNU gdb 4.18 > Copyright 1998 Free Software Foundation, Inc. > [readings...] > #0 zend_if_func_get_arg (ht=1, return_value=0x810ff3c, this_ptr=0x0, > return_value_used=1) > at zend_builtin_functions.c:144 > 144 *return_value = *arg; > (gdb) where > #0 zend_if_func_get_arg (ht=1, return_value=0x810ff3c, this_ptr=0x0, > return_value_used=1) > at zend_builtin_functions.c:144 > #1 0x80b18a9 in execute (op_array=0x81150f0) at ./zend_execute.c:1568 > #2 0x80b1a72 in execute (op_array=0x810ead4) at ./zend_execute.c:1607 > #3 0x8071e8e in php_execute_script (primary_file=0xbffff984) at > main.c:1131 > #4 0x8058021 in main (argc=2, argv=0xbffff9e4) at cgi_main.c:587 > > php binary rebuilded a minute ago from snaps.php.net > (so I won't be prompted w/ update your snap :-) also reproduced on an > older cvs snapshot. > > >

« previous php.version4 (#10262) next »