Quantcast

Zend_Config

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

Zend_Config

Aycko Maerzke
I've tested the Zend_Config class, but the following code throws an
exception:

Code:

$config = new Zend_Config(Zend_Config_Ini::load('../application/config.ini',
'develop'));

Exception:

File "Countable.php" was not found.


I can't find the file in the ZF directory, but it's needed because
Zend_Config implents Countable.
How can i solve this problem? Any solution?


Best regards
Aycko


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

Re: Zend_Config

Martel
Aycko Maerzke wrote:

> I can't find the file in the ZF directory, but it's needed because
> Zend_Config implents Countable.
> How can i solve this problem? Any solution?

It is a Standard PHP Library interface introduced in PHP 5.1:

http://www.php.net/~helly/php/ext/spl/interfaceCountable.html

You probably don't have SPL compiled in or you're using too old PHP version.

> Aycko

--
Michael Minicki aka Martel Valgoerad | [hidden email] | http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"Be careful about reading health books. You may die of a misprint." -- Mark
Twain
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Zend_Config

akrabat
Martel Valgoerad wrote:

> Aycko Maerzke wrote:
>
>> I can't find the file in the ZF directory, but it's needed because
>> Zend_Config implents Countable.
>> How can i solve this problem? Any solution?
>
> It is a Standard PHP Library interface introduced in PHP 5.1:
>
> http://www.php.net/~helly/php/ext/spl/interfaceCountable.html
>
> You probably don't have SPL compiled in or you're using too old PHP
> version.
>
>> Aycko
>

Countable is PHP5.1?

All my production servers are either 4.4 or 5.1 now and I didn't read
the documentation properly.

