php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #43732 Implement dummy get / set_magic_quotes_runtime for compatibility
Submitted: 2008-01-02 22:55 UTC Modified: 2008-01-02 23:23 UTC
From: samuel at slbdata dot se Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 6CVS-2008-01-02 (snap) OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: samuel at slbdata dot se
New email:
PHP Version: OS:

 

 [2008-01-02 22:55 UTC] samuel at slbdata dot se
Description:
------------
In PHP 6 magic_quotes has been removed completely, but many scripts use  get/set_magic_quotes_runtime to DISABLE it. These scripts break with PHP 6, even though they do not use magic_quotes.



Reproduce code:
---------------
<?php

$old = get_magic_quotes_runtime();
set_magic_quotes_runtime(0);
// Do something here
set_magic_quotes_runtime($old);


Expected result:
----------------
Because the script tried to disable magic_quotes, it should work. I suggest that the behavior in PHP 6 is changed to:

get_magic_quotes_runtime()   // always returns 0
set_magic_quotes_runtime(0)  // does nothing
set_magic_quotes_runtime(1)  // fatal error

(0 and 1 could of course be replaced with anything that is equal to FALSE or TRUE, respectively)

Actual result:
--------------
With php6.0-200801022130 I get:
PHP Fatal error:  Call to undefined function get_magic_quotes_runtime() in - on line 3


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-01-02 23:23 UTC] johannes@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

That's intentional that way, this way we can make sure people see this change and update their application. For compatibility you can use something like

if (!function_exists('get_magic_quotes')) {
    function get_magic_quotes() {
        return false;
    }
}
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Jul 05 04:01:35 2025 UTC