#45473 [Opn->Bgs]: Argument 2 passed as integer, integer expected?

From: Date: Thu, 10 Jul 2008 07:28:44 +0000
Subject: #45473 [Opn->Bgs]: Argument 2 passed as integer, integer expected?
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-126429@lists.php.net to get a copy of this message
ID: 45473 Updated by: felixdv@php.net Reported By: strictly dot rubbadub at gmail dot com -Status: Open +Status: Bogus Bug Type: Class/Object related Operating System: Windows Vista :( PHP Version: 5.2.6 New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php You can only typehint object and array variable types in your function definition. Your code looks for a class named 'integer', which obviously isn't there, hence the error. Previous Comments: ------------------------------------------------------------------------ [2008-07-10 07:02:14] strictly dot rubbadub at gmail dot com Description: ------------ What I'm trying to do: Ensure that $arg2 input is only an integer. Either this is a bug, Windows Vista sucks (bug or not vista sucks period.), or I'm doing something wrong here. Arigato. Reproduce code: --------------- function blah(array $arg1, integer $arg2, integer $arg3){ return false; } var_dump(blah(array('a','b','c'),1,2)); Expected result: ---------------- bool(false) Actual result: -------------- Catchable fatal error: Argument 2 passed to blah() must be an instance of integer, integer given, called in C:\i\need\linux\blah.php on line 4 and defined in C:\i\need\linux\blah.php on line 2 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=45473&edit=1

« previous php.bugs (#126429) next »