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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Sat Feb 24 12:01:27 2024 UTC