php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45473 Argument 2 passed as integer, integer expected?
Submitted: 2008-07-10 07:02 UTC Modified: 2008-07-10 07:28 UTC
From: strictly dot rubbadub at gmail dot com Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: 5.2.6 OS: Windows Vista :(
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: strictly dot rubbadub at gmail dot com
New email:
PHP Version: OS:

 

 [2008-07-10 07:02 UTC] 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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-07-10 07:28 UTC] felixdv@php.net
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.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 08:01:34 2025 UTC