Doc #79126 [NEW]: empty() documentation does not mention SimpleXML objects from empty tags
From: dse at webonastick dot com
Operating system: macOS
PHP version: 7.4.1
Package: SimpleXML related
Bug Type: Documentation Problem
Bug description:empty() documentation does not mention SimpleXML objects from empty tags
Description:
------------
---
From manual page: https://php.net/function.empty
---
<https://php.net/function.empty> mentions that
for the following values,
empty() will return TRUE:
- an unset variable
- ""
- 0
- 0.0
- "0"
- NULL
- FALSE
- array()
The documentation does not mention that a SimpleXML object from an empty
tag is also considered empty, thus empty() also returns TRUE for one.
I figured this out after checking
<https://www.php.net/manual/en/language.types.boolean.php>
while writing
something for a PHP cheatsheet.
Test script:
---------------
$ php -r '$foo = new SimpleXMLElement("<html>5</html>"); print $foo ?
"truthy\n" : "falsy\n";'
truthy
$ php -r '$foo = new SimpleXMLElement("<html></html>"); print $foo ?
"truthy\n" : "falsy\n";'
falsy
--
Edit bug report at https://bugs.php.net/bug.php?id=79126&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=79126&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=79126&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=79126&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=79126&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=79126&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=79126&r=support
Expected behavior: https://bugs.php.net/fix.php?id=79126&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=79126&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=79126&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=79126&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=79126&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=79126&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=79126&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=79126&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=79126&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=79126&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=79126&r=mysqlcfg
Thread (3 messages)
- dse at webonastick dot com