搜索

2010年6月2日星期三

THE BUGS, I FOUND IN PHP

THE BUGS, I FOUND IN PHP

This is a note about bugs, I found in PHP. The term 'Bug' here include program bugs, mistake in manual, and so on.
My Environment:
     PHP 5.2
     PEAR 1.6.1
     Ubuntu 8.04

'__autoload' Function Halt in Error/Exception Handler Function

Include all files referenced in user-defined error/exception handlers manually.
And for convenient, I repeat it below:
Description:
------------
If your script does as below step, it will cause autoload function halt:

1. You have set an user-defined error handler function.
2. A statement need autoload.
3. The __autoload function emit an error.
4. The user-defined error handler function need autoload.

Test script:
---------------

Expected result:
----------------
Should not emit any fatal error

Actual result:
--------------
Fatal error: Class 'Class_A' not found in /usr/share/php/PEAR.php on line 569

Call Stack:
    0.0002      60296   1. {main}() /home/winfred/workspace/Test/applications/Bugs/new/index.php:0
    0.0003      61216   2. __autoload() /home/winfred/workspace/Test/applications/Bugs/new/index.php:0
    0.0012     176604   3. error_handler() /home/winfred/workspace/Test/applications/Bugs/new/index.php:0

'PDO::MYSQL_ATTR_LOCAL_INFILE' Can be Set Only during PDO Object Initialization Progress

The manual says nothing about it, and if you set it with 'PDO::setAttribute', you will get a FALSE always.
I have this reported as 'Doc Bug #51960 PDO::MYSQL_ATTR_LOCAL_INFILE cause error always', and to solve it, you must set it during PDO object initialization progress. And also for convenient, I repeat it below:
Description:
------------
If you set PDO::MYSQL_ATTR_LOCAL_INFILE with PDO::setAttribute function, it will return FALSE, whatever you set it to TRUE or FALSE.

Test script:
---------------
// $pdo=new PDO(...);
$result=$pdo->setAttribute(PDO::MYSQL_ATTR_LOCAL_INFILE, FALSE);

// or you could try set it to TRUE, you will get the same. $result=FALSE

Expected result:
----------------
$result != FALSE

Actual result:
--------------
$result == FALSE

没有评论:

发表评论