php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #35434 func_get_args don't work as expected in assert
Submitted: 2005-11-28 00:05 UTC Modified: 2015-01-08 23:55 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: pornel at despammed dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 4CVS-2005-11-27 (snap) OS: *
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: pornel at despammed dot com
New email:
PHP Version: OS:

 

 [2005-11-28 00:05 UTC] 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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-01-08 23:55 UTC] ajf@php.net
-Status: Open +Status: Not a bug -Package: Feature/Change Request +Package: *General Issues
 [2015-01-08 23:55 UTC] ajf@php.net
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.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jul 14 07:01:32 2025 UTC