Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
general-topic
Link formatting when upgrading 4.5 to 5.1.3
Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Sep 19, 2012 - 8:46 pm

I will do some more testing, but for if, for example, you have a post content with a in it...  it gets escaped on the way in and if you dont remove slashes on the way out, you will end up with \...  those are stored in the db vs quotes, for example...

Avatar
Peter
Member
Free Members
sp_UserOfflineSmall Offline
Nov 14, 2012 - 7:14 pm

Sorry for bringing up this topic again, but I had to share what I just learned since it didn't seem right that slashes were automatically being added (and then having to be removed): WordPress forces "addslashes" on all GET and POST variables. It runs this function on every page load in wp-settings.php and has been doing so since WP 2.5 (or even earlier -- I don't have any test installs from before then).

function wp_magic_quotes() { // If already slashed, strip. if ( get_magic_quotes_gpc() ) { $_GET = stripslashes_deep( $_GET ); $_POST = stripslashes_deep( $_POST ); $_COOKIE = stripslashes_deep( $_COOKIE ); }

// Escape with wpdb. $_GET = add_magic_quotes( $_GET ); $_POST = add_magic_quotes( $_POST ); $_COOKIE = add_magic_quotes( $_COOKIE ); $_SERVER = add_magic_quotes( $_SERVER );

// Force REQUEST to be GET + POST. $_REQUEST = array_merge( $_GET, $_POST );}

So... we have to strip slashes because WordPress forced the slashes in there. Apparently they'd like to get rid of this behavior in the future, but because of the sheer number of plugins and servers and still use magic quotes, they continue to do this in order to "inject" some consistency across the board, even though it is generally accepted as undesirable behavior now.

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Nov 15, 2012 - 5:45 am

Gosh - I had to re-read this whole thread just to get the context!

Yes - I know they would like to get rid of it. I say bring it on... Steve may have a comment...

andy-signature.png
YELLOW
SWORDFISH
Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Nov 16, 2012 - 9:19 am

yes, have been watching that wp discussion on removing that...  will get very interesting if they do...  actually would be best if they did, but could be nightmare, as you say, for folks - especially those who notoriously dont keep their plugins up to date...  lol, have to roll my eyes when we help someone and I see 20 or 30 plugins with updates available... ;)

Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 619
Members: 17362
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10127
Posts: 79625