简体   繁体   中英

Disabling magic_quotes_gpc

I have a site, locally setup. It's application development framework is Kohana.

I have an error displaying the following:

Unknown Error

An error was detected which prevented the loading of this page. If this problem persists, please contact the website administrator.

system/core/Kohana.php [98]:

Function set_magic_quotes_runtime() is deprecated
Stack Trace

    * system/core/Kohana.php [98]:

      set_magic_quotes_runtime(  )

    * system/core/Bootstrap.php [39]:

      Kohana::setup(  )

    * index.php [130]:

      require( system/core/Bootstrap.php )

Loaded in {execution_time} seconds, using {memory_usage} of memory. Generated by Kohana v{kohana_version}.

I've been told by another lead developer of this project, to disable magic_quotes in my php.ini ..
I'm using MAMP, and I've done so.

Problem is still apparent.. any clues as to what this error is caused by, how to get around?

Another quick something to note, when outputting phpinfo() , I get the following:

local value Off
Master Value On

Do I have to disable master value? If so, how?

Your using PHP 5.3 and since magic_quotes is drepacted in PHP 5.3 and will be removed. all functions that alter this ini setting throws an error.

Quick solution: go to file system/core/Kohana.php Line 98 and out-comment the set_magic_quotes_runtime

or switch to PHP 5.2.10

您可以在system / core / Kohana.php的第98行注释掉set_magic_quotes_runtime()调用

You are probably running PHP 5.3.x.
If you have have write access to your php.ini , you might want to try setting the error_reporting configuration entry to hide such E_DEPRECATED warnings.

Example (your mileage may vary...):

error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED

On development machines however, you usually want as many warnings as possible to fix bad or obsolete code.

See also

EDIT:
This would fix the symptom rather than the cause (editing the Kohana file) but personally, I don't like patching third-party libraries because you will have to do that for each new release you update to, unless the new release works in the very aspect the patch is about to fix.

EDIT 2:
To fix the cause, you could replace set_magic_quotes_runtime([VALUE]) with ini_set('magic_quotes_runtime', [VALUE]) .

This is probably safer than just removing the call because while the function is deprecated, it can still have an effect on the behavior of the software if omitted (if the PHP installation has magic_quotes_runtime enabled).

You might also want to check for a newer version of Kohana where this is fixed.

Note, however, that upgrading a framework should be done with extreme care and extended testing to ensure that things continue to work as expected.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM