FAQ
Edit report at https://bugs.php.net/bug.php?id=69199&edit=1

  ID: 69199
  Updated by: rasmus@php.net
  Reported by: pegasus@vaultwiki.org
  Summary: require_once doesn't require ./ files
  Status: Feedback
  Type: Bug
  Package: Scripting Engine problem
  Operating System: Centos 6 64-bit
  PHP Version: master-Git-2015-03-07 (Git)
  Block user comment: N
  Private report: N

  New Comment:

I am not able to reproduce this. Can you provide a standalone example?
Looking at both the code and an strace, nothing has changed here. An explicit require of ./includes/filename.php will only attempt to load that file from the directory the parent script is in.


Previous Comments:
------------------------------------------------------------------------
[2015-03-08 02:55:18] demon@php.net

Could you please check your report_erroring level? Maybe the level is too High. In my computer I get two Warning:

Warning: include_once(./2.php): failed to open stream: No such file or directory in /tmp/1.php on line 3

Warning: include_once(): Failed opening './2.php' for inclusion (include_path='.:') in /tmp/1.php on line 3
array(1) {
   [0]=>
   string(10) "/tmp/1.php"
}

------------------------------------------------------------------------
[2015-03-07 18:37:52] pegasus@vaultwiki.org

Which commit should I be trying for the fix? I'm not seeing any related changes in the shortlog.

Even if include_path causes the issue, I would expect that a Fatal Error is thrown when it can't find the required file in either the include_path or the current directory. The behavior I experienced was that it just ignored the file entirely and proceeded with execution until something in the unloaded file was used.

------------------------------------------------------------------------
[2015-03-07 18:08:27] demon@php.net

It seems that include_path causes the issue. When you are running the script, "./xxxx.php" will be searched in the current directory and include_path.

e.g. The scriptname that you are going to run is /a/b/c.php.
1. cd /a/b
2. php c.php

Could you please check if the issue is fixed?

------------------------------------------------------------------------
[2015-03-07 15:29:11] pegasus@vaultwiki.org

Description:
------------
After trying to run vBulletin under Master, I've found that I get Fatal Error: undefined function for a lot of functions which are normally included under PHP 5.6.

After investigating more closely, the affected functions are all included using the format:

require_once('./includes/filename.php');

If I dump the results of get_included_files(), I find that this file never gets included.

However, if I modify the line like so:

require_once('includes/filename.php');

Then all the functions are included as expected. It seems to me that require_once just skips anything starting with ./
If my include paths were configured incorrectly, I would expect a Fatal Error due to file-not-being-found.

Expected result:
----------------
Functions in ./ includes should be included.

Actual result:
--------------
Functions in ./ includes are not included.


------------------------------------------------------------------------

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 5 of 19 | next ›
Discussion Overview
groupphp-bugs @
categoriesphp
postedMar 7, '15 at 3:29p
activeMar 27, '15 at 4:06p
posts19
users4
websitephp.net

People

Translate

site design / logo © 2017 Grokbase