[php-src] Issue #12144: Assert is not works if install php from ppa:ondrej/php ubuntu repository
| From: | vtsykun | Date: | Wed, 06 Sep 2023 13:54:10 +0000 |
| Subject: | [php-src] Issue #12144: Assert is not works if install php from ppa:ondrej/php ubuntu repository | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-245347@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/12144
Author: vtsykun
### Description
The following code:
```php
<?php
$validateKey = static function (string $key): string {
if (false !== strpbrk($key, '{}()/\@:')) {
throw new \InvalidArgumentException(sprintf('Cache key "%s" contains reserved
characters "%s".', $key, '{}()/\@:'));
}
return $key;
};
$key = 'cache:ping';
\assert('' !== $validateKey($key));
```
Resulted in this output:
```
```
But I expected this output instead:
```
Fatal error: Uncaught InvalidArgumentException: Cache key "cache:ping" contains reserved
characters "{}()/\@:"
```
I tested different versions of Ubuntu (16.04 22.04 20.04) and php (7.1-8.2) and got a different
result depending on installation method.

But if use php from docker image php:8.2-fpm-alpine, php:8.1-fpm-alpine, I got an error
```
PHP Fatal error: Uncaught InvalidArgumentException: Cache key "cache:ping" contains
reserved characters "{}()/\@:". in test.php:21
```
### PHP Version
7.1-8.2
### Operating System
Ubuntu 20.04