Skip to content

Commit

Permalink
Show WARNING when safe_mode is enabled but only realpath_turbo.safe_m…
Browse files Browse the repository at this point in the history
…ode should be used

If safe_mode is set when realpath_turbo.safe_mode should be used it doesn't make sense
because then realpath cache is already disabled by PHP and cannot be re-enabled.
  • Loading branch information
Whissi committed Oct 6, 2016
1 parent b3be040 commit 26e6bc0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions realpath_turbo.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ PHP_RINIT_FUNCTION(realpath_turbo)

#if (PHP_MAJOR_VERSION == 5) && (PHP_MINOR_VERSION < 4)
if (do_safe_mode) {
if (PG(safe_mode) && *PG(safe_mode)) {
php_error_docref(NULL, E_WARNING, "safe_mode already set! Please disable safe_mode and only use realpath_turbo.safe_mode option. realpath_turbo will not have any effect when safe_mode is already enabled.");
return FAILURE;
}

zend_alter_ini_entry("safe_mode", sizeof("safe_mode"), "1", 1, PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
}
#endif
Expand Down

0 comments on commit 26e6bc0

Please sign in to comment.