php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75295 include read data outside parentheses
Submitted: 2017-09-30 15:52 UTC Modified: 2017-09-30 17:48 UTC
From: brilicru at yandex dot ru Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 7.1.10 OS: Windows 10 x64, Ubuntu x64
Private report: No CVE-ID: None
 [2017-09-30 15:52 UTC] brilicru at yandex dot ru
Description:
------------
A strange work include, which does not stop reading data even outside parentheses.

Test script:
---------------
<?php
$filename = './include.php';
file_exists($filename) or file_put_contents($filename, $filename);
var_dump(include($filename).''); //correct
var_dump(include($filename).' ololo'); //warning


Expected result:
----------------
include.phpint(1)
include.phpint(1) ololo

Actual result:
--------------
include.phpint(1)
PHP Warning:  include(./include.php ololo): failed to open stream: No such file or directory in D:\script.php on line 5

Warning: include(./include.php ololo): failed to open stream: No such file or directory in D:\script.php on line 5
PHP Warning:  include(): Failed opening './include.php ololo' for inclusion (include_path='.') in D:\script.php on line 5

Warning: include(): Failed opening './include.php ololo' for inclusion (include_path='.') in D:\script.php on line 5
bool(false)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-09-30 17:44 UTC] brilicru at yandex dot ru
-Package: inclued +Package: *General Issues
 [2017-09-30 17:44 UTC] brilicru at yandex dot ru
incorrect package.
 [2017-09-30 17:48 UTC] requinix@php.net
-Status: Open +Status: Not a bug
 [2017-09-30 17:48 UTC] requinix@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

> Because include is a special language construct, parentheses are not needed
> around its argument.
http://php.net/manual/en/function.include.php
See what happens in example #4.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 14:01:29 2024 UTC