Do not use realpath() on includes.

If the file does not exist, realpath() returns false and "include false;"
produces "Failed opening '' for inclusion" which is a useless error message.

'include' works just fine with symlinks, "./" and "../".
This commit is contained in:
Andreas Fischer 2013-08-21 10:52:22 +02:00
parent 12f4494de0
commit 9753e44ac2
8 changed files with 62 additions and 62 deletions

View File

@ -25,7 +25,7 @@
namespace OCA\Encryption; namespace OCA\Encryption;
require_once realpath(dirname(__FILE__) . '/../3rdparty/Crypt_Blowfish/Blowfish.php'); require_once dirname(__FILE__) . '/../3rdparty/Crypt_Blowfish/Blowfish.php';
/** /**
* Class for common cryptography functionality * Class for common cryptography functionality

View File

@ -7,16 +7,16 @@
* See the COPYING-README file. * See the COPYING-README file.
*/ */
require_once realpath(dirname(__FILE__) . '/../3rdparty/Crypt_Blowfish/Blowfish.php'); require_once dirname(__FILE__) . '/../3rdparty/Crypt_Blowfish/Blowfish.php';
require_once realpath(dirname(__FILE__) . '/../../../lib/base.php'); require_once dirname(__FILE__) . '/../../../lib/base.php';
require_once realpath(dirname(__FILE__) . '/../lib/crypt.php'); require_once dirname(__FILE__) . '/../lib/crypt.php';
require_once realpath(dirname(__FILE__) . '/../lib/keymanager.php'); require_once dirname(__FILE__) . '/../lib/keymanager.php';
require_once realpath(dirname(__FILE__) . '/../lib/proxy.php'); require_once dirname(__FILE__) . '/../lib/proxy.php';
require_once realpath(dirname(__FILE__) . '/../lib/stream.php'); require_once dirname(__FILE__) . '/../lib/stream.php';
require_once realpath(dirname(__FILE__) . '/../lib/util.php'); require_once dirname(__FILE__) . '/../lib/util.php';
require_once realpath(dirname(__FILE__) . '/../lib/helper.php'); require_once dirname(__FILE__) . '/../lib/helper.php';
require_once realpath(dirname(__FILE__) . '/../appinfo/app.php'); require_once dirname(__FILE__) . '/../appinfo/app.php';
require_once realpath(dirname(__FILE__) . '/util.php'); require_once dirname(__FILE__) . '/util.php';
use OCA\Encryption; use OCA\Encryption;

View File

@ -6,15 +6,15 @@
* See the COPYING-README file. * See the COPYING-README file.
*/ */
require_once realpath(dirname(__FILE__) . '/../../../lib/base.php'); require_once dirname(__FILE__) . '/../../../lib/base.php';
require_once realpath(dirname(__FILE__) . '/../lib/crypt.php'); require_once dirname(__FILE__) . '/../lib/crypt.php';
require_once realpath(dirname(__FILE__) . '/../lib/keymanager.php'); require_once dirname(__FILE__) . '/../lib/keymanager.php';
require_once realpath(dirname(__FILE__) . '/../lib/proxy.php'); require_once dirname(__FILE__) . '/../lib/proxy.php';
require_once realpath(dirname(__FILE__) . '/../lib/stream.php'); require_once dirname(__FILE__) . '/../lib/stream.php';
require_once realpath(dirname(__FILE__) . '/../lib/util.php'); require_once dirname(__FILE__) . '/../lib/util.php';
require_once realpath(dirname(__FILE__) . '/../lib/helper.php'); require_once dirname(__FILE__) . '/../lib/helper.php';
require_once realpath(dirname(__FILE__) . '/../appinfo/app.php'); require_once dirname(__FILE__) . '/../appinfo/app.php';
require_once realpath(dirname(__FILE__) . '/util.php'); require_once dirname(__FILE__) . '/util.php';
use OCA\Encryption; use OCA\Encryption;

View File

@ -20,16 +20,16 @@
* *
*/ */
require_once realpath(dirname(__FILE__) . '/../3rdparty/Crypt_Blowfish/Blowfish.php'); require_once dirname(__FILE__) . '/../3rdparty/Crypt_Blowfish/Blowfish.php';
require_once realpath(dirname(__FILE__) . '/../../../lib/base.php'); require_once dirname(__FILE__) . '/../../../lib/base.php';
require_once realpath(dirname(__FILE__) . '/../lib/crypt.php'); require_once dirname(__FILE__) . '/../lib/crypt.php';
require_once realpath(dirname(__FILE__) . '/../lib/keymanager.php'); require_once dirname(__FILE__) . '/../lib/keymanager.php';
require_once realpath(dirname(__FILE__) . '/../lib/proxy.php'); require_once dirname(__FILE__) . '/../lib/proxy.php';
require_once realpath(dirname(__FILE__) . '/../lib/stream.php'); require_once dirname(__FILE__) . '/../lib/stream.php';
require_once realpath(dirname(__FILE__) . '/../lib/util.php'); require_once dirname(__FILE__) . '/../lib/util.php';
require_once realpath(dirname(__FILE__) . '/../lib/helper.php'); require_once dirname(__FILE__) . '/../lib/helper.php';
require_once realpath(dirname(__FILE__) . '/../appinfo/app.php'); require_once dirname(__FILE__) . '/../appinfo/app.php';
require_once realpath(dirname(__FILE__) . '/util.php'); require_once dirname(__FILE__) . '/util.php';
use OCA\Encryption; use OCA\Encryption;

