Anyone have any ideas? I've been playing around with this all day and can't seem to nudge into working. If I can't figure it out, I'll just skip using the autoloader here and write my own method, but I don't want to duplicate code.
FYI, we used this method in another project, and it worked fine. On Wed, Nov 4, 2009 at 8:38 PM, A.J. Brown <fynw...@gmail.com> wrote: > FYI, I just upgraded to 1.9.5 and the problem continues. Keep in mind, > despite the exception/error, the form still constructs and renders as > CP_Form_Login just fine. > > > > Zend_Exception: File "CP/Form/Login.php" does not exist or class > "CP_Form_Login" was not found in the file in > /home/ajbrown/Projects/CitationPoint2/library/Zend/Loader.php on line > 88 > > # Time Memory Function Location > 1 0.0003 112872 {main}( ) ../index.php:0 > 2 0.0472 4886480 Zend_Application->run( ) ../index.php:34 > 3 0.0472 4886480 Zend_Application_Bootstrap_Bootstrap->run( > ) ../Application.php:358 > 4 0.0473 4886480 Zend_Controller_Front->dispatch( ???, ??? ) > ../Bootstrap.php:77 > 5 0.0643 6773728 Zend_Controller_Dispatcher_Standard->dispatch( > object(Zend_Controller_Request_Http)[19], > object(Zend_Controller_Response_Http)[20] ) ../Front.php:946 > 6 0.0777 7803104 Zend_Controller_Action->dispatch( string(11) > ) ../Standard.php:289 > 7 0.0778 7810384 AccountController->loginAction( ) > ../Action.php:513 > 8 0.0870 8940840 CP_Form::factory( string(5) ) > ../AccountController.php:22 > 9 0.0870 8940968 CP_Form::_declareFormClass( string(5) ) ../Form.php:44 > 10 0.0871 8942096 Zend_Loader_Autoloader::autoload( string(13) ) > ../Form.php:74 > 11 0.0872 8944096 call_user_func ( array(2), string(13) ) > ../Autoloader.php:130 > 12 0.0872 8944336 Zend_Loader_Autoloader->_autoload( string(13) > ) ../Autoloader.php:0 > 13 0.0872 8944920 call_user_func ( array(2), string(13) ) > ../Autoloader.php:472 > 14 0.0873 8945288 Zend_Loader::loadClass( string(13), ??? ) > ../Autoloader.php:0 > > > On Wed, Nov 4, 2009 at 11:31 AM, A.J. Brown <fynw...@gmail.com> wrote: >> Just incase it's useful somehow, here's the full config: >> >> http://www.pastie.org/683340 >> >> By the way, I'm aware that I shouldn't be registering Doctrine's >> namespace and instead should push the Doctrine autoloader. I'm just >> doing this temporarily until we begin actually leveraging doctrine. >> >> Here is the complete code of the class that's giving me trouble: >> >> http://www.pastie.org/683348 >> >> And here's the complete source of the controller where that code is being >> run: >> >> http://www.pastie.org/683344 >> >> On Wed, Nov 4, 2009 at 11:22 AM, A.J. Brown <fynw...@gmail.com> wrote: >>> Hey Matthew, >>> >>> Thanks for the explanation. I assumed since the error had >>> "Zend_Exception" in it, that it was actually an exception being >>> thrown. >>> >>> Zend_Version::VERSION == '1.9.3' >>> >>> The code in the pastie is literally the only code that ever does >>> anything with the autoloader. This is a new project, and other than >>> some boilerplate controller code, this is the first few lines of code >>> that have been typed. The only other modifications are adding the >>> namespaces to the autoloader, using the built-in method through the >>> application configuration: >>> >>> >>> autoloaderNamespaces.cp = "CP_" >>> autoloaderNamespaces.doctrine = "Doctrine_" >>> >>> >>> It's also strange that the error is not being suppressed by the @ symbol. >>> >>> >>> On Wed, Nov 4, 2009 at 8:57 AM, Matthew Weier O'Phinney >>> <matt...@zend.com> wrote: >>>> -- A.J. Brown <a...@ajbrown.org> wrote >>>> (on Tuesday, 03 November 2009, 07:59 PM -0500): >>>>> I'm trying to supress errors with the Zend Autoloader, but it's still >>>>> throwing them. In this specific case, I'm dynamically ceating a class >>>>> if it doesn't already exist. I'm calling suppressNotFoundWarnings( >>>>> true ). >>>>> >>>>> Here's my code: >>>>> >>>>> http://www.pastie.org/682603 >>>>> >>>>> On line 13, I'm getting a Zend_Exception saying that CP/Form/Login.php >>>>> not found and CP_Form_Login does not exist. Here's that line: >>>>> >>>>> if( @$autoloader->autoload( $class ) ) { >>>>> >>>>> even wrapping it in a Try/Catch doesn't catch the exception. The best >>>>> part is that further down in the code, the class is still declared, >>>>> and the code continues to run. >>>>> >>>>> the CP_ namespace is registered to the autoloader at bootstrap. (I >>>>> confirmed this through debugging). >>>> >>>> You're confusing exceptions with errors. Zend_Loader_Autoloader does not >>>> throw exceptions within its autoload() method (it's considered a bad >>>> practice, and PHP itself behaves badly when it happens); this is why the >>>> try/catch does not work. What's actually happening is that PHP's >>>> include() function is raising a PHP warning when it can't find the >>>> related file in question. >>>> >>>> What *is* odd to me is that the autoloader is not suppressing the errors >>>> when you've specifically requested it do so. I've just tried this >>>> locally with the following: >>>> >>>> >>>> $autoloader->suppressNotFoundWarnings(true); >>>> if (!$autoloader->autoload('Zend_Foo_Bar')) { >>>> echo 'Not found'; >>>> exit; >>>> } >>>> echo 'Found'; >>>> >>>> With the warnings suppressed, it works as expected; without, I get >>>> the PHP warning, again, as expected. >>>> >>>> So, a few questions: >>>> >>>> * What version of ZF are you using? >>>> * Can you provide *all* code indicating how you've configured the >>>> autoloader? >>>> * Is the "CP_" namespace registered with the autoloader? If not, do you >>>> have another autoloader registered that would be handling it? >>>> >>>> Based on what you've presented, I have to assume that there's some other >>>> configuration issue that's leading to the error. >>>> >>>> -- >>>> Matthew Weier O'Phinney >>>> Project Lead | matt...@zend.com >>>> Zend Framework | http://framework.zend.com/ >>>> >>> >>> >>> >>> -- >>> A.J. Brown >>> web | http://ajbrown.org >>> phone | (937) 660-3969 >>> >> >> >> >> -- >> A.J. Brown >> web | http://ajbrown.org >> phone | (937) 660-3969 >> > > > > -- > A.J. Brown > web | http://ajbrown.org > phone | (937) 660-3969 > -- A.J. Brown web | http://ajbrown.org phone | (937) 660-3969