[php-src] Issue #7954: eval'ed code doesn't throw TypeError in some cases
| From: | damianwadley | Date: | Mon, 17 Jan 2022 07:54:00 +0000 |
| Subject: | [php-src] Issue #7954: eval'ed code doesn't throw TypeError in some cases | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-239048@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/7954
Comment Author: damianwadley
strict_types only affects function calls made directly inside the file itself. When you use eval,
you ask PHP to run the code, and PHP does not enable strict_types for function calls that it makes
itself.
If you want strict_types applied to the evaluated code then you need to declare that.
```php
eval('declare(strict_types=1); $t = new TClass($v);');
```
https://3v4l.org/vPgvb