[php-src] Issue #8014: http_response_code(400) in file_exists bug when using variable (in if block)
| From: | ReturnMe | Date: | Mon, 31 Jan 2022 22:56:12 +0000 |
| Subject: | [php-src] Issue #8014: http_response_code(400) in file_exists bug when using variable (in if block) | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-239378@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/8014
Author: ReturnMe
### Description

When I don't use variables, it works fine. The following code:
```php
<?php
// Not working. Response Http Code: 200
if(!file_exists('view/files/' . $_GET['u'] . '.php')){
http_response_code(404);
include 'view/files/404.php';
}
// Working. Response Http Code: 404
if(!file_exists('view/files/settings.php')){
http_response_code(404);
include 'view/files/404.php';
}
### PHP Version
8.1.1
### Operating System
Win 10 Pro