• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Fixed  set_magic_quotes_runtime problem with php5.3

R

ragtek

Guest
#1
I can't run xenforo, because set_magic_quotes_runtime is deprecated

( ! ) Deprecated: Function set_magic_quotes_runtime() is deprecated in D:\xampp\xampp\htdocs\xf4\library\XenForo\Application.php on line 154

Since this function is depracted as of PHP 5.3, use ini_set('magic_quotes_runtime', 0); instead.
;)
 

Kier

XenForo Developer
Staff member
#5
Am I to understand that your server has magic quotes runtime enabled??

FWIW, we are running 5.3 here and have always done so.
 
R

ragtek

Guest
#6
my php.ini
Code:
magic_quotes_gpc = Off
magic_quotes_runtime = Off
error_reporting = E_ALL | E_STRICT
display_errors = On
It's because of enabled display_errors (tested it)
On a developer enviroment IMHO it has to be enabled, and it's fact that the function is deprecated.


I don't want to sound rude, it's my bad english;)
 

Kier

XenForo Developer
Staff member
#7
Can you open library/XenForo/Application.php and add an @ to the function call on line 154 like this:
PHP:
@set_magic_quotes_runtime(false);
Then let me know if it resolves the problem?
 
R

ragtek

Guest
#8
Yes, it's working, but why not change it to ini_set ?
Hidding the error because you're using a deprecated function is also no nice coding style.
Any reason you don't want to use it?:D

Just to be clear, both methods are working:
PHP:
@set_magic_quotes_runtime(false);
ini_set('magic_quotes_runtime', 0);
 

Mike

XenForo developer
Staff member
#9
ini_set can have problems in certain situations - I've actually seen hosts disable it, bizarrely.

It's an edge case, but ini_set will fail when the value is set via php_admin_value.
 
#10
On a clean install of XAMPP (installed today)
Deprecated: Function set_magic_quotes_runtime() is deprecated in
/Applications/XAMPP/xamppfiles/htdocs/xenforo/library/XenForo/Application.php on line 154
An unexpected error occurred. Please try again later.
(I am glad to see I am not the only person to have noticed this though and yes, I did read above and add the @ to suppress error reporting :))
 
F

Floris

Guest
#11
Yes, it's working, but why not change it to ini_set ?
Hidding the error because you're using a deprecated function is also no nice coding style.
Any reason you don't want to use it?:D

Just to be clear, both methods are working:
PHP:
@set_magic_quotes_runtime(false);
ini_set('magic_quotes_runtime', 0);
I agree :) While @ hides it, it doesn't really 'resolve' it.
that said, i understand why kier mentioned it :D