[wp-trac] [WordPress Trac] #20139: E_DEPRECATED and E_STRICT issues in SimplePie

WordPress Trac wp-trac at lists.automattic.com
Mon May 28 09:00:19 UTC 2012


#20139: E_DEPRECATED and E_STRICT issues in SimplePie
--------------------------------+-----------------------
 Reporter:  uuf6429             |       Owner:
     Type:  defect (bug)        |      Status:  reopened
 Priority:  normal              |   Milestone:
Component:  External Libraries  |     Version:  3.3.1
 Severity:  normal              |  Resolution:
 Keywords:                      |
--------------------------------+-----------------------

Comment (by rmccue):

 Hi! Don't worry about being rude, I've been an open source developer for
 too long to take any comments personally. :)

 So, I'd like to explain in detail the situation and why it exists. The
 relevant "errors" that are picked up are `E_DEPRECATED` and `E_STRICT`,
 which were both introduced in PHP 5 as a guide to developers on where they
 can improve their code. (I quote "errors", since they're not actually
 errors, but just notices that the code can be improved.) Given that they
 are simply guides, they are of no relevance whatsoever to users, which is
 why the recommended `error_reporting` setting for PHP does not include
 them.

 The key to why they exist is that they were added in PHP 5. In PHP 5, a
 lot of class handling changed. The PHP developers wanted PHP 4 code to
 work without errors, but wanted to encourage developers to use the new
 styles of coding, so introduced these new "error" types.

 The only problem is, SimplePie 1.2.x is the last branch to support PHP 4,
 so we can't take advantage of these new constructs. That poses the
 question though, why can't we make it work on both? In fact, we already do
 where we can. In PHP 5, `clone` was introduced to copy objects as opposed
 to using references. We use this in SP already if we can, but not all
 features can be implemented this way.

 Looking at the individual errors:

 * '''Pass-by-reference''': in PHP 5, the ability to pass an object in by
 reference to a function/method was changed to be part of the function
 definition/prototype. In SimplePie, we ''really'' want to pass objects by
 reference, since they're huge in terms of memory. In order to achieve this
 for PHP 4, we have to pass it by reference in the function call, but this
 gives an error (`E_DEPRECATED`) on PHP 5.

 * '''Dynamic methods called statically''': in PHP 4, classes have methods,
 and that's about as detailed as it gets. In PHP 5, the concept of
 visibility was introduced, in addition to static methods/properties.
 SimplePie uses a few classes (namely `SimplePie_Misc`) statically as
 essentially namespaces. By all rights, these methods should be declared
 static. The only problem is, this facility does not exist in PHP 4, so we
 can't implement it for both. Hence, to maintain compatibility with PHP 4,
 we ''have'' to leave it.

 Hopefully I've now established why SimplePie doesn't do it. The other part
 of the problem is, why hasn't SimplePie been changed? The answer to that
 is, it has. In the 1.3-dev version, we've completely thrown out all PHP 4
 compatibility and SimplePie uses a whole bunch of 5-only stuff
 (autoloading being my favourite). However, 1.3-dev isn't just for
 discarding PHP 4 compatibility, so as per any project, other features and
 bugs have been fixed. This means that the code is considered unstable
 until 1.3.0 has been released, hence why WordPress is not using it.

 So, that begs the final question: why haven't I released 1.3 yet? The
 answer to that one is simple: I haven't had time. Before I release it, I
 want to add more testing in (especially for regressions) and fix some more
 bugs in it. However, I'm studying a dual degree full time, in addition to
 attempting to launch a business while also doing freelance work. I also
 waste a lot of time (30 hours a week) on train rides where I can't do much
 except read/listen to podcasts. And on top of all that, SimplePie isn't
 the only library I develop.

 We've been aware of the lack of time that every developer has for
 SimplePie for a long time. The two previous lead developers both had to
 back out due to time constraints, and for a time, we even had to announce
 the SimplePie project as being dead due to lack of developer time. We've
 asked popular projects which use SimplePie (WordPress, Drupal, DokuWiki,
 and many, many others) if they'd be able to contribute some resources to
 helping out, but unfortunately we never had much of a response. (Matt did
 donate hosting for us, which was a great help.)

 None of this is any excuse of course, so I'm sorry for not being able to
 release SP 1.3.0. I don't like the way it is, but unfortunately I can't
 change it much at the moment.

 Of course, if you'd like to help, there's a
 [https://github.com/simplepie/simplepie/issues?direction=desc&milestone=5
 stack of issues] a mile long for 1.3.0 and any help there would be greatly
 appreciated.

 Thanks for your thoughts, and your time spent reading this. :)

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/20139#comment:6>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list