PHP :: Bug #54624 :: class_alias and type hint

Bug #54624 class_alias and type hint
Submitted: 2011-04-28 17:11 UTC Modified: 2011-06-12 23:10 UTC
From: david at grudl dot com Assigned: felipe (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5.3.6 OS:
Private report: No CVE-ID: None

 [2011-04-28 17:11 UTC] david at grudl dot com

Description:
------------
class_alias() is not taken into account by type hints.

Note: there is eval(), so this is NOT PARSING-TIME error. Alias was created before eval is parsed.

Test script:
---------------
<?php

class A
{
	function foo(A $param) {
	}

}

class_alias('A', 'AliasA');

eval(' 
	class B extends A
	{
		function foo(AliasA $param) {
		}

	}
');

Expected result:
----------------
no error

Actual result:
--------------
Strict Standards: Declaration of B::foo() should be compatible with that of A::foo() 

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports

 [2011-06-12 23:10 UTC] felipe@php.net

-Summary: class_alias and type hint (II.) +Summary: class_alias and type hint -Status: Open +Status: Closed -Package: Compile Failure +Package: Scripting Engine problem -Assigned To: +Assigned To: felipe

 [2011-06-12 23:10 UTC] felipe@php.net

This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.