Quantcast

ZF1 Backported autoloaders

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

ZF1 Backported autoloaders

holografix
Hi

I'm trying to use the new autoloaders from ZF 1.12.0 (RC2) but with no
success.

In index.php:  http://pastie.org/4155178

All I get is a blank page in apache logs there's this error:

[Tue Jun 26 16:31:26 2012] [error] [client 127.0.0.1]
PHP Fatal error:
Uncaught exception 'Zend_Loader_Exception_InvalidArgumentException' with
message 'Autoloader class "Zend_Loader_ClassMapAutoloader" not loaded'
in
/var/www/projects/projp/trunk/library/Zend/Loader/AutoloaderFactory.php:95
Stack trace:\n#0 /var/www/projects/projp/trunk/public/index.php(76):
Zend_Loader_AutoloaderFactory::factory(Array)
{main}  thrown in
/var/www/projects/projp/trunk/library/Zend/Loader/AutoloaderFactory.php on
line 95, referer: http://projp/

What could be the problem here?

TIA
holo
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: ZF1 Backported autoloaders

robertbasic
just last week I wrote about using the new autoloaders, give that a try:

http://robertbasic.com/blog/using-the-new-autoloaders-from-zend-framework-1-12</shameless-plug>
On 26 Jun 2012 18:18, "holografix ." <[hidden email]> wrote:

> Hi
>
> I'm trying to use the new autoloaders from ZF 1.12.0 (RC2) but with no
> success.
>
> In index.php:  http://pastie.org/4155178
>
> All I get is a blank page in apache logs there's this error:
>
> [Tue Jun 26 16:31:26 2012] [error] [client 127.0.0.1]
> PHP Fatal error:
> Uncaught exception 'Zend_Loader_Exception_InvalidArgumentException' with
> message 'Autoloader class "Zend_Loader_ClassMapAutoloader" not loaded'
> in
> /var/www/projects/projp/trunk/library/Zend/Loader/AutoloaderFactory.php:95
> Stack trace:\n#0 /var/www/projects/projp/trunk/public/index.php(76):
> Zend_Loader_AutoloaderFactory::factory(Array)
> {main}  thrown in
> /var/www/projects/projp/trunk/library/Zend/Loader/AutoloaderFactory.php on
> line 95, referer: http://projp/
>
> What could be the problem here?
>
> TIA
> holo
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: ZF1 Backported autoloaders

holografix
Thanks.
I've already read it and the code comes from your example but in my case it
doesn't work

Cheers
holo

2012/6/26 Robert Basic <[hidden email]>

>
> just last week I wrote about using the new autoloaders, give that a try:
>
>
> http://robertbasic.com/blog/using-the-new-autoloaders-from-zend-framework-1-12</shameless-plug>
> On 26 Jun 2012 18:18, "holografix ." <[hidden email]> wrote:
>
>> Hi
>>
>> I'm trying to use the new autoloaders from ZF 1.12.0 (RC2) but with no
>> success.
>>
>> In index.php:  http://pastie.org/4155178
>>
>> All I get is a blank page in apache logs there's this error:
>>
>> [Tue Jun 26 16:31:26 2012] [error] [client 127.0.0.1]
>> PHP Fatal error:
>> Uncaught exception 'Zend_Loader_Exception_InvalidArgumentException' with
>> message 'Autoloader class "Zend_Loader_ClassMapAutoloader" not loaded'
>> in
>> /var/www/projects/projp/trunk/library/Zend/Loader/AutoloaderFactory.php:95
>> Stack trace:\n#0 /var/www/projects/projp/trunk/public/index.php(76):
>> Zend_Loader_AutoloaderFactory::factory(Array)
>> {main}  thrown in
>> /var/www/projects/projp/trunk/library/Zend/Loader/AutoloaderFactory.php on
>> line 95, referer: http://projp/
>>
>> What could be the problem here?
>>
>> TIA
>> holo
>>
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: ZF1 Backported autoloaders

robertbasic
odd, that same code is running on that very site. give me an hour or so
till i get to my laptop and will double check it.
On 26 Jun 2012 20:25, "holografix ." <[hidden email]> wrote:

> Thanks.
> I've already read it and the code comes from your example but in my case it
> doesn't work
>
> Cheers
> holo
>
> 2012/6/26 Robert Basic <[hidden email]>
>
> >
> > just last week I wrote about using the new autoloaders, give that a try:
> >
> >
> >
> http://robertbasic.com/blog/using-the-new-autoloaders-from-zend-framework-1-12
> </shameless-plug>
> > On 26 Jun 2012 18:18, "holografix ." <[hidden email]> wrote:
> >
> >> Hi
> >>
> >> I'm trying to use the new autoloaders from ZF 1.12.0 (RC2) but with no
> >> success.
> >>
> >> In index.php:  http://pastie.org/4155178
> >>
> >> All I get is a blank page in apache logs there's this error:
> >>
> >> [Tue Jun 26 16:31:26 2012] [error] [client 127.0.0.1]
> >> PHP Fatal error:
> >> Uncaught exception 'Zend_Loader_Exception_InvalidArgumentException' with
> >> message 'Autoloader class "Zend_Loader_ClassMapAutoloader" not loaded'
> >> in
> >>
> /var/www/projects/projp/trunk/library/Zend/Loader/AutoloaderFactory.php:95
> >> Stack trace:\n#0 /var/www/projects/projp/trunk/public/index.php(76):
> >> Zend_Loader_AutoloaderFactory::factory(Array)
> >> {main}  thrown in
> >> /var/www/projects/projp/trunk/library/Zend/Loader/AutoloaderFactory.php
> on
> >> line 95, referer: http://projp/
> >>
> >> What could be the problem here?
> >>
> >> TIA
> >> holo
> >>
> >
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: ZF1 Backported autoloaders

robertbasic
It's a change between RC1 and RC2, looking into it now.

On 26 June 2012 20:31, Robert Basic <[hidden email]> wrote:

> odd, that same code is running on that very site. give me an hour or so till
> i get to my laptop and will double check it.
>
> On 26 Jun 2012 20:25, "holografix ." <[hidden email]> wrote:
>>
>> Thanks.
>> I've already read it and the code comes from your example but in my case
>> it
>> doesn't work
>>
>> Cheers
>> holo
>>
>> 2012/6/26 Robert Basic <[hidden email]>
>>
>> >
>> > just last week I wrote about using the new autoloaders, give that a try:
>> >
>> >
>> >
>> > http://robertbasic.com/blog/using-the-new-autoloaders-from-zend-framework-1-12</shameless-plug>
>> > On 26 Jun 2012 18:18, "holografix ." <[hidden email]> wrote:
>> >
>> >> Hi
>> >>
>> >> I'm trying to use the new autoloaders from ZF 1.12.0 (RC2) but with no
>> >> success.
>> >>
>> >> In index.php:  http://pastie.org/4155178
>> >>
>> >> All I get is a blank page in apache logs there's this error:
>> >>
>> >> [Tue Jun 26 16:31:26 2012] [error] [client 127.0.0.1]
>> >> PHP Fatal error:
>> >> Uncaught exception 'Zend_Loader_Exception_InvalidArgumentException'
>> >> with
>> >> message 'Autoloader class "Zend_Loader_ClassMapAutoloader" not loaded'
>> >> in
>> >>
>> >> /var/www/projects/projp/trunk/library/Zend/Loader/AutoloaderFactory.php:95
>> >> Stack trace:\n#0 /var/www/projects/projp/trunk/public/index.php(76):
>> >> Zend_Loader_AutoloaderFactory::factory(Array)
>> >> {main}  thrown in
>> >> /var/www/projects/projp/trunk/library/Zend/Loader/AutoloaderFactory.php
>> >> on
>> >> line 95, referer: http://projp/
>> >>
>> >> What could be the problem here?
>> >>
>> >> TIA
>> >> holo
>> >>
>> >



--
~Robert Basic;
http://robertbasic.com/

--
List: [hidden email]
Info: http://framework.zend.com/archives
Unsubscribe: [hidden email]


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: ZF1 Backported autoloaders

robertbasic
As of ZF 1.12.0RC2 the Zend prefix is not autoregistered with the
standard autoloader, so the AutoloaderFactory can't find the
ClassMapAutoloader.php file.

2 possible fixes: include explicitly the ClassMapAutoloader.php, or,
in the AutoloaderFactory options, include the StandardAutoloader as
the first, and the ClassMapAutoloader as the second loader.

I went with the first option and have updated my post accordingly:
http://robertbasic.com/blog/using-the-new-autoloaders-from-zend-framework-1-12

HTH!

--
~Robert Basic;
http://robertbasic.com/

--
List: [hidden email]
Info: http://framework.zend.com/archives
Unsubscribe: [hidden email]


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: ZF1 Backported autoloaders

weierophinney
Administrator
-- Robert Basic <[hidden email]> wrote
(on Tuesday, 26 June 2012, 09:56 PM +0200):

> As of ZF 1.12.0RC2 the Zend prefix is not autoregistered with the
> standard autoloader, so the AutoloaderFactory can't find the
> ClassMapAutoloader.php file.
>
> 2 possible fixes: include explicitly the ClassMapAutoloader.php, or,
> in the AutoloaderFactory options, include the StandardAutoloader as
> the first, and the ClassMapAutoloader as the second loader.
>
> I went with the first option and have updated my post accordingly:
> http://robertbasic.com/blog/using-the-new-autoloaders-from-zend-framework-1-12

Putting the StandardAutoloader first means it will trigger first,
negating the speed factor of the ClassMapAutoloader. As such, I'd go for
the first option, explicitly requiring the ClassMapAutoloader.php file.

--
Matthew Weier O'Phinney
Project Lead            | [hidden email]
Zend Framework          | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc

--
List: [hidden email]
Info: http://framework.zend.com/archives
Unsubscribe: [hidden email]


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: ZF1 Backported autoloaders

robertbasic
On 26 June 2012 22:14, Matthew Weier O'Phinney <[hidden email]> wrote:

> -- Robert Basic <[hidden email]> wrote
> (on Tuesday, 26 June 2012, 09:56 PM +0200):
>> As of ZF 1.12.0RC2 the Zend prefix is not autoregistered with the
>> standard autoloader, so the AutoloaderFactory can't find the
>> ClassMapAutoloader.php file.
>>
>> 2 possible fixes: include explicitly the ClassMapAutoloader.php, or,
>> in the AutoloaderFactory options, include the StandardAutoloader as
>> the first, and the ClassMapAutoloader as the second loader.
>>
>> I went with the first option and have updated my post accordingly:
>> http://robertbasic.com/blog/using-the-new-autoloaders-from-zend-framework-1-12
>
> Putting the StandardAutoloader first means it will trigger first,
> negating the speed factor of the ClassMapAutoloader. As such, I'd go for
> the first option, explicitly requiring the ClassMapAutoloader.php file.
>

But setting it as the "fallback_autoloader" means it should kick in
last, no matter when it's added, no? At least that's what I figured
out when trying it. But anyway, I'm going with the explicit
require_once call, much easier.

--
List: [hidden email]
Info: http://framework.zend.com/archives
Unsubscribe: [hidden email]


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: ZF1 Backported autoloaders

holografix
Thank you very much. It's working now.

Cheers
holo

2012/6/26 Robert Basic <[hidden email]>

> On 26 June 2012 22:14, Matthew Weier O'Phinney <[hidden email]> wrote:
> > -- Robert Basic <[hidden email]> wrote
> > (on Tuesday, 26 June 2012, 09:56 PM +0200):
> >> As of ZF 1.12.0RC2 the Zend prefix is not autoregistered with the
> >> standard autoloader, so the AutoloaderFactory can't find the
> >> ClassMapAutoloader.php file.
> >>
> >> 2 possible fixes: include explicitly the ClassMapAutoloader.php, or,
> >> in the AutoloaderFactory options, include the StandardAutoloader as
> >> the first, and the ClassMapAutoloader as the second loader.
> >>
> >> I went with the first option and have updated my post accordingly:
> >>
> http://robertbasic.com/blog/using-the-new-autoloaders-from-zend-framework-1-12
> >
> > Putting the StandardAutoloader first means it will trigger first,
> > negating the speed factor of the ClassMapAutoloader. As such, I'd go for
> > the first option, explicitly requiring the ClassMapAutoloader.php file.
> >
>
> But setting it as the "fallback_autoloader" means it should kick in
> last, no matter when it's added, no? At least that's what I figured
> out when trying it. But anyway, I'm going with the explicit
> require_once call, much easier.
>
> --
> List: [hidden email]
> Info: http://framework.zend.com/archives
> Unsubscribe: [hidden email]
>
>
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: ZF1 Backported autoloaders

weierophinney
Administrator
In reply to this post by robertbasic
-- Robert Basic <[hidden email]> wrote
(on Tuesday, 26 June 2012, 10:21 PM +0200):

> On 26 June 2012 22:14, Matthew Weier O'Phinney <[hidden email]> wrote:
> > -- Robert Basic <[hidden email]> wrote
> > (on Tuesday, 26 June 2012, 09:56 PM +0200):
> > > As of ZF 1.12.0RC2 the Zend prefix is not autoregistered with the
> > > standard autoloader, so the AutoloaderFactory can't find the
> > > ClassMapAutoloader.php file.
> > >
> > > 2 possible fixes: include explicitly the ClassMapAutoloader.php, or,
> > > in the AutoloaderFactory options, include the StandardAutoloader as
> > > the first, and the ClassMapAutoloader as the second loader.
> > >
> > > I went with the first option and have updated my post accordingly:
> > > http://robertbasic.com/blog/using-the-new-autoloaders-from-zend-framework-1-12
> >
> > Putting the StandardAutoloader first means it will trigger first,
> > negating the speed factor of the ClassMapAutoloader. As such, I'd go for
> > the first option, explicitly requiring the ClassMapAutoloader.php file.
>
> But setting it as the "fallback_autoloader" means it should kick in
> last, no matter when it's added, no? At least that's what I figured
> out when trying it. But anyway, I'm going with the explicit
> require_once call, much easier.

"fallback_autoloader" means that if it is passed a class that doesn't
match one of the registered namespaces or vendor prefixes, it will try
to load it via the include_path, using PSR-0 rules. Nothing to do with
kicking in last. :)

--
Matthew Weier O'Phinney
Project Lead            | [hidden email]
Zend Framework          | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc

--
List: [hidden email]
Info: http://framework.zend.com/archives
Unsubscribe: [hidden email]


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: ZF1 Backported autoloaders

Kuzma
This post has NOT been accepted by the mailing list yet.
This post was updated on .
Hello!
I've followed instructions in Robert's provided example(updated my working project), but I'm getting errors:
Warning: require_once(C:\...\htdocs\test\library\C:\...htdocs\test\library\Zend\Config\Ini.php) [function.require-once]: failed to open stream: Invalid argument in C:\...\test\library\Zend\Loader\ClassMapAutoloader.php on line 148

Fatal error: require_once() [function.require]: Failed opening required 'C:\...\test\library\C:\Program Files (x86)\Zend\Apache2\htdocs\test\library\Zend\Config\Ini.php' (include_path='C:\...test\library;.;C:\...ZendServer\share\ZendFramework\library') in C:\...test\library\Zend\Loader\ClassMapAutoloader.php on line 148

As I understood the problem occurs of this line: $application = new Zend_Application(APPLICATION_ENV,    APPLICATION_PATH . '/configs/application.ini');
How correctly fix it?

Any help would be appreciated!

My public.php:
<?php
defined('APPLICATION_PATH')
    || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));

defined('APPLICATION_ENV')
    || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));

set_include_path(implode(PATH_SEPARATOR, array(  
    realpath(APPLICATION_PATH . '/../library'),  
    get_include_path(),  
)));  
require_once '../library/Zend/Loader/AutoloaderFactory.php';  
require_once '../library/Zend/Loader/ClassMapAutoloader.php';  
Zend_Loader_AutoloaderFactory::factory(  
    array(  
        'Zend_Loader_ClassMapAutoloader' => array(  
            __DIR__ . '/../library/autoload_classmap.php'
        ),  
        'Zend_Loader_StandardAutoloader' => array(  
            'prefixes' => array(  
                'Zend' => __DIR__ . '/../library/Zend'  
            ),  
            'fallback_autoloader' => true  
        )  
    )  
);

require_once 'Zend/Application.php';

$application = new Zend_Application(
    APPLICATION_ENV,
    APPLICATION_PATH . '/configs/application.ini'
);
$application->bootstrap()->run();
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: ZF1 Backported autoloaders

Kuzma
This post has NOT been accepted by the mailing list yet.
No thoughts at all?
Loading...