Req #35434 [Opn->Nab]: func_get_args don't work as expected in assert

From: Date: Thu, 08 Jan 2015 23:55:55 +0000
Subject: Req #35434 [Opn->Nab]: func_get_args don't work as expected in assert
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-189792@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=35434&edit=1 ID: 35434 Updated by: ajf@php.net Reported by: pornel at despammed dot com Summary: func_get_args don't work as expected in assert -Status: Open +Status: Not a bug Type: Feature/Change Request -Package: Feature/Change Request +Package: *General Issues Operating System: * PHP Version: 4CVS-2005-11-27 (snap) Block user comment: N Private report: N New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php assert() is just a wrapper around eval(), this isn't really a bug. Previous Comments: ------------------------------------------------------------------------ [2005-11-28 00:05:24] pornel at despammed dot com Description: ------------ func_get_args, func_num_args, func_get_arg functions executed inside assert('') work on assert's arguments, and not on arguments of function assert is in. Because assert transparently handles variables scope, one could expect that it works transparently on arguments as well. With all PHP functions accepting variable number of arguments and only basic type hints, such assertions are quite important. Reproduce code: --------------- function test() { assert('func_num_args()==2'); } test('one','two'); Expected result: ---------------- nothing Actual result: -------------- assertion fails ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=35434&edit=1

« previous php.bugs (#189792) next »