Date: 03/15/00
- Next message: simon <email protected>: "[PHP-DEV] PHP 4.0 Bug #3839: domxml fails to compile again :)"
- Previous message: Andi Gutmans: "[PHP-DEV] Current working directory and multi-threaded environments"
- In reply to: Flavien LEBARBE: "Re: [PHP-DEV] Bug #3835: segfault in func_get_args with implode"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
You can't use func_get_args() as a function argument.
Of course this shouldn't crash but in any case, it won't work. Call it
before you do the actual call to blah() and save its value in a variable.
Andi
On Wed, 15 Mar 2000, Flavien LEBARBE wrote:
> Hi,
>
> I did some testing using current CVS (2 hours ago) :
>
> minimal example to crash (not involving implode) :
> -----------
> <?php
> function blah () {}
> function foo () {
> blah ( 0 , func_get_args() ); // CRASH.
> }
> foo();
> ?>
> -----------
>
> func_get_args() examines EG(argument_stack) to get the arguments
> of the function foo :
>
> ---Zend/zend_builtin_functions.c"
> 158: ZEND_FUNCTION(func_get_args)
> 159:
> 160: void **p;
> 161: int arg_count;
> 162: int i;
> 163:
> 164: p = EG(argument_stack).top_element-1;
> 165: arg_count = (ulong) *p;
> 166: /* this is the amount of arguments passed to func_num_args(); */
> ---
>
> The first object on top of the stack is supposed to be the number of
> arguments of the function.
>
> The problem is that in this particular case, the first argument of the
> function blah (-ie- '0') has already been pushed on top of the stack.
>
> Instead of getting the number of arguments (on line 165), arg_count is
> initialized with a reference to the object '0' ! :-(
>
>
> Andi? Zeev? any idea how to solve this ? May be having some kind of
> delimiter on the stack for this case ???
>
> Flavien Lebarbé.
> ---
> Open Care.
>
>
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: simon <email protected>: "[PHP-DEV] PHP 4.0 Bug #3839: domxml fails to compile again :)"
- Previous message: Andi Gutmans: "[PHP-DEV] Current working directory and multi-threaded environments"
- In reply to: Flavien LEBARBE: "Re: [PHP-DEV] Bug #3835: segfault in func_get_args with implode"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

