require_once在没有包含路径的情况下工作

I have file 1.php having a require_once for 2.php (both of them are in different folders). The issue I am having is that 1.php seems to magically include 2.php since the path for 2.php is not in 1.php. Just to be sure, I even added a set_include_path('.') before the require_once '2.php', but it still works... Is there something obvious I am missing or is this plain weird??

Edit:

//-- file 1.php
//-- long list of requires...
set_include_path('.');
echo get_include_path();
require_once '2.php';

The above works fine while 1.php and 2.php are in different folders.

There is some include magic in PHP, i've met it before.
Something autoload related, I believe.
It always looks in the folder where file with running class resides

Try echo get_include_path() after you set your empty include path, it may be set somewhere else (like in the web server config file).

Long shot but maybe one of the other included files changed the current working directory:

<?php
echo 'cwd at the beginning of 1.php: ', getcwd(), "
";
//-- file 1.php
//-- long list of requires...
set_include_path('.');
echo 'include_path: ', get_include_path(), " 
";
echo 'cwd: ', getcwd(), "
";
require_once '2.php';

For the sake of argument, if you put a 2.php in the same location as 1.php does the new file get included instead of the old one?

Can you tell use what the value of your open_basedir is?

Perhaps you have a file with the same name as file 2 in the path of file 1.