[php-src] Issue #23243: Strange behaviour when using include and dot operator
[email protected] (bug-fix0r)
| Newsgroups | php.bugs |
|---|---|
| Message-ID | <lkgKi7WH2xLUqdictr9djKq5m8fdt4r6N3PwVWNGNjA@main.internal.php.net> |
Issue: https://github.com/php/php-src/issues/23243
Author: bug-fix0r
### Description
Bug also exists in 8.5.9. It thinks "jo" is part of the include path. For those who don't know include() returns the value returned in the include file.
The following code:
```php
<?php
error_reporting(E_ALL);
echo include("does-not-exist97456.php")."jo";
```
Resulted in this output:
```
PHP Warning: include(does-not-exist97456.phpjo): Failed to open stream: No such file or directory in /home/user1/php_include_bug.php on line 3
PHP Warning: include(): Failed opening 'does-not-exist97456.phpjo' for inclusion (include_path='.:/usr/share/php') in /home/user1/php_include_bug.php on line 3
```
But I expected this output instead:
```
PHP Warning: include(does-not-exist97456.php): Failed to open stream: No such file or directory in /home/user1/php_include_bug.php on line 3
PHP Warning: include(): Failed opening 'does-not-exist97456.php' for inclusion (include_path='.:/usr/share/php') in /home/user1/php_include_bug.php on line 3
jo
```
### PHP Version
```plain
PHP 8.4.24 (cli) (built: Jul 31 2026 05:11:11) (NTS)
Copyright (c) The PHP Group
Built by Debian
Zend Engine v4.4.24, Copyright (c) Zend Technologies
with Zend OPcache v8.4.24, Copyright (c), by Zend Technologies
```
### Operating System
_No response_