Crappy sandbox again? (usage of realpath)

Notice: This thread is very old.
wdolek
Member | 331
+
0
-

I was quite shocked, when mixed my old code with actual Nette release… It just didn't work due to missing values in $params array in Nette\Configurator class. (It worked pretty with global constants – everything was defined nicely on one place in index.php… I know, constants are problematical, but splitting these setup to index.php and to bootstrap.php in sandbox is pretty unclear to me)

I decided to rewrite index.php and bootstrap.php as is in sandbox. I found problem – usage of realpath.

There is said:

The running script must have executable permissions on all directories in the hierarchy, otherwise realpath() will return FALSE.

In code, we can find:

$params['appDir'] = realpath(__DIR__ . '/app');

On my environment, I retrieve from __DIR__ full path from root of file system – so using of realpath is redundant. Another problem is with executable permissions on every level of path to directory – in my case /var/www/mySadProject/. On this line, I retrieved value false, meaning empty string. Then Configurator tried to locate directory /cache instead of /var/www/mySadProject/app/tmp/cache.


Oh! And just found that realpath is spread on more places in code (dull)…

Last edited by wdolek (2011-11-15 00:11)

wdolek
Member | 331
+
0
-

Seems that I had more issues with server installation. Anyway, could we get rid of realpath? Is it necessary? If user is not able to input path properly, we shouldn't allow him to writ application anyway ;D