php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61776 $var = ''; var_dump(in_array($var, array(0,1)))// boolean true
Submitted: 2012-04-19 17:59 UTC Modified: 2012-04-19 22:27 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: aestur at me dot com Assigned:
Status: Not a bug Package: PHP options/info functions
PHP Version: 5.3.10 OS: windows
Private report: No CVE-ID: None
 [2012-04-19 17:59 UTC] aestur at me dot com
Description:
------------
$var = '';
var_dump(in_array($var, array(0,1)))// boolean true

Some weird cast is performed.

Test script:
---------------
$var = '';
var_dump(in_array($var, array(0,1)));

Expected result:
----------------
false

Actual result:
--------------
true

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-04-19 18:00 UTC] aestur at me dot com
the php version is 5.3.8 on windows seven
 [2012-04-19 22:27 UTC] felipe@php.net
-Status: Open +Status: Not a bug
 [2012-04-19 22:27 UTC] felipe@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

See the third argument of in_array() function.

http://docs.php.net/in-array
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 17:01:30 2024 UTC