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
$xmlStr = <<<XML<variables> <empty/> <zero>0</zero> <false>false</false> <!--<missing/>--></variables>XML;
// $variables = new \SimpleXMLElement($xmlStr);$variables = simplexml_load_string($xmlStr, \Bmatovu\LaravelXml\Support\XmlElement::class);
// Access via SimpleXMLElement::classecho$variables->zero->__toString(); // Expected: "0", Actual: "0"// Access via the package's XmlElement::classecho (string) $variables->get('zero'); // Expected: "0", Actual: ""
Correction
XmlElement.php
public function get($attr, $default = null)
{
- if (empty($this->{$attr})) {+ if (is_null($this->{$attr})) {
return $default;
}
return $this->{$attr};
}
The text was updated successfully, but these errors were encountered:
Correction
The text was updated successfully, but these errors were encountered: