|  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: rael at grad dot icmc dot usp dot br
New email:
PHP Version: OS:


 [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 18:03:37 2021 UTC