Quantcast

Question about RewriteRouter

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

Question about RewriteRouter

Chris Hartjes
Hopefully this doesn't cause the same level of discussion that my
previous question did. :)

I'm using the RewriteRouter in the incubator for a work project (stats
reporting system).  After digging around the unit tests I figured out
how to use it.  But it's spitting out a notice-level error for when
there is no route to process.  Here's the code I'm using:

$router = new Zend_Controller_RewriteRouter();
$router->addRoute('admin','admin/delete/:id', array('controller' =>
'admin', 'action' => 'delete'));
$controller = Zend_Controller_Front::getInstance();
$controller->setRouter($router);
$controller->setControllerDirectory('../app/controllers');
$controller->dispatch();

Now, here's the error I get:

Notice: Uninitialized string offset: 0 in
/Users/chartjes/zf-trunk/incubator/library/Zend/Controller/Router/Route.php
on line 56

Warning: strpos() [function.strpos]: Empty delimiter. in
/Users/chartjes/zf-trunk/incubator/library/Zend/Controller/RewriteRouter.php
on line 109

Is there some route I need to create in order to make that error go
away?  I know it's happening when the route is blank because I stuck
some debugging code in to verify what route is being called.  Here's
the output when it does admin/delete/18

route is

Notice: Uninitialized string offset: 0 in
/Users/chartjes/zf-trunk/incubator/library/Zend/Controller/Router/Route.php
on line 56
route is :controller/:action
route is admin/delete/:id

Warning: strpos() [function.strpos]: Empty delimiter. in
/Users/chartjes/zf-trunk/incubator/library/Zend/Controller/RewriteRouter.php
on line 109
We would be deleting site 18

Any help with this would be greatly appreciated.  I'm using the
lastest and greatest version of zf from SVN.

--
Chris Hartjes

"The greatest inefficiencies come from solving problems you will never have."
-- Rasmus Lerdorf

@TheBallpark - http://www.littlehart.net/attheballpark
@TheKeyboard - http://www.littlehart.net/atthekeyboard
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Question about RewriteRouter

Kevin McArthur-2
$router->addRoute(':controller/:action',
array('controller'=>'index','action' => 'index'));

I had this problem too when getting going with it; use two params and the
svn ver will work happy. I'm not sure which is the correct way in the long
run.

Kevin
----- Original Message -----
From: "Chris Hartjes" <[hidden email]>
To: "Zend Framework General" <[hidden email]>
Sent: Tuesday, June 27, 2006 2:47 PM
Subject: [fw-general] Question about RewriteRouter


> Hopefully this doesn't cause the same level of discussion that my
> previous question did. :)
>
> I'm using the RewriteRouter in the incubator for a work project (stats
> reporting system).  After digging around the unit tests I figured out
> how to use it.  But it's spitting out a notice-level error for when
> there is no route to process.  Here's the code I'm using:
>
> $router = new Zend_Controller_RewriteRouter();
> $router->addRoute('admin','admin/delete/:id', array('controller' =>
> 'admin', 'action' => 'delete'));
> $controller = Zend_Controller_Front::getInstance();
> $controller->setRouter($router);
> $controller->setControllerDirectory('../app/controllers');
> $controller->dispatch();
>
> Now, here's the error I get:
>
> Notice: Uninitialized string offset: 0 in
> /Users/chartjes/zf-trunk/incubator/library/Zend/Controller/Router/Route.php
> on line 56
>
> Warning: strpos() [function.strpos]: Empty delimiter. in
> /Users/chartjes/zf-trunk/incubator/library/Zend/Controller/RewriteRouter.php
> on line 109
>
> Is there some route I need to create in order to make that error go
> away?  I know it's happening when the route is blank because I stuck
> some debugging code in to verify what route is being called.  Here's
> the output when it does admin/delete/18
>
> route is
>
> Notice: Uninitialized string offset: 0 in
> /Users/chartjes/zf-trunk/incubator/library/Zend/Controller/Router/Route.php
> on line 56
> route is :controller/:action
> route is admin/delete/:id
>
> Warning: strpos() [function.strpos]: Empty delimiter. in
> /Users/chartjes/zf-trunk/incubator/library/Zend/Controller/RewriteRouter.php
> on line 109
> We would be deleting site 18
>
> Any help with this would be greatly appreciated.  I'm using the
> lastest and greatest version of zf from SVN.
>
> --
> Chris Hartjes
>
> "The greatest inefficiencies come from solving problems you will never
> have."
> -- Rasmus Lerdorf
>
> @TheBallpark - http://www.littlehart.net/attheballpark
> @TheKeyboard - http://www.littlehart.net/atthekeyboard 

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

