For now, I've used that solution in all file that try to CHMOD:
if (false !== @file_put_contents($tmpFile, $content) &&
@rename($tmpFile, $file)) {
$wantedPerms = 0644;
$actualPerms = fileperms($file);
if($actualPerms < $wantedPerms)
chmod($file, $wantedPerms);
return;
}
So the CHMOD only try to be changed if the filepermission is too
restrictive.
Down side: The CHMOD will not be restricted if the CHMOD is too
permissive.
But in a developpement environnement, that just fit my needs.
It would be nice to have a setting of something like that to avoid
people working with CIFS partitions to need to hard fix the problem.
On 15 déc, 12:43, FMaz <[email protected]> wrote:
> Hi,
>
> I'm running Symfony2 on a NAS server, mounted in CIFS. So the CHMOD
> are globaly defined by default as 777 and can't be changed.
>
> When I first ran the Symfony2 sandbox version, I've executed the
> check.php file that was telling me that all the requirement were ok
> (except the timezone, but I don't think that's the problem here).
>
> So I ran the app_dev.php script and received some chmod error. Here's
> the full XDebug trace:
> ==========
> Fatal error: Uncaught exception 'ErrorException' with message
> 'Warning: chmod(): Operation not permitted in /mnt/nas/www/test/
> symfony2/src/vendor/twig/lib/Twig/Environment.php line 463' in /mnt/
> nas/www/test/symfony2/src/vendor/symfony/src/Symfony/Component/
> HttpKernel/Debug/ExceptionListener.php on line 84
>
> ErrorException: Warning: chmod(): Operation not permitted in /mnt/nas/
> www/test/symfony2/src/vendor/twig/lib/Twig/Environment.php line 463
> in /mnt/nas/www/test/symfony2/src/vendor/symfony/src/Symfony/Component/
> HttpKernel/Debug/ErrorHandler.php on line 58
>
> Call Stack:
> 0.0074 331128 1. {main}() /mnt/nas/www/test/symfony2/web/
> app_dev.php:0
> 0.0994 931144 2. Symfony\Component\HttpKernel\Kernel->handle()
> /mnt/nas/www/test/symfony2/web/app_dev.php:14
>
> 0.9072 3256536 3. Symfony\Component\HttpKernel\HttpKernel->handle()
> /mnt/nas/www/test/symfony2/src/vendor/symfony/src/Symfony/
>
> Component/HttpKernel/Kernel.php:181
> 0.9073 3256648 4.
> Symfony\Component\HttpKernel\BaseHttpKernel->handle()
> /mnt/nas/www/test/symfony2/app/cache/dev/classes-c0a12.php:
>
> 1041
> 1.3210 4231352 5. Symfony\Bundle\FrameworkBundle\Debug
> \EventDispatcher->notifyUntil() /mnt/nas/www/test/symfony2/app/cache/
> dev/classes-c0a12.php:998
> 1.3282 4235584 6. call_user_func() /mnt/nas/www/test/symfony2/
> src/vendor/symfony/src/Symfony/Bundle/FrameworkBundle/Debug/
> EventDispatcher.php:71
> 1.3282 4235612 7. Symfony\Component\HttpKernel\Debug
> \ExceptionListener->handle() /mnt/nas/www/test/symfony2/src/vendor/
> symfony/src/Symfony/Bundle/FrameworkBundle/Debug/EventDispatcher.php:0
> 1.3469 4352832 8. Symfony\Component\HttpKernel\HttpKernel->handle()
> /mnt/nas/www/test/symfony2/src/vendor/symfony/src/Symfony/
>
> Component/HttpKernel/Debug/ExceptionListener.php:77
> 1.3470 4352876 9.
> Symfony\Component\HttpKernel\BaseHttpKernel->handle()
> /mnt/nas/www/test/symfony2/app/cache/dev/classes-c0a12.php:
>
> 1041
>
> RuntimeException: Exception thrown when handling an exception. in /mnt/
> nas/www/test/symfony2/src/vendor/symfony/src/Symfony/Component/
> HttpKernel/Debug/ExceptionListener.php on line 84
>
> Call Stack:
> 0.0074 331128 1. {main}() /mnt/nas/www/test/symfony2/web/
> app_dev.php:0
> 0.0994 931144 2. Symfony\Component\HttpKernel\Kernel->handle()
> /mnt/nas/www/test/symfony2/web/app_dev.php:14
>
> 0.9072 3256536 3. Symfony\Component\HttpKernel\HttpKernel->handle()
> /mnt/nas/www/test/symfony2/src/vendor/symfony/src/Symfony/
>
> Component/HttpKernel/Kernel.php:181
> 0.9073 3256648 4.
> Symfony\Component\HttpKernel\BaseHttpKernel->handle()
> /mnt/nas/www/test/symfony2/app/cache/dev/classes-c0a12.php:
>
> 1041
> 1.3210 4231352 5. Symfony\Bundle\FrameworkBundle\Debug
> \EventDispatcher->notifyUntil() /mnt/nas/www/test/symfony2/app/cache/
> dev/classes-c0a12.php:998
> 1.3282 4235584 6. call_user_func() /mnt/nas/www/test/symfony2/
> src/vendor/symfony/src/Symfony/Bundle/FrameworkBundle/Debug/
> EventDispatcher.php:71
> 1.3282 4235612 7. Symfony\Component\HttpKernel\Debug
> \ExceptionListener->handle() /mnt/nas/www/test/symfony2/src/vendor/
> symfony/src/Symfony/Bundle/FrameworkBundle/Debug/EventDispatcher.php:0
> ====================
>
> I'm not yet sure to understand all the context, but could it be
> possible to add a check in the check.php script for the chmod ?
>
> Otherwise, I've hard time to figure out the real problem as all my
> files are 777.
> - Either the chmod try to restrict the access ( Can we desativate this
> in sandbox mode ? )
> - Either the chmod try to ensure that an already existing access is
> set. ( Could we check the permission with fileperms() before doing a
> possibly useless chmod() ?)
>
> Hope that was clear and constructive !
> I can't wait to start trying symfony2 :p
--
If you want to report a vulnerability issue on symfony, please send it to
security at symfony-project.com
You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en