|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #36265 Object as default function argument
Submitted: 2006-02-02 20:03 UTC Modified: 2016-12-30 23:33 UTC
Avg. Score:3.7 ± 0.9
Reproduced:3 of 3 (100.0%)
Same Version:3 (100.0%)
Same OS:3 (100.0%)
From: rael at grad dot icmc dot usp dot br Assigned:
Status: Open Package: Scripting Engine problem
PHP Version: 5.1.2 OS: Any
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
42 - 15 = ?
Subscribe to this entry?

 [2006-02-02 20:03 UTC] rael at grad dot icmc dot usp dot br
In some cases, it's a very usefull feature use an object as default function argument, what is not possible, generating an error in current versions of PHP.

Reproduce code:

	class Foo {}
	function bar(Foo $foo = new Foo()){}


Expected result:
A blank webpage.

Actual result:
Parse error: parse error, unexpected T_NEW in c:\Inetpub\wwwroot\phobos\testes\index.php on line 5


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-12-30 23:33 UTC]
-Package: Feature/Change Request +Package: Scripting Engine problem
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Sep 21 17:03:36 2021 UTC