views:

76

answers:

3

Hi there, 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 to?

A: 

you can just comment out set_magic_quotes_runtime() call at line 98 in system/core/Kohana.php

Col. Shrapnel
Thank you for the response - I suppose i could, but i have other developers working on this project, and there must be another way to disable.
Michel Joanisse
@Michel to disable *what*? Have you read error message you posted?
Col. Shrapnel
Please don't edit the core files, create a class extension and edit the behavior there.
The Pixel Developer
A: 

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

maggie
Please don't edit the core files, create a class extension and edit the behavior there.
The Pixel Developer
A: 

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.

Archimedix
I would advise against that. Such a policy will end up someday with `undefined function` fatal error which cannot be recovered by setting up error reporting level. E-deprecated errors intention to give you time to prepare. Not to blind yourself.
Col. Shrapnel
@Col well, if the problem is in the framework's core...? With the caveats you mention, hiding the error may be the best option in this very specific case.
Pekka
@Col. Shrapnel, I know, this is why I specifically said that you want as many warnings as possible on development machines to fix such things. Added a clarification on this fixing the symptom only for even more explicit clarity :) Of course, the best thing for a framework to do is check the PHP version and only use deprecated functions where they are not deprecated but have an effect on the proper function of the system (e.g. older PHP versions where `magic_quotes_gpc` is on).
Archimedix
this particular error message has nothing to do with magic_quotes_gpc
Col. Shrapnel
Sorry, should have been `magic_quotes_runtime`. Nonetheless, the value of such deprecated configuration settings - of which there are several - determines the behavior of PHP scripts (e.g. unescape or not), and PHP frameworks often support PHP versions other than 5.3 as well.
Archimedix
@Pekka I know only one case for hiding specific errors: a big codebase and a *process* of migrating to newer PHP version. We disable some classes of errors *temporarily*, to prevent flooding our logs, **until** these errors gets repaired. Temporarily, not permanent. Hiding errors permanently is a way to disaster. Isn't it obvious?
Col. Shrapnel
@Col yes, of course. But the error in question is in a third party framework that you may want to update frequently. When you do that, you will be in the situation that you need to re-insert the hack every single time. This is something where I could accept hiding the error until it has been fixed in the framework
Pekka
@all - the reason I don't want to alter the call to the function, it's part of the kohana framework, I've been advised to avoid altering. @Col. Shrapnel - 'this particular error message has nothing to do with magic_quotes_gpc' Any clue / idea as to what is causing the error? How to get around it?
Michel Joanisse