[php-src] Issue #10815: yaml_parse_file does not set `&$ndoc` to document count

From: Date: Thu, 09 Mar 2023 11:59:04 +0000
Subject: [php-src] Issue #10815: yaml_parse_file does not set `&$ndoc` to document count
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-243880@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/10815 Author: tomterl ### Description Given the following yaml file test.yml ```yaml --- This is a front-matter --- doc: - prop1: val1 prop2: val2 ... ``` The following code: ```php <?php $nd = 0; yaml_parse_file("./test.yml", -1, $nd); echo $nd; ``` Resulted in this output: ``` 0 ``` But I expected this output instead: ``` 2 ``` The documents are parsed correctly, but without the confirmation of $ndoc > 0, there's no way to tell (could be one document). yaml_parse behaves as expected: ```php <?php $nd = 0; $yaml = file_get_contents("./test.yml"); yaml_parse($yaml, -1, $nd); echo $nd; ``` gives ``` 2 ``` as expected ### PHP Version PHP 8.1.14 ### Operating System Ubuntu 22.04

« previous php.bugs (#243880) next »