Re: Question about RewriteRouter

Matthew Ratzloff
In reply to this post by Chris Hartjes
Chris,

> I'm using the RewriteRouter in the incubator for a work project (stats
> reporting system).  After digging around the unit tests I figured out
> how to use it.  But it's spitting out a notice-level error for when
> there is no route to process.  Here's the code I'm using:
>
> $router = new Zend_Controller_RewriteRouter();
> $router->addRoute('admin','admin/delete/:id', array('controller' =>
> 'admin', 'action' => 'delete'));

Instead try:

$router->addRoute('admin','admin/delete/:id', array('controller' =>
'admin', 'action' => 'delete', 'id' => NULL));

Kevin,

A default route like the one you listed is being set in the constructor of
recent versions of the class.

-Matt

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

Re: Question about RewriteRouter

Kevin McArthur-2
Im currently running Rev 638 of the framework from SVN.

It wants to take two params not 3 to the addRoute and is working happily.
The default being included aside; I had his exact error using three params
not two to addRoute.

Kevin
----- Original Message -----
From: "Matthew Ratzloff" <[hidden email]>
To: "Zend Framework General" <[hidden email]>
Sent: Tuesday, June 27, 2006 3:27 PM
Subject: Re: [fw-general] Question about RewriteRouter


> Chris,
>
>> I'm using the RewriteRouter in the incubator for a work project (stats
>> reporting system).  After digging around the unit tests I figured out
>> how to use it.  But it's spitting out a notice-level error for when
>> there is no route to process.  Here's the code I'm using:
>>
>> $router = new Zend_Controller_RewriteRouter();
>> $router->addRoute('admin','admin/delete/:id', array('controller' =>
>> 'admin', 'action' => 'delete'));
>
> Instead try:
>
> $router->addRoute('admin','admin/delete/:id', array('controller' =>
> 'admin', 'action' => 'delete', 'id' => NULL));
>
> Kevin,
>
> A default route like the one you listed is being set in the constructor of
> recent versions of the class.
>
> -Matt
>

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

Re: Question about RewriteRouter

Michael Sheakoski
In reply to this post by Chris Hartjes
To fix this error you need to replace line 109 in RewriteRouter.php with
the following code:

if (strlen($this->_rewriteBase) > 0 && strpos($path,
$this->_rewriteBase) === 0) {

ciao,
Michael

> Warning: strpos() [function.strpos]: Empty delimiter. in
> /Users/chartjes/zf-trunk/incubator/library/Zend/Controller/RewriteRouter.php
>
> on line 109
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Question about RewriteRouter

Martel
In reply to this post by Chris Hartjes
Chris Hartjes wrote:

> I'm using the RewriteRouter in the incubator for a work project (stats
> reporting system).  After digging around the unit tests I figured out
> how to use it.  But it's spitting out a notice-level error for when
> there is no route to process.  Here's the code I'm using:

Shhh, shhhh! Bosses will hear ;)

> Now, here's the error I get:
> Notice: Uninitialized string offset: 0 in
> /Users/chartjes/zf-trunk/incubator/library/Zend/Controller/Router/Route.php
> on line 56

> Warning: strpos() [function.strpos]: Empty delimiter. in
> /Users/chartjes/zf-trunk/incubator/library/Zend/Controller/RewriteRouter.php
> on line 109

Both fixed in svn. Thank you.

I would like to thank all of you for testing this without a single line of
documentation. You're doing a great job.

--
Michael Minicki aka Martel Valgoerad | [hidden email] | http://aie.pl/martel.asc
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"Courage is resistance to fear, mastery of fear -- not absence of fear."
-- Mark Twain
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Getting the same message 2 or 3 times

Tome Cvitan
Hi,

Something that is rather annoying is the fact that the mailing list
messages come up 2 or 3 times for me. I'm not sure why this happens, but
maybe someone knows more?

Thanks.


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

Re: Getting the same message 2 or 3 times

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

Re: Getting the same message 2 or 3 times

Tome Cvitan
Very constructive answer, if you have no answer then don't answer?

Manoj Keswani wrote:
> unsubscribe




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

Re: Getting the same message 2 or 3 times

André Hoffmann
well, if you use the gmail 'Reply to all' button, gmail will send a mail to both the person that sent the mail and the mailing list, but it's more convenient than to put in the mailing list address every time you awnser a mail.
that would explain the double mailing, but i haven't got an idea about the third mail.

thumbs down to manoj keswani

On 6/30/06, Tome Cvitan < [hidden email]> wrote:
Very constructive answer, if you have no answer then don't answer?

Manoj Keswani wrote:
> unsubscribe







--
best regards,
André Hoffmann
Germany
Loading...