Re: [PDO] PDO_FIREBIRD patch to improve firebird_handle_get_attribute

[email protected] (Felipe Pena) Tue, 16 Nov 2010 23:47:38 -0200
Newsgroups php.pdo
Message-ID <[email protected]>
--001636c92509eb94d4049535dc8c
Content-Type: text/plain; charset=UTF-8

Hi,

2010/11/16 Paul Reeves <[email protected]>

>
> There is a bug and a few omissions  in firebird_handle_get_attribute.
>
> Most significantly it declares tmp[200] which is used to store the server
> version. Unfortunately, a typical server version string is now over 300
> bytes
> long. So this call just blows the driver out of the water, leaves this
> error
> in the apache log:
>
> *** stack smashing detected ***: /usr/sbin/httpd2-prefork terminated
> [Tue Nov 16 13:42:53 2010] [notice] child pid 11656 exit signal
> Segmentation
> fault (11)
>
> and the user is staring at a server timeout error in the browser. This is
> easily fixed by declaring tmp[]  to be larger.
>
>
Fixed. (bug #53323)


> Less seriously, these attributes are not handled:
>
>  PDO_ATTR_PREFETCH,
>  PDO_ATTR_TIMEOUT,
>  PDO_ATTR_FETCH_TABLE_NAMES
>
> so if they are called outside a try..catch then the call will fail badly.
> It
> is not obvious that a try..catch should be required so it is probably
> better
> to just hand these cases in the driver.
>
> I've attached a patch which fixes all of these issues.
>
>
This is the intended behavior of the PDO drivers, if it does not supports an
attribute, then must return zero, not issue an error message itself.


Thanks.

-- 
Regards,
Felipe Pena

--001636c92509eb94d4049535dc8c--