|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits              [2008-01-07 20:13 UTC] hubert dot roksor at gmail dot com
  [2008-01-12 15:38 UTC] tony2001@php.net
  [2008-01-23 11:04 UTC] rrichards@php.net
 | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 18:00:01 2025 UTC | 
Description: ------------ It seems empty() on simplexml 'array' elements doesn't work same way in 5.2.5 as in 5.2.3. In 5.2.5, empty() returns true even through the elements are actually present. Same code run under 5.2.3 works correctly, i.e. returning true only if the element is not present. Workaround is replace (!empty(...)) condition with isset() and test for count(), but this is inconvenient and breaks backwards compatibility. Reproduce code: --------------- <?php $str = '<?xml version="1.0" encoding="WINDOWS-1250" ?> <config> <items> <item command="overview"/> <item command="deals"/> <item command="regions"/> <item command="estimations"/> <item command="reports"/> <item command="import"/> </items> </config> '; $xml = simplexml_load_string($str); echo (empty($xml->items->item) ? "EMPTY" : "full")."\n"; echo count($xml->items->item) ."\n"; Expected result: ---------------- full 6 Actual result: -------------- EMPTY 6