ID: 28094 Updated by: [EMAIL PROTECTED] Reported By: steve at przepiora dot org Status: Bogus Bug Type: Zend Engine 2 problem Operating System: windows xp PHP Version: 5.0.0RC1 New Comment:
The only possible thing we will add is "array" and "resource" as type hints, but never "String" "int" or "float", as PHP is a loosly typed language unlike Jabba. Previous Comments: ------------------------------------------------------------------------ [2004-08-03 11:07:11] suky0001 at hotmail dot com Er... Could this be implemented in a future release, please? (I'm a C++ programmer and variables with no types make me ill :P !!!) Note that the page http://fr.php.net/zend-engine-2.php shows an Exception class that has this "problem": class Exception { function __construct(string $message=NULL, int code=0) {...} The page should corrected (or the feature should be implemented to match the page!!!) Thanks! ------------------------------------------------------------------------ [2004-04-21 16:41:48] [EMAIL PROTECTED] Class type hints do not work with non-classes, like strings, integers, and arrays. The error message is telling you it's expecting a class named "string." :) ------------------------------------------------------------------------ [2004-04-21 16:40:25] steve at przepiora dot org Description: ------------ When using class type hints with a string a runtime error occurs. Reproduce code: --------------- <?php function foo(string $bar){ echo $bar; } foo("baz"); ?> Expected result: ---------------- The printout of "baz" Actual result: -------------- Fatal error: Argument 1 must be an object of class string in c:\program files\apache group\Apache\htdocs\index.php on line 2 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=28094&edit=1