mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-15 11:56:50 +00:00
4d9dc7951606e631f1619cb3578dd5be82e19298
This PR was merged into the 1.x branch.
Discussion
----------
[v1] Fixed counting children of SimpleXMLElement object
It works correctly in v1.32 and since v1.33 it is not working correctly.
See: https://github.com/twigphp/Twig/compare/v1.32.0...v1.33.0#diff-d7378002f67a61c458c1de0468eef74fR1265
Test code:
```php
$xml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><doc><elem/><elem/></doc>');
var_dump($xml instanceof \Countable);
echo 'Count: ' . count($xml), PHP_EOL;
echo 'Strlen: ' . strlen($xml), PHP_EOL;
echo 'MB Strlen: ' . mb_strlen($xml), PHP_EOL;
```
Results:
```
bool(false)
Count: 2
Strlen: 0
MB Strlen: 0
```
https://3v4l.org/VvUXG
Commits
-------
4a23bdc3 Fixed counting children of SimpleXMLElement object
Twig, the flexible, fast, and secure template language for PHP ============================================================== Twig is a template language for PHP, released under the new BSD license (code and documentation). Twig uses a syntax similar to the Django and Jinja template languages which inspired the Twig runtime environment. More Information ---------------- Read the `documentation`_ for more information. .. _documentation: http://twig.sensiolabs.org/documentation
Description
Languages
PHP
99.9%