Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I replace the deprecated set_magic_quotes_runtime in php?

Tags:

php

deprecated

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!

like image 641
Shawn Avatar asked Feb 07 '10 19:02

Shawn


1 Answers

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/

like image 139
philfreo Avatar answered Sep 30 '22 19:09

philfreo