View File

@ -20,14 +20,14 @@
* *
*/ */
require_once realpath(dirname(__FILE__) . '/../../../lib/base.php'); require_once dirname(__FILE__) . '/../../../lib/base.php';
require_once realpath(dirname(__FILE__) . '/../lib/crypt.php'); require_once dirname(__FILE__) . '/../lib/crypt.php';
require_once realpath(dirname(__FILE__) . '/../lib/keymanager.php'); require_once dirname(__FILE__) . '/../lib/keymanager.php';
require_once realpath(dirname(__FILE__) . '/../lib/proxy.php'); require_once dirname(__FILE__) . '/../lib/proxy.php';
require_once realpath(dirname(__FILE__) . '/../lib/stream.php'); require_once dirname(__FILE__) . '/../lib/stream.php';
require_once realpath(dirname(__FILE__) . '/../lib/util.php'); require_once dirname(__FILE__) . '/../lib/util.php';
require_once realpath(dirname(__FILE__) . '/../appinfo/app.php'); require_once dirname(__FILE__) . '/../appinfo/app.php';
require_once realpath(dirname(__FILE__) . '/util.php'); require_once dirname(__FILE__) . '/util.php';
use OCA\Encryption; use OCA\Encryption;

View File

@ -20,15 +20,15 @@
* *
*/ */
require_once realpath(dirname(__FILE__) . '/../../../lib/base.php'); require_once dirname(__FILE__) . '/../../../lib/base.php';
require_once realpath(dirname(__FILE__) . '/../lib/crypt.php'); require_once dirname(__FILE__) . '/../lib/crypt.php';
require_once realpath(dirname(__FILE__) . '/../lib/keymanager.php'); require_once dirname(__FILE__) . '/../lib/keymanager.php';
require_once realpath(dirname(__FILE__) . '/../lib/proxy.php'); require_once dirname(__FILE__) . '/../lib/proxy.php';
require_once realpath(dirname(__FILE__) . '/../lib/stream.php'); require_once dirname(__FILE__) . '/../lib/stream.php';
require_once realpath(dirname(__FILE__) . '/../lib/util.php'); require_once dirname(__FILE__) . '/../lib/util.php';
require_once realpath(dirname(__FILE__) . '/../appinfo/app.php'); require_once dirname(__FILE__) . '/../appinfo/app.php';
require_once realpath(dirname(__FILE__) . '/../../files_trashbin/appinfo/app.php'); require_once dirname(__FILE__) . '/../../files_trashbin/appinfo/app.php';
require_once realpath(dirname(__FILE__) . '/util.php'); require_once dirname(__FILE__) . '/util.php';
use OCA\Encryption; use OCA\Encryption;

View File

@ -6,13 +6,13 @@
* See the COPYING-README file. * See the COPYING-README file.
*/ */
require_once realpath(dirname(__FILE__) . '/../../../lib/base.php'); require_once dirname(__FILE__) . '/../../../lib/base.php';
require_once realpath(dirname(__FILE__) . '/../lib/crypt.php'); require_once dirname(__FILE__) . '/../lib/crypt.php';
require_once realpath(dirname(__FILE__) . '/../lib/keymanager.php'); require_once dirname(__FILE__) . '/../lib/keymanager.php';
require_once realpath(dirname(__FILE__) . '/../lib/proxy.php'); require_once dirname(__FILE__) . '/../lib/proxy.php';
require_once realpath(dirname(__FILE__) . '/../lib/stream.php'); require_once dirname(__FILE__) . '/../lib/stream.php';
require_once realpath(dirname(__FILE__) . '/../lib/util.php'); require_once dirname(__FILE__) . '/../lib/util.php';
require_once realpath(dirname(__FILE__) . '/../appinfo/app.php'); require_once dirname(__FILE__) . '/../appinfo/app.php';
use OCA\Encryption; use OCA\Encryption;

View File

@ -20,14 +20,14 @@
* *
*/ */
require_once realpath(dirname(__FILE__) . '/../../../lib/base.php'); require_once dirname(__FILE__) . '/../../../lib/base.php';
require_once realpath(dirname(__FILE__) . '/../lib/crypt.php'); require_once dirname(__FILE__) . '/../lib/crypt.php';
require_once realpath(dirname(__FILE__) . '/../lib/keymanager.php'); require_once dirname(__FILE__) . '/../lib/keymanager.php';
require_once realpath(dirname(__FILE__) . '/../lib/proxy.php'); require_once dirname(__FILE__) . '/../lib/proxy.php';
require_once realpath(dirname(__FILE__) . '/../lib/stream.php'); require_once dirname(__FILE__) . '/../lib/stream.php';
require_once realpath(dirname(__FILE__) . '/../lib/util.php'); require_once dirname(__FILE__) . '/../lib/util.php';
require_once realpath(dirname(__FILE__) . '/../appinfo/app.php'); require_once dirname(__FILE__) . '/../appinfo/app.php';
require_once realpath(dirname(__FILE__) . '/util.php'); require_once dirname(__FILE__) . '/util.php';
use OCA\Encryption; use OCA\Encryption;