PHP register_globals is ON

I started writing PHP when I was at University, in 2001 or thereabouts. Having checked the dates it looks like I did technically write PHP before PHP 4.3 was released and register_globals went out of fashion. I don’t recall it though and obviously its been a while!

Today I was trying to debug a script which uses register_globals on, virtually for the first time. Its a new working environment for me and a situation where support is still being provided for some legacy systems. Trying to track where values are coming from, or might be coming from, was quite mind-bending. Its like having voices inside my head while I’m trying to concentrate on something!

There’s more where that came from so if anyone has any suggestions for debugging a language where the variables seem to come from nowhere, or can remember how to work with PHP with register_globals turned on, I’d be grateful :)

3 thoughts on “PHP register_globals is ON

  1. Javascript springs to mind for variables appearing from nowhere. Global Javascript variables are even more hair-tearingly-out annoying and mysterious.

  2. Thanks for your comments guys!

    Kevin – yeah I’m hoping not to come across that one :)

    Simon – I fear my JavaScript skills may take some exercising pretty soon, I’ve got you on my emergency contact list!

Leave a Reply

Please use [code] and [/code] around any source code you wish to share.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

To respond on your own website, enter the URL of your response which should contain a link to this post's permalink URL. Your response will then appear (possibly after moderation) on this page. Want to update or remove your response? Update or delete your post and re-enter your post's URL again. (Find out more about Webmentions.)