[php-src] Issue #7770: htmlspecialchars converts ' to #039 on PHP 8.1

From: Date: Mon, 13 Dec 2021 20:12:21 +0000
Subject: [php-src] Issue #7770: htmlspecialchars converts ' to #039 on PHP 8.1
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-238378@lists.php.net to get a copy of this message
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_


Thread (1 message)

  • anibalsanchez
« previous php.bugs (#238378) next »