tags:

views:

1542

answers:

6

Hi all,

I'm getting this message when I try to run a php script I have to use but did not write.

Deprecated: Function set_magic_quotes_runtime() is deprecated in /opt/lampp/htdocs/webEchange/SiteWeb_V5/inc/fpdf.php on line 1810

Here is line 1810:

set_magic_quotes_runtime(0);

If this is a deprecated function, what can I replace it with?

Thank you very much!

+1  A: 

Since Magic Quotes is now off by default (and scheduled for removal), you can just remove that function call from your code.

Doug T.
see my answer on why this may not be a good idea ( http://stackoverflow.com/questions/2217955/how-can-i-replace-the-deprecated-set-magic-quotes-runtime-in-php/2218021#2218021 )
philfreo
A: 

You don't need to replace it with anything. The setting magic_quotes_runtime is removed in PHP6 so the function call is unneeded. If you want to maintain backwards compatibility it may be wise to wrap it in a if statement checking phpversion using version_compare

Yacoby
A: 

ini_set('magic_quotes_runtime', 0) i guess

stereofrog
the magic_quotes_runtime option for ini_set is also Removed in PHP 6.0.0
Shawn
+2  A: 

Check if it's on first. That should get rid of the warning and it'll ensure that if your code is run on older versions of PHP that magic quotes are indeed off.

Don't just remove that line of code as suggested by others unless you can be 100% sure that the code will never be run on anything before PHP 5.3.

<?php
// Check if magic_quotes_runtime is active
if(get_magic_quotes_runtime())
{
    // Deactivate
    set_magic_quotes_runtime(false);
}
?>

get_magic_quotes_runtime is NOT deprecated in PHP 5.3.
Source: http://us2.php.net/get_magic_quotes_runtime/

philfreo
why the downvote? added more of an explanation
philfreo
+1 from me, nice explanation.
Alix Axel
get_magic_quotes_runtime gives a deprecated warning, just like set..., so that doesn't solve OP's problem
stereofrog
@stereofrog - are you sure? I haven't tested but the get function doesn't show that in the documentation, while the set function clearly does.
philfreo
A: 

Thanks, it really worked and solve the server issue.

Ali
A: 

philfreo's answer is good. Thanks.