Zend Framework

Zend_Db_Select issues after upgrading to PHP 5.3

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: N/A N/A
  • Resolution: Cannot Reproduce
  • Affects Version/s: 1.9.0
  • Fix Version/s: 1.9.6
  • Component/s: Zend_Db_Select
  • Labels:
    None

Description

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

example.php
$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:

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

Activity

Hide
Mickael Perraud added a comment -

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)

Show
Mickael Perraud added a comment - 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)

People

Vote (1)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: