php.net |  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
Votes:3
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
Have you experienced this issue?
Rate the importance of this bug to you:

 [2006-02-02 20:03 UTC] rael at grad dot icmc dot usp dot br
Description:
------------
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:
---------------
<?php

	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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-12-30 23:33 UTC] cmb@php.net
-Package: Feature/Change Request +Package: Scripting Engine problem
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC