Home > Tips & tricks > Programming > PHP: Zend_Application and not working ressources
PHP: Zend_Application and not working ressources PDF Print E-mail
Written by Administrator   
Tuesday, 30 June 2009 23:01

If you use PHP and Zend Framwork, you may use Zend_Application, a marvelous componant that appeared in the 1.8 version of the framework.

I just did some tests with it, and more precisely with ressources like translate and db. I had problem with the db ressource: no Zend_Adapter was initialised and thus, no adapter were set as the default one for Zend_DB_Table. It took me an hour of debugging to find the reason because I had just done a copy/paste from the reference guide and my application.ini was identical !

Well, in fact, the problem was the copy / paste: a invisible but bad caracters (160) was inserted between "resources.db.adapter" and "=". So the option "adapter" was in fact read as something like "adapter " (notice the space at the end) in PHP. And if you take a look at how ressource's plugins work, you will see that the option "adapter" is concatenated with "set" to make a call to a method named "setadapter()". Unfortunately, no error nor exception is thrown if the method does not exists. SO in my case the framework searched for "setadapter ()" which was not existant. So all dbAdapter intialisation was silently ignored...

I hope this could help someone somewhere ;) 

Last Updated on Tuesday, 30 June 2009 23:18
 

Add your comment

Your name:
Your email:
Comment:
  The word for verification. Lowercase letters only with no spaces.
Word verification:
 
Original design by i-cons.ch / namibia-forum.ch