WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 3 years ago

Last modified 3 years ago

#9394 closed defect (bug) (fixed)

set_magic_quotes_runtime deprecated in PHP 5.3

Reported by: sojweb Owned by: sojweb
Milestone: 3.3 Priority: low
Severity: minor Version: 2.8.1
Component: Warnings/Notices Keywords:
Focuses: Cc:

Description

In PHP 5.3, the set_magic_quotes_runtime() function in wp-settings.php has been deprecated and gives an error. I propose two ways of addressing this, one to simply suppress the error, another to do a version test. The version test method would be better should the function ever be removed from PHP.

Attachments (2)

version-test.patch (496 bytes) - added by sojweb 5 years ago.
suppress.patch (446 bytes) - added by sojweb 5 years ago.

Download all attachments as: .zip

Change History (21)

sojweb5 years ago

sojweb5 years ago

comment:1 in reply to: ↑ description sojweb5 years ago

Meant to add this in the original description: Magic quotes are disabled by default in 5.3, and removed in PHP 6 http://us2.php.net/magic_quotes

comment:2 sojweb5 years ago

  • Owner changed from anonymous to sojweb

comment:3 sojweb5 years ago

This is definitely related to #8701. But given that support will be completely removed for this at some point, playing around with error reporting levels is, at best, a temporary fix. Probably the only way to handle it properly is to break backward compatibility, do version testing, or create the wp-settings.php file at install time with the appropriate code.

comment:4 follow-up: azaozz5 years ago

How about testing for "features"? Easy enough to do here:

if ( function_exists('set_magic_quotes_runtime')
    set_magic_quotes_runtime(0);

comment:5 in reply to: ↑ 4 jacobsantos5 years ago

Replying to azaozz:

How about testing for "features"? Easy enough to do here:

if ( function_exists('set_magic_quotes_runtime')
    set_magic_quotes_runtime(0);

This does not cover deprecated. PHP6 isn't going to be released in a while, so covering support for it now, doesn't seem like a good idea.

comment:6 sojweb5 years ago

I think I have a better solution; I will post it later today.

comment:7 sojweb5 years ago

Perhaps a more comprehensive solution here: #8701

comment:8 Denis-de-Bernardy5 years ago

  • Milestone changed from Unassigned to 2.8
  • Severity changed from normal to major

hasn't this been fixed in trunk via #8701?

comment:9 Denis-de-Bernardy5 years ago

  • Resolution set to duplicate
  • Status changed from new to closed

closing as dup of #8701

comment:10 lloydbudd5 years ago

  • Component changed from General to Warnings/Notices
  • Milestone changed from 2.8 to Future Release
  • Priority changed from normal to low
  • Resolution duplicate deleted
  • Severity changed from major to minor
  • Status changed from closed to reopened
  • Version changed from 2.7.1 to 2.8.1

#8701 would seem to just hide the issue of using the deprecated function, not fix the issue. Reopening.

$ ack set_magic_quotes_runtime -l
wp-admin/import/blogware.php
wp-admin/import/dotclear.php
wp-admin/import/rss.php
wp-admin/import/textpattern.php
wp-admin/import/wordpress.php
wp-admin/includes/class-pclzip.php
wp-includes/class-phpmailer.php
wp-settings.php

comment:11 Denis-de-Bernardy4 years ago

  • Keywords php 5.3 set_magic_quotes_runtime has-patch tested removed

in this case it should version compare < 5.3

comment:12 mark-k4 years ago

  • Cc mark-k added

Just encountered this issue. caused the firestats plugin not to work because the deprecation notice was output into the JS file it generates on the fly. I would suggest to bump up the priority/severity of this bug.

comment:13 nacin4 years ago

Why is it outputting JS on the fly? admin-ajax? wp_localize_script?

E_DEPRECATED is silenced by WP. I consider this ticket wontfix.

comment:14 Ipstenu3 years ago

Looks like it blows up in PHP6 (per hearsay reports - the evidence is circumstantial.)

comment:15 nacin3 years ago

PHP6 development was moved to a branch some time ago because Unicode support was too difficult to implement. We won't be needing to make a decision on this for a few years.

comment:16 azizur3 years ago

  • Cc azizur added

I am on PHP Version 5.3.5 and it just showed up. Would be nice to have this resolved.

Last edited 3 years ago by azizur (previous) (diff)

comment:17 wonderboymusic3 years ago

it would be nice to not have this in the logs on every single request ( when error_reporting(-1) is set )

I don’t understand the hesitance to just switch to ini_set? The next line does it properly:

// Disable magic quotes at runtime. Magic quotes are added using wpdb later in wp-settings.php.
set_magic_quotes_runtime( 0 );
@ini_set( 'magic_quotes_sybase', 0 );
Last edited 3 years ago by wonderboymusic (previous) (diff)

comment:18 Viper007Bond3 years ago

  • Milestone changed from Future Release to 3.3
  • Resolution set to fixed
  • Status changed from reopened to closed

Fixed in [18549].

comment:19 hakre3 years ago

Thanks for fixing. Just ran over it, changed a 3.2.1 install, fixed my warning issue.

Note: See TracTickets for help on using tickets.