#28094 [Com]: class type hints ambiguity

From: Date: Tue, 03 Aug 2004 09:07:14 +0000
Subject: #28094 [Com]: class type hints ambiguity
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-64002@lists.php.net to get a copy of this message
ID: 28094 Comment by: suky0001 at hotmail dot com 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: 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! Previous Comments: ------------------------------------------------------------------------ [2004-04-21 16:41:48] amt@php.net 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

« previous php.bugs (#64002) next »