Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 2.0.4

Bug #3408 XML container : empty data sets badly handled
Submitted: 2005-02-08 17:12 UTC
From: ylf at xung dot org Assigned: quipo
Status: Closed Package: Translation2
PHP Version: 4.3.4 OS: Linux Debian
Roadmaps: (Not assigned)    

 [2005-02-08 17:12 UTC] ylf at xung dot org
Description: ------------ Hi, Here's the symptom, for both the current cvs and 2.0.0beta6 : Warning: array_pop(): The argument should be an array in /var/www/dev/pear_cvs/Translation2/Container/xml.php on line 280 Warning: Invalid argument supplied for foreach() in /var/www/dev/pear_cvs/Translation2/Container/xml.php on line 196 This happens with an empty page, ie : <page name="myPage"> </page> The problem comes from XML_Unserializer which sets $this->_data['pages']['myPage'] to an empty string when it should be an empty array. Similar issues are likely to happen for any of the tags that have an undefined (possibly null) number of sub-tags, as defined in the DTD : <!ELEMENT languages (lang*)> <!ELEMENT pages (page*)> <!ELEMENT page (string*)> <!ELEMENT string (tr*)> I believe the DTD is just fine, and that it is a good thing to allow empty pages, empty strings, etc... So that the developer can produce a draft of all needed strings and pages before the translator fills them in. Here's a fix for the XML container and scripts/t2xmlchk.php, which applies fine against the current cvs version : Cheers


 [2005-02-10 08:09 UTC] quipo
This bug has been fixed in CVS. In case this was a documentation problem, the fix will show up at the end of next Sunday (CET) on In case this was a website problem, the change will show up on the website in short time. Thank you for the report, and for helping us make PEAR better. -- many thanks for the patch!