[php-src] Issue #13362: http_build_query must throw when data are not stringable
| From: | mvorisek | Date: | Fri, 09 Feb 2024 13:03:52 +0000 |
| Subject: | [php-src] Issue #13362: http_build_query must throw when data are not stringable | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-246438@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/13362
Author: mvorisek
### Description
The following code:
https://3v4l.org/ECMPq
```php
<?php
var_dump(http_build_query(['a' => 'b']));
var_dump(http_build_query(['a' => new \DateTime()]));
```
Resulted in this output:
```
string(3) "a=b"
string(0) ""
```
But I expected this output instead:
```
string(3) "a=b"
exception as \DateTime is an object and does not implement \Stringable interface
```
### PHP Version
any
### Operating System
any