[php-src] Issue #21612: htmlentities() returns an empty string

[email protected] (exakat)
Newsgroups php.bugs
Message-ID <[email protected]>
Issue: https://github.com/php/php-src/issues/21612
Author: exakat

### Description

htmlentities() returns empty string when applied on certain characters, with encoding such as big5. 

The following code:

```php
<?php

$string = "éù";
var_dump( htmlentities($string, ENT_QUOTES, "big5"));

$string = "Café & 'quotes' and € euro";
var_dump( htmlentities($string, ENT_QUOTES, "big5"));

```
(also here) : https://3v4l.org/BYPMD#v8.5.3

Resulted in this output:
```
Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in /in/97KgC on line 4
string(4) "éù"
29
Notice: htmlentities(): Only basic entities substitution is supported for multi-byte encodings other than UTF-8; functionality is equivalent to htmlspecialchars in /in/97KgC on line 8
string(0) ""
```

But I expected this output instead:
```
string(4) "éù"
string(29) "Café & 'quotes' and € euro"
```
With the first string, nothing happens, but the incoming is returned. 
With the second string, something happens, and the whole string is removed. That is excessive.

### PHP Version

```plain
PHP 8.5.4, 
check with versions since 8.2+
```

### Operating System

_No response_
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.