Zend Framework

Zend_Db::factory normalizes characters in namespace, so ZendX libraries are not found

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: N/A N/A
  • Resolution: Fixed
  • Affects Version/s: 1.7.3
  • Fix Version/s: 1.9.3
  • Component/s: Zend_Db
  • Labels:
    None

Description

on line 240:
$adapterName = strtolower($adapterNamespace . '_' . $adapter);
$adapterName = str_replace(' ', '', ucwords(str_replace('', ' ', $adapterName)));

This code make ZendX_Db_Adapter_Firebird to become Zendx_Db_Adapter, which can't be found on Linux...

Also problem for user's Db libraries.

Now can be soluted by using standard inicialization without ::factory() method, but it is a bug....

Issue Links

Activity

Hide
Tobias Petry added a comment -

Have got the same problem:
a self defined Db adapter has to be used, but the namespace has 3 big letters (abbreviation of the project's name)

Show
Tobias Petry added a comment - Have got the same problem: a self defined Db adapter has to be used, but the namespace has 3 big letters (abbreviation of the project's name)
Hide
Dariusz Sierakowski added a comment -

This my proposed for issue this bug

Show
Dariusz Sierakowski added a comment - This my proposed for issue this bug
Hide
Ralph Schindler added a comment -

Fixed in trunk in r18328 and in release 1.9 branch at 18329

Show
Ralph Schindler added a comment - Fixed in trunk in r18328 and in release 1.9 branch at 18329
Hide
Marc Peterson added a comment -

This patch doesn't create the adapter name properly. Say if you're using PDO_MYSQL you end up looking for Zend_Db_Adapter_PDO_MYSQL, in directory Zend/Db/Adapter/PDO/MYSQL.php. This doesn't exist in case-sensitive operating systems.

You have to strtolower() the adapter before using ucwords() on it, for example:
line 247: $adapterName .= str_replace(' ', '', ucwords(strtolower(str_replace('', ' ', $adapter))));

Show
Marc Peterson added a comment - This patch doesn't create the adapter name properly. Say if you're using PDO_MYSQL you end up looking for Zend_Db_Adapter_PDO_MYSQL, in directory Zend/Db/Adapter/PDO/MYSQL.php. This doesn't exist in case-sensitive operating systems. You have to strtolower() the adapter before using ucwords() on it, for example: line 247: $adapterName .= str_replace(' ', '', ucwords(strtolower(str_replace('', ' ', $adapter))));
Hide
Marc Peterson added a comment -

Never mind, looks like that's the whole point of this patch. Beware that there are lots of examples out there using all-uppercase adapter names in one's application.ini file. This may break a few projects.

Show
Marc Peterson added a comment - Never mind, looks like that's the whole point of this patch. Beware that there are lots of examples out there using all-uppercase adapter names in one's application.ini file. This may break a few projects.

People

Vote (1)
Watch (4)

Dates

  • Created:
    Updated:
    Resolved: