php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #42262 get_magic_quotes_gpc() should be there and return false
Submitted: 2007-08-09 22:39 UTC Modified: 2011-04-08 21:26 UTC
Votes:5
Avg. Score:3.4 ± 2.0
Reproduced:3 of 4 (75.0%)
Same Version:3 (100.0%)
Same OS:1 (33.3%)
From: spam2 at rhsoft dot net Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 6CVS-2007-08-09 (snap) OS: All
Private report: No CVE-ID: None
 [2007-08-09 22:39 UTC] spam2 at rhsoft dot net
Description:
------------
[10-Aug-2007 00:30:56] PHP Fatal error:  Call to undefined function get_magic_quotes_gpc() in /mnt/data/www/sql.rhsoft.net/libraries/common.lib.php on line 2606


The function "get_magic_quotes_gpc()" should available in PHP6 and return always false, so you dont break applications that check the setting and make a "stripslashes" if it is on.



Reproduce code:
---------------
if(function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc())
{
 @$akt_temp_str_name = stripslashes(@$akt_temp_str_name);
}

Expected result:
----------------
if(get_magic_quotes_gpc())
{
 @$akt_temp_str_name = stripslashes(@$akt_temp_str_name);
}

should work also

Actual result:
--------------
A fatal error

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-02-04 13:17 UTC] msaraujo@php.net
Hello,

The behavior of get_magic_quotes_gpc has changed. Check the NEWS file:

 "Changed get_magic_quotes_gpc(), get_magic_quotes_runtime to always return
    false and set_magic_quotes_runtime() to raise an E_CORE_ERROR."

 [2008-02-04 13:41 UTC] pajoye@php.net
 > still not bug, please see php.internals archive for the discussion about this change.
 [2008-02-05 04:02 UTC] philip@php.net
As the reporter mentioned outside this report, NEWS indicates this function should exist whereas various bug reports say it shouldn't, and I cannot find the decision on internals...

For now we must consider NEWS as the authority in which case this function should exist so please update NEWS if this has changed and regardless it will then be documented.

And since it (php5) returns 0 or 1, I reckon if it exists it should return 0 and not false.
 [2008-02-05 11:34 UTC] pajoye@php.net
Hi Philip, see the "Remove magic_quotes and register global" thread two years ago.

The functions (there is more than the getter) can't exist anymore as the underlying features do not exist anymore. Using them (in all bad possible bad ways) can end in a rather unexpected result if they don't check return values (setter).

A simple if (php_version >= 6) does the job and makes it clear in your code. Still no bug sorry (that means bogus here).
 [2008-03-02 05:36 UTC] philip@php.net
Still being discussed... and the thread in question decided to keep them AFAICT. Where else was a decision made on this?

http://marc.info/?l=php-internals&m=114177891420914&w=2

 [2011-04-08 21:26 UTC] jani@php.net
-Status: Open +Status: Bogus -Package: Feature/Change Request +Package: *General Issues
 [2011-04-08 21:26 UTC] jani@php.net
No longer issue since the PHP 6 branch was discarded.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 06 09:01:30 2024 UTC