• H2GD Part 14: battles with PHP’s serialize and WordPress cache

    Just over a year ago I raised a TRAC on WordPress to do with the PHP serialize() function. It was finally closed last night. Then something spooky happened…

    • In August 2011 I raised ticket #18488 against WordPress with the exciting subject of “set_transient crashes when value parameter is a SimpleXMLElement object”.
    • Earlier today I received an email telling me that it had been closed as invalid.
    • I was happy to accept that… I’d already changed my code.
    • BUT there were some unanswered questions
      •  “What is WordPress’s strategy towards parameter validation and error handling?”
      • “Are core functions supposed to crash when passed invalid parameters?”
      • AND “Is there any evidence to show that most functions would crash if passed invalid parameters?”
    • Not wanting Nacin to have the last word, I wrote a response in which I referred interested parties to the blog I wrote 3 years ago about my time at IBM. http://solongandthanksforalltheghoti.blogspot.co.uk/2009/09/what-did-you-expect.html
    • What you don’t see in the blog is the official response to the question “What’s supposed to happen when I pass invalid parameters?
    • The answer is that I developed some rather advanced exception handling routines for each of our documented application programming interfaces (APIs)
    • … magically coded into the TRACE macros that were standard in EACH API.
    • So, what I was hoping for was a response that says… WordPress policy on parameter validation and error handling is clearly documented here…

    fob-bong-developer-what-was-the-error-then

    • NOW, just recently I’ve been following a video and associated comments along the lines of “Improving the WordPress.org plugin repository”
    • All very commendable and interesting (is ‘interesting’ a ‘euphemism’ for distracting?)
    • There was a pointer to a plugin called developer. It was suggested that every plugin developer should use it.
    • Not knowing what it did I decided to install it and try it out.
    • I must say I was rather disappointed to have it fail on me almost instantly.
    • It produced an “Error!” message.
    • That’s it – it just said “Error! – so I raised a support topic http://wordpress.org/support/topic/plugin-developer-error-when-installing-plugins?replies=1
    • Given that one of the purposes of the discussion was for the repository  to “be a garden of trusted plugins” I felt rather let down by this message.
    • BUT It turned out that the plugin wasn’t quite telling the truth.
    • I don’t know why it said “Error!” but what I’d asked it to do had actually worked. The debug-bar plugin had been installed and activated after all.
    • SO, once I’d dealt with the original TRAC and the new support topic on developer I thought I’d be a good boy and try to track down the problem myself.
    • I looked at my PHP error log file and lo and behold what did I see?
    • Exactly the same message in my log file as the one I’d been complaining about in the first place.

    PHP Fatal error:  Uncaught exception 'Exception' with message 'Serialization of 'SimpleXMLElement' is not allowed'


    , ,

    Published:

    Last updated:

    August 18, 2014

Categories

Tide times from tidetimes.co.uk

Tide Times & Heights for Northney on
Sunday, 17 October 2021

Tide times from tidetimes.org.uk

Tide Times & Heights for Northney on
17th October 2021
02:53 Low Tide ( 1.18m )
10:51 High Tide ( 4.33m )
15:20 Low Tide ( 1.2m )
23:10 High Tide ( 4.23m )