[php-src] Issue #12126: sscanf(): Bad scan conversion character "."
| From: | staabm | Date: | Tue, 05 Sep 2023 07:40:29 +0000 |
| Subject: | [php-src] Issue #12126: sscanf(): Bad scan conversion character "." | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-245332@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/12126
Author: staabm
### Description
The following code:
```php
<?php
$format = 'only %d - %.1f';
printf($format, 1, 2);
$str = sprintf($format, 1, 2);
sscanf($str, $format, $low, $max);
```
Resulted in this output:
```
only 1 - 2.0
Fatal error: Uncaught ValueError: Bad scan conversion character "." in /in/I1AVe:6
Stack trace:
#0 /in/I1AVe(6): sscanf('only 1 - 2.0', 'only %d - %.1f', NULL, NULL)
#1 {main}
thrown in /in/I1AVe on line 6
```
But I expected this output instead:
- no error
### PHP Version
PHP 8.x
### Operating System
_No response_