New PDO bug introduced in PHP 5.2.12 and 5.3.1

6 views
Skip to first unread message

Matt Read

unread,
Jan 14, 2010, 8:14:35 PM1/14/10
to habar...@googlegroups.com
A few of us have started an open letter to PHP's PDO/Core dev team,
regarding a recent change (now a bug) to PDO. Here is the letter so far.
Feel free to add any thoughts, and sign your name to it, if you like.
(also please use "worldly" spelling ;) )

...

We are developers from the Habari Project, an open source PHP blogging
application; We would like to raise concern with a recent change to the
logic of PDO.

We believe that PHP's revision 290786 should not have been committed
(see bug 49521). This changed the behaviour of PDO so that an object's
constructor is called before the properties from the database fields are
set.

The behaviour requested in bug 49521 was possible already with
PDO_FETCH_PROPS_LATE, and indeed this commit renders that flag
completely useless. You should also note that this flag is still
checked, for no apparent reason, in the code.

Several PHP tickets about the same issue have been closed as bogus
before this one was committed. See 43717 and 37134, especially the
closing comment on the latter, "This is expected, to allow people to
access the data from the query within the [constructor] ..."

Unfortunately this commit has now made into two releases, 5.2.12 and
5.3.1, and has broken our software. We relied on the behaviour (the
expected behaviour) to have properties set (using magic __set) before
the constructor was called, to determine what data came from the DB, and
what data has been updated since.

Revision 290786 seems to have been committed with insufficient thought
put in to what was being done, especially given that it was committed
only 4 days before release. Now we don't have a choice in how PDO
constructs objects, as we did before with the FETCH_PROPS_LATE flag.
There were even tests checking that the constructor was called last, the
tests were changed rather than questioning whether the existing
behaviour was correct. Not to mention a significant behavioural change
to PDO being pushed into a minor release, again, 4 days before release.

Part of the problem is that it doesn't seem well documented (if at all)
that setting the properties before calling the contructor is the
intended and correct behaviour. Or rather, was.

Thanks kindly,

Matt Read
Michael Twofish
Richard Cockrum
Luke Giuliani


Rich Bowen

unread,
Jan 14, 2010, 8:22:11 PM1/14/10
to habar...@googlegroups.com
There's not a lot of value in spending a lot of time word-smithing
this. It's good as is, and should go to the php-dev list sooner,
rather than later. The note is well-documented, and the fact that the
patch has been rejected in two previous bug tickets is pretty
compelling.

> --
> To post to this group, send email to habar...@googlegroups.com
> To unsubscribe from this group, send email to habari-dev-...@googlegroups.com
> For more options, visit this group at http://groups.google.com/group/habari-dev

--
Rich Bowen
rbo...@rcbowen.com

Scott Merrill

unread,
Jan 14, 2010, 9:42:18 PM1/14/10
to habar...@googlegroups.com
On Thu, Jan 14, 2010 at 8:14 PM, Matt Read <ma...@mattread.com> wrote:
> A few of us have started an open letter to PHP's PDO/Core dev team,
> regarding a recent change (now a bug) to PDO. Here is the letter so far.
> Feel free to add any thoughts, and sign your name to it, if you like.
> (also please use "worldly" spelling ;) )

+1. I second Rich's comments: send this sooner, rather than later, to
ensure the wider discussion gets started.

Chris J. Davis

unread,
Jan 14, 2010, 11:26:57 PM1/14/10
to habar...@googlegroups.com
Same here, looks fine to me, shoot it off.

Andy C

unread,
Jan 15, 2010, 3:15:53 AM1/15/10
to habari-dev
Technical content looks fine.

I would correct Michael's surname though which conflicts with the
professional tone of the letter.

On Jan 15, 4:26 am, "Chris J. Davis" <chrisdmi...@gmail.com> wrote:
> Same here, looks fine to me, shoot it off.
>
>
>
> On Thu, Jan 14, 2010 at 8:42 PM, Scott Merrill <ski...@skippy.net> wrote:

Michael C. Harris

unread,
Jan 15, 2010, 3:39:33 AM1/15/10
to habar...@googlegroups.com
2010/1/15 Andy C <andy...@gmail.com>:

> Technical content looks fine.
>
> I would correct Michael's surname though which conflicts with the
> professional tone of the letter.

Ha! I didn't even notice :)

--
Michael C. Harris, School of CS&IT, RMIT University
http://twofishcreative.com/michael/blog
IRC: michaeltwofish #habari

Matt Read

unread,
Jan 15, 2010, 9:29:26 AM1/15/10
to habar...@googlegroups.com
Oh yeah I forgot. You used to be Premier of Ontario.

> --
> To post to this group, send email to habar...@googlegroups.com
> To unsubscribe from this group, send email to habari-dev-...@googlegroups.com
> For more options, visit this group at http://groups.google.com/group/habari-dev
>

--
Matt Read
http://mattread.info
http://mattread.com

Reply all
Reply to author
Forward
0 new messages