Issue: https://github.com/php/php-src/issues/7770
Author: anibalsanchez
### Description
The following code:
```php
<?php
echo htmlspecialchars("'");
```
Resulted in this output on PHP 8.1:
```
#039
```
But I expected this output instead (like it works on PHP 7.4 or PHP 8):
```
'
```
htmlspecialchars("'", ENT_SUBSTITUTE) makes it work on all PHP versions.
### PHP Version
PHP 8.1
### Operating System
_No response_