php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #6977 strange twist of the parser
Submitted: 2000-10-02 17:34 UTC Modified: 2000-10-05 18:00 UTC
From: lanzz at graffiti dot net Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0.2 OS: linux-2.2.13 slackware-7.0
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: lanzz at graffiti dot net
New email:
PHP Version: OS:

 

 [2000-10-02 17:34 UTC] lanzz at graffiti dot net
<?
print("one-".include("test.inc")."-two");
?>

Warning: Failed opening 'test.inc-two' for inclusion (include_path='.:/usr/local/lib/php') in
...BLABLABLA.../test.php on line 3
one-

----------------------------------------------------
how the hell did the "-two" got concatenated to
"test.inc"? i know that include is not a function but a special statement, but it is described as "include()" in the documentation, which led me to believe that it DOES take into account the parentheses, but suddenly the catenation takes precedence over the include statement. this behavior doesn't seem sane, at least.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-10-05 18:00 UTC] stas@php.net
This is because include is tatement, not function. You can say include "foo" (without parens) for example. So, your code is paresed as include [("test.inc")."-two"]. Try doing "one-".(include("test.inc"))."-two").
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Sun Oct 11 11:00:01 2026 UTC