php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #64412 empty array evaluates to true instead of false
Submitted: 2013-03-12 13:23 UTC Modified: 2013-10-15 11:54 UTC
From: confidential99 at gmail dot com Assigned:
Status: No Feedback Package: Arrays related
PHP Version: Irrelevant OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
13 - 9 = ?
Subscribe to this entry?

 
 [2013-03-12 13:23 UTC] confidential99 at gmail dot com
Description:
------------
The manual (http://www.php.net/manual/en/language.types.boolean.php) states that 
an empty array should evaluate to false. 

When I run the following code, it evaluates to true. I'm filing this under 
documentation bug because I'm not sure if this is intended or not.


Test script:
---------------
var_dump((bool) array());


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-03-12 15:24 UTC] rasmus@php.net
It should definitely be false. I get false under both PHP 5.3 and 5.4. Which 
version are you on?
 [2013-03-12 15:24 UTC] rasmus@php.net
-Status: Open +Status: Feedback
 [2013-04-06 21:24 UTC] wim at sitebase dot be
I've tested it with PHP 5.3.10 and it evaluates correctly to false.
 [2013-10-15 11:54 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 17:01:30 2024 UTC