Sorry :(

I'll have to remove that interface from the class to maintain 5.0
compatibility.

As a workaround, you should be able to just change line 35 of
library/Zend/Config.php

from:
    class Zend_Config implements Countable, Iterator
to:
    class Zend_Config implements Iterator


and it ought to work...

Regards,

Rob...

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

Re: Zend_Config

Martel
Rob Allen wrote:

> Countable is PHP5.1?

That's what it says under the interface description ;)

> All my production servers are either 4.4 or 5.1 now and I didn't read
> the documentation properly.
>
> Sorry :(
>
> I'll have to remove that interface from the class to maintain 5.0
> compatibility.

Well, you could do this instead for the time being:

if (!interface_exists('Countable')) {
    interface Countable {
        public function count();
    }
}

Not tested it myself but it should work as expected.

> Rob...

--
Michael Minicki aka Martel Valgoerad | [hidden email] | http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"To err is human -- and to blame it on a computer is even more so." -- Robert
Orben
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Zend_Config

akrabat
Martel Valgoerad wrote:

> Well, you could do this instead for the time being:
>
> if (!interface_exists('Countable')) {
>    interface Countable {
>        public function count();
>    }
> }
>
> Not tested it myself but it should work as expected.
>

That's a good idea, Martel!

Regards,

Rob...

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

Re: Zend_Config - Requires PHP 5.1?

Art Hundiak
In reply to this post by akrabat
I thought it was decided some time ago that PHP 5.1 or greater was
required for ZF?  I know there was some emails on it.  Maintaining
compatibility with 5.0 will be difficult.

Might need to update the road map page.

>
> Martel Valgoerad wrote:
>> Aycko Maerzke wrote:
>>
>>> I can't find the file in the ZF directory, but it's needed because
>>> Zend_Config implents Countable.
>>> How can i solve this problem? Any solution?
>>
>> It is a Standard PHP Library interface introduced in PHP 5.1:
>>
>> http://www.php.net/~helly/php/ext/spl/interfaceCountable.html
>>
>> You probably don't have SPL compiled in or you're using too old PHP
>> version.
>>
>>> Aycko
>>
>
> Countable is PHP5.1?
>
> All my production servers are either 4.4 or 5.1 now and I didn't read
> the documentation properly.
>
> Sorry :(
>
> I'll have to remove that interface from the class to maintain 5.0
> compatibility.
>
> As a workaround, you should be able to just change line 35 of
> library/Zend/Config.php
>
> from:
>     class Zend_Config implements Countable, Iterator
> to:
>     class Zend_Config implements Iterator
>
>
> and it ought to work...
>
> Regards,
>
> Rob...
>
>


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

Re: Zend_Config

Martel
In reply to this post by akrabat
Rob Allen wrote:

>> Not tested it myself but it should work as expected.
> That's a good idea, Martel!

One more thing Rob. Remember that all *_exists functions are trying to load a
class/interface/whatever, so it probably would be a good idea to include false
as a second parameter.

And take notice interface_exists was introduced with PHP 5.0.2 so it will only
  be 5.0.x compliant with that fix :)

I think Zend should bump the requirement of ZF a bit higher. Framework is
still in early development stage so such strict constraint makes no sense to
me. Or is it 5.1 already as Art mentioned in his mail?

> Rob...

--
Michael Minicki aka Martel Valgoerad | [hidden email] | http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"Rudeness is the weak man's imitation of strength." -- Eric Hoffer
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Zend_Config - Requires PHP 5.1?

Nick Lo
In reply to this post by Art Hundiak
I  also thought there had been talk about the new requirement being  
5.1 and was just looking at the installation requirements...

http://framework.zend.com/faq/installation

...which still say 5.0.

My, albeit quick, list search showed hands raised for 5.1 in the  
thread "Zend_InputFilter_DateFormat or something..." but I cannot  
find an official announcement.

My hand is up for 5.1. Like most others, the host I work with  
completely skipped 5.0 anyway.

Nick

> I thought it was decided some time ago that PHP 5.1 or greater was
> required for ZF?  I know there was some emails on it.  Maintaining
> compatibility with 5.0 will be difficult.
>
> Might need to update the road map page.

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

Re: Zend_Config

André Hoffmann
In reply to this post by Martel
as far as i know zend already raised the requirements to 5.1, can't find the proof though.

On 7/6/06, Martel Valgoerad <[hidden email]> wrote:
Rob Allen wrote:

>> Not tested it myself but it should work as expected.
> That's a good idea, Martel!

One more thing Rob. Remember that all *_exists functions are trying to load a
class/interface/whatever, so it probably would be a good idea to include false
as a second parameter.

And take notice interface_exists was introduced with PHP 5.0.2 so it will only
  be 5.0.x compliant with that fix :)

I think Zend should bump the requirement of ZF a bit higher. Framework is
still in early development stage so such strict constraint makes no sense to
me. Or is it 5.1 already as Art mentioned in his mail?

> Rob...

--
Michael Minicki aka Martel Valgoerad | [hidden email] | http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"Rudeness is the weak man's imitation of strength." -- Eric Hoffer



--
best regards,
André Hoffmann
Germany
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Zend_Config

Katrina Niolet-2
I have an email from either Andi or Jayson somewhere in my inbox stating that it's 5.1 now (ill search for it later)

-----Original Message-----
From: "André Hoffmann" <[hidden email]>
Date: Thu, 6 Jul 2006 15:42:50
To:"Martel Valgoerad" <[hidden email]>
Cc:[hidden email]
Subject: Re: [fw-general] Zend_Config

as far as i know zend already raised the requirements to 5.1, can't find the proof though.


On 7/6/06, Martel Valgoerad <
[hidden email]: <mailto:[hidden email]> > wrote:Rob Allen wrote:

>> Not tested it myself but it should work as expected.
> That's a good idea, Martel!

One more thing Rob. Remember that all *_exists functions are trying to load a
class/interface/whatever, so it probably would be a good idea to include false
as a second parameter.

And take notice interface_exists was introduced with PHP 5.0.2 so it will only
  be 5.0.x compliant with that fix :)

I think Zend should bump the requirement of ZF a bit higher. Framework is
still in early development stage so such strict constraint makes no sense to
me. Or is it 5.1 already as Art mentioned in his mail?

> Rob...

--
Michael Minicki aka Martel Valgoerad | [hidden email]: <mailto:[hidden email]>  | http://aie.pl/martel.asc
: <http://aie.pl/martel.asc>
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"Rudeness is the weak man's imitation of strength." -- Eric Hoffer



--
 best regards,
André Hoffmann
Germany
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Zend_Config

Matthew Weier O'Phinney-2
In reply to this post by akrabat
On 7/6/06, Rob Allen <[hidden email]> wrote:

> Martel Valgoerad wrote:
> > Aycko Maerzke wrote:
> >
> >> I can't find the file in the ZF directory, but it's needed because
> >> Zend_Config implents Countable.
> >> How can i solve this problem? Any solution?
> >
> > It is a Standard PHP Library interface introduced in PHP 5.1:
> >
> > http://www.php.net/~helly/php/ext/spl/interfaceCountable.html
> >
> > You probably don't have SPL compiled in or you're using too old PHP
> > version.
> >
> >> Aycko
> >
>
> Countable is PHP5.1?

I ran into the same thing with Phly_Config a few weeks ago. Looking at
the SPL documentation (http://www.php.net/~helly/php/ext/spl/), you can
verify for each SPL class when it was added to PHP; Countable was 5.1.

That sort of info would be nice in the php.net manual; right now, most
of the SPL docs simply say 'CVS' for the PHP version. But that's a topic
for another list ;-)

> All my production servers are either 4.4 or 5.1 now and I didn't read
> the documentation properly.
>
> Sorry :(
>
> I'll have to remove that interface from the class to maintain 5.0
> compatibility.

My understanding is that the current ZF requirement is 5.1.4; perhaps
Gavin, Jayson, or Andi could clarify this authoritatively?


--
Matthew Weier O'Phinney
PHP Developer
Zend Technologies
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Zend_Config

Darby Felton
Yes, the current framework requirements have been approved to be bumped
up to PHP 5.1.4, though we have not yet made a formal announcement or
updated documentation AFAIK.

Best regards,
Darby

Matthew Weier O'Phinney wrote:

> On 7/6/06, Rob Allen <[hidden email]> wrote:
>> Martel Valgoerad wrote:
>> > Aycko Maerzke wrote:
>> >
>> >> I can't find the file in the ZF directory, but it's needed because
>> >> Zend_Config implents Countable.
>> >> How can i solve this problem? Any solution?
>> >
>> > It is a Standard PHP Library interface introduced in PHP 5.1:
>> >
>> > http://www.php.net/~helly/php/ext/spl/interfaceCountable.html
>> >
>> > You probably don't have SPL compiled in or you're using too old PHP
>> > version.
>> >
>> >> Aycko
>> >
>>
>> Countable is PHP5.1?
>
> I ran into the same thing with Phly_Config a few weeks ago. Looking at
> the SPL documentation (http://www.php.net/~helly/php/ext/spl/), you can
> verify for each SPL class when it was added to PHP; Countable was 5.1.
>
> That sort of info would be nice in the php.net manual; right now, most
> of the SPL docs simply say 'CVS' for the PHP version. But that's a topic
> for another list ;-)
>
>> All my production servers are either 4.4 or 5.1 now and I didn't read
>> the documentation properly.
>>
>> Sorry :(
>>
>> I'll have to remove that interface from the class to maintain 5.0
>> compatibility.
>
> My understanding is that the current ZF requirement is 5.1.4; perhaps
> Gavin, Jayson, or Andi could clarify this authoritatively?
>
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Zend_Config

akrabat
Darby Felton wrote:
> Yes, the current framework requirements have been approved to be bumped
> up to PHP 5.1.4, though we have not yet made a formal announcement or
> updated documentation AFAIK.
>
> Best regards,
> Darby
>

In that case, I'll leave the code as is :)

Regards,

Rob...

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

RewriteRouter problems

Matthew Ratzloff
I'm posting this to the list because I want to make sure I'm not doing
something wrong.

With the pre-rewriteBase RewriteRouter everything worked great for me, but
now that the rewriteBase stuff has been added I can't get it to work at
all.  This is using a version of the router I checked out just a couple
hours ago.

Here are some specific errors I'm getting (lines refer to RewriteRouter):

getCurrentRoute() on the root index throws this:

Fatal error: Uncaught exception 'Zend_Controller_Router_Exception' with
message 'Current route is not defined' [...] on line 84

The index page gives a warning:

Warning: strpos() [function.strpos]: Empty delimiter. [...] on line 63

And all routes (/controller/action, controller/action/key/value, special
routes defined with addRoute()) default to noRoute.  The traditional
routes work just fine with the original router.

And I'm not sure if this is how rewriteBase is supposed to work, but
getRewriteBase() returns the full web path (minus domain).  Manually
setting the rewriteBase with setRewriteBase() makes no difference.

Help?

-Matt

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

Re: Zend_Config - Requires PHP 5.1?

Mislav Marohnić
In reply to this post by Nick Lo
I am for 5.1 too, but remember that shared hosts still have problems upgrading to 5.1.x because cPanel only supports 5.0.x

We should have a poll for all to state their experiences with hosts :-/

-M

On 7/6/06, Nick Lo <[hidden email]> wrote:
My hand is up for 5.1. Like most others, the host I work with
completely skipped 5.0 anyway.

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

Re: RewriteRouter problems

Martel
In reply to this post by Matthew Ratzloff
Matthew Ratzloff wrote:

> And I'm not sure if this is how rewriteBase is supposed to work, but
> getRewriteBase() returns the full web path (minus domain).  Manually
> setting the rewriteBase with setRewriteBase() makes no difference.
> Help?

You have to be more specific, Matthew. Give me some examples of URLs and defined
routes which in your opinion should match but they don't. And tell me your PHP
version and your webserver name and version.

Were you setting custom rewriteBase with earlier version? If no, then set rewriteBase
to '/' and everything should be back to as it were before. If yes then show me how
you were (and are) instantiating and configuring the router.

PS: There were changes only to the rewriteBase, so it really shouldn't affect your
routes, Matt.

> -Matt

--
Martel Valgoerad aka Michal Minicki | [hidden email] | http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"Idleness is not doing nothing. Idleness is being free to do anything." --
Floyd Dell
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: RewriteRouter problems

Matthew Ratzloff
> You have to be more specific, Matthew. Give me some examples of URLs and
> defined routes which in your opinion should match but they don't. And
> tell me your PHP version and your webserver name and version.

PHP 5.1.1 running as a module on Apache 2.0.52, and if it helps, OS X 10.3
Server.  ;-)  It's a development server--I haven't had time to update them
recently ("recently" being used very loosely), but both should work fine.

Some URLs that don't work:

http://www.example.com/news/create (default route)
http://www.example.com/news/update/id/1 (default route)
http://www.example.com/news/1 (custom route)
http://www.example.com/news/update/1 (custom route)

In other words, any...

The first two work fine (as I would expect) when I comment out the
RewriteRouter stuff, including setRouter().  Code used to add the last two
items:

$router->addRoute(
    "News view",
    "news/:id",
    array(
        "controller" => "news",
        "action"     => "view",
        "id"         => NULL
    ),
    array("id", "\d+")
);
$router->addRoute(
    "News update",
    "news/update/:id",
    array(
        "controller" => "news",
        "action"     => "update",
        "id"         => NULL
    ),
    array("id", "\d+")
);

Again, even if the special routes didn't work, the base routes should at
least be working, right?

> Were you setting custom rewriteBase with earlier version? If no, then set
> rewriteBase to '/' and everything should be back to as it were before. If
> yes then show me how you were (and are) instantiating and configuring the
> router.

This morning I tried setting rewriteBase to "/", adding forward slashes to
the beginning of all mappings, and so on.  Nothing worked.

$router = new Zend_Controller_RewriteRouter();
// ...Add various routes, relying on default route to handle "classic"
routes...
$controller = Zend_Controller_Front::getInstance();
$controller->setControllerDirectory($controllersPath);
// ...Register plugins...
$controller->setRouter($router);
$controller->dispatch();

> PS: There were changes only to the rewriteBase, so it really shouldn't
> affect your routes, Matt.

Hmm, the old version of RewriteRouter I was using on another project
didn't contain rewriteBase and it worked great.  The bootstrap code was
literally copied from the same project and modified slightly.

I did notice that rewriteBase is being set to the complete path.  So if my
path is /news/update/id/3 the rewriteBase is the same.  If it's the index
page getRewriteBase() prints nothing.

The strpos() error seems to resemble the other strpos() errors from awhile
back.

Any ideas?  :-(

-Matt

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

Re: RewriteRouter problems

Martel
Matthew Ratzloff wrote:

> The first two work fine (as I would expect) when I comment out the
> RewriteRouter stuff, including setRouter().  Code used to add the last two
> items:
>
> $router->addRoute(
>     "News view",
>     "news/:id",
>     array(
>         "controller" => "news",
>         "action"     => "view",
>         "id"         => NULL
>     ),
>     array("id", "\d+")
> );

The requirements array should look like this: array("id" => "\d+"). It's not a great
problem though, router's just not using your regex now. You have two requirements
set, one for parameter named 0 ('id') and second for parameter named 1 ('\d+').

The above route will match both of those URLs at the moment:

http://www.example.com/news/1
http://www.example.com/news/create

In the latter id will be set to null.

I will probably change this behaviour as requested by Michael Sheakoski in ZF-166. It
  will result in a mismatch and will follow RoR matching style more closly then.


> I did notice that rewriteBase is being set to the complete path.  So if my
> path is /news/update/id/3 the rewriteBase is the same.  If it's the index
> page getRewriteBase() prints nothing.
> The strpos() error seems to resemble the other strpos() errors from awhile
> back.

I'll look into it. But could you please provide me with your $_SERVER['REQUEST_URI']
and $_SERVER['SCRIPT_NAME'] for those two types of URLs:

http://www.example.com
http://www.example.com/news/1

As I don't have a Mac available, I won't be able to test it on this platform. I will
downgrade my PHP to PHP 5.1.1 though.

> Any ideas?  :-(

Sure. I will fix it with your help, so no worries :)

> -Matt

--
Martel Valgoerad aka Michal Minicki | [hidden email] | http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"Idleness is not doing nothing. Idleness is being free to do anything." --
Floyd Dell
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: RewriteRouter problems

Martel
Martel Valgoerad wrote:

> But could you please provide me with your $_SERVER['REQUEST_URI'] and
> $_SERVER['SCRIPT_NAME'] for those two types of URLs:
> http://www.example.com
> http://www.example.com/news/1

Oh, one more thing, Matt. Could you please also show me your RewriteRule from Apache
config?

--
Martel Valgoerad aka Michal Minicki | [hidden email] | http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"Idleness is not doing nothing. Idleness is being free to do anything." --
Floyd Dell
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: RewriteRouter problems

Martel
In reply to this post by Matthew Ratzloff
Matthew Ratzloff wrote:

> Hmm, the old version of RewriteRouter I was using on another project
> didn't contain rewriteBase and it worked great.  The bootstrap code was
> literally copied from the same project and modified slightly.
 > Any ideas?  :-(

Matthiew, Jörg Sandkuhle resolved his problem. Long story short, it all comes
to the wrong (?) RewriteRule in an apache config.

This one works as it should:
RewriteRule !\.(js|ico|gif|jpg|png|css)$ index.php

While this one does not:
RewriteRule !\.(js|ico|gif|jpg|png|css)$ /index.php

The funny thing is I get an Internal Server Error with the latter and I simply
cannot test it myself. Could you please check if it also solves your problem?

> -Matt

--
Michael Minicki aka Martel Valgoerad | [hidden email] | http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"Don't go around saying the world owes you a living. The world owes you
nothing. It was here first." -- Mark Twain
12
Loading...