[php-src] Issue #12307: Uncaught TypeError: str_replace(): Argument #2 ($replace) must be of type string when argument #1 ($search) is a string
| From: | patake | Date: | Wed, 27 Sep 2023 13:15:14 +0000 |
| Subject: | [php-src] Issue #12307: Uncaught TypeError: str_replace(): Argument #2 ($replace) must be of type string when argument #1 ($search) is a string | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-245442@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/12307
Author: patake
### Description
In very PHP example to use the function:
The following code:
```php
<?php
// Fornece: Hll Wrld f PHP
$vowels = array("a", "e", "i", "o", "u",
"A", "E", "I", "O", "U");
$onlyconsonants = str_replace($vowels, "", "Hello World of PHP");
```
Resulted in this output:
```
The array with replaced characters
```
But I expected this output instead:
```
Uncaught TypeError: str_replace(): Argument #2 ($replace) must be of type string when argument #1
($search) is a string
```
### PHP Version
PHP 8.2.8
### Operating System
_No response_