You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When creating an new instance of XMLElement and passing another XMLElement (instead of a string ) as $value I get this error (public generate):
strlen() expects parameter 1 to be string, object given
/Users/malcolm/Sites/symdev/symphony/lib/toolkit/class.xmlelement.php line 592
587 }
588 }
589
590 $numberOfchildren = $this->getNumberOfChildren();
591
592 if($numberOfchildren > 0 || strlen($this->_value) != 0 || !$this->_selfclosing){
593
594 $result .= '>';
595
596
I did a quick test in evaluating that $this->_value is a string before getting its strlen. This would remove the error but the child element never gets appended to its parent Element.
Can you confirm this?
The text was updated successfully, but these errors were encountered:
Yes I can confirm this bug, the documentation incorrectly (or correctly because I'd expect XMLElement to work this way) states that it can accept the $value as either a string or an XMLElement object. It's not the case, as you've documented.
Thanks for reporting.
For a immediate solution you can use new XMLElement('your-node-name', $value->generate()); which will create a string.
When creating an new instance of XMLElement and passing another XMLElement (instead of a string ) as $value I get this error (public generate):
I did a quick test in evaluating that
$this->_value
is a string before getting itsstrlen
. This would remove the error but the child element never gets appended to its parent Element.Can you confirm this?
The text was updated successfully, but these errors were encountered: