CakePHP showing include_once warnings

Suddenly, this website stop working and this errors appeared:

Warning: include_once(///controllers/site/default.php) [function.include-once]: failed to open stream: No such file or directory in /var/www/html/sitename.com/web/index.php on line 54

Warning: include_once() [function.include]: Failed opening '///controllers/site/default.php' for inclusion (include_path='.:/usr/share/pear') in /var/www/html/sitename.com/web/index.php on line 54

I don't know how CakePHP works, this is why I need help to figure out what happened (without anyone messing the code). The indicated files, that says that they're not there (No such file or directory), are exactly where the path describes.

I appreciate any help!

Error from line 54 in index.php:

include_once sprintf('%s/%s%s/%s.php', ROOT_PROJECT, CONTROLLERS_DIR, $url->tipo, 'default');

Answers


I believe the problem lies in the variables inserted through sprintf.

There are some empty ones causing a lot of backslashes to be added to the string;

Basically it says

include('///controllers/site/default.php');

(This is also visible in the generated php warning)

Try catching empty variables or parsing the resulting string (making sure only 1 backslash exists between every parameter).

If I'm right the next php command should work:

include('/controllers/site/default.php');

Hope this helps.


Need Your Help

Hacks for clamping integer to 0-255 and doubles to 0.0-1.0?

math language-agnostic floating-point bit-manipulation integer-arithmetic

Are there any branch-less or similar hacks for clamping an integer to the interval of 0 to 255, or a double to the interval of 0.0 to 1.0? (Both ranges are meant to be closed, i.e. endpoints are

How to stop HSQLDB from command line

junit4 hsqldb

The following is the syntax I use to start my HSQL database before running junit tests.