From:             frederic dot hardy at mageekbox dot net
Operating system: macos X mountain lion
PHP version:      5.4.9
Package:          Scripting Engine problem
Bug Type:         Bug
Bug description:class alias are not used/resolved by type hinting

Description:
------------
Imagine that you have a A class.
Imagine that you have an alias B on this A class.
Imagine that you have a function/method which require a B as argument.
So, currently, it's not possible to pass a A instance as argument to this 
function/method.

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

class A {}
class_alias('A', 'B');
function foo(B $b) {}
foo(new A());

Expected result:
----------------
Nothing.

Actual result:
--------------
PHP Catchable fatal error:  Argument 1 passed to foo() must be an instance
of B, 
instance of A given, called in /path/to/test/file.php on line 6 and defined
in 
/path/to/test/file.php on line 5


-- 
Edit bug report at https://bugs.php.net/bug.php?id=63592&edit=1
-- 
Try a snapshot (PHP 5.4):   
https://bugs.php.net/fix.php?id=63592&r=trysnapshot54
Try a snapshot (PHP 5.3):   
https://bugs.php.net/fix.php?id=63592&r=trysnapshot53
Try a snapshot (trunk):     
https://bugs.php.net/fix.php?id=63592&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=63592&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=63592&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=63592&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=63592&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=63592&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=63592&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=63592&r=notwrong
Not enough info:            
https://bugs.php.net/fix.php?id=63592&r=notenoughinfo
Submitted twice:            
https://bugs.php.net/fix.php?id=63592&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=63592&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63592&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=63592&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=63592&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=63592&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=63592&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=63592&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=63592&r=mysqlcfg

Reply via email to