Doc #79126 [Ver->Csd]: empty() documentation does not mention SimpleXML objects from empty tags
Edit report at https://bugs.php.net/bug.php?id=79126&edit=1
ID: 79126
Updated by: phpdocbot@php.net
Reported by: dse at webonastick dot com
Summary: empty() documentation does not mention SimpleXML
objects from empty tags
-Status: Verified
+Status: Closed
Type: Documentation Problem
Package: SimpleXML related
Operating System: macOS
PHP Version: 7.4.1
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of cmb
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=3ae0b14dd06ea9d47728f366dfe2c29476a2468e
Log: Fix #79126: empty() documentation does not mention SimpleXML objects from empty tags
Previous Comments:
------------------------------------------------------------------------
[2020-12-07 14:40:22] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&revision=351947
Log: Fix #79126: empty() documentation does not mention SimpleXML objects from empty tags
To avoid duplication, we refer to falsey values instead.
------------------------------------------------------------------------
[2020-01-15 19:28:11] dse at webonastick dot com
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 this bug report at https://bugs.php.net/bug.php?id=79126&edit=1
Thread (3 messages)