ZF-7491: Zend_Db_Select issues after upgrading to PHP 5.3

Description

On PHP5.2, if you do a simple select:


$oQuery = $oDB->select();
$oQuery->from('table1', '*');
$oQuery->joinLeft(array('table2'), 'table1.id=table2.id');

This will get assembled as: SELECT table1.*, table2.* FROM table1 LEFT JOIN table2 ON table1.id=table2.id

On PHP5.3 it assembles as: SELECT table1.*, table2.* FROM table1 LEFT JOIN Array.`` AS table2 ON table1.id=table2.id

The issue is on lines 785 / 787 of Zend/Db/Select.php, prior to PHP5.3 strpos returned false if the argument was not a string or not found, now it returns null if the first argument is not a string.

The patch to get it working is to add a !is_array to the if:


if (!is_object($tableName) && !is_array($tableName) && false !== strpos($tableName, '.')) {
    list($schema, $tableName) = explode('.', $tableName);
}

Comments

Test added with r19153 But cannot reproduce Do you have your own extension of Zend_Db_Select? Please reopen if necessary with more informations about environment (OS, PHP, RDBMS version)