Zend Framework

Router begins to treat '@' as a special character in version 1.8, which should be noted in "Migrating from Previous Versions" section

Details

  • Type: Docs:  Problem Docs: Problem
  • Status: Resolved Resolved
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.8.0
  • Fix Version/s: 1.8.1
  • Component/s: Zend_Controller
  • Labels:
    None
  • Language:
    English

Description

Zend_Controller_Router_Route used to treat '@' as a normal character, so I use it like
'user' => new Zend_Controller_Router_Route('@/:user_name/*',
array('module' => $defaultModuleName, 'controller' => 'user')),
it works on zf1.7 with http://example.com/@/your_name.

In 1.8, zf treats '@' as a marker of translated segment, so the above code does not work but throws an exception.
http://framework.zend.com/manual/en/zend.controller.router.html#zend.controller.router.routes.standard.translated-segments

To make it work as same as 1.7, I need to modify strangely like the following.
'user' => new Zend_Controller_Router_Route('@/:user_name/*',
array('module' => $defaultModuleName, 'controller' => 'user'),
array(),
new Zend_Translate('array', array('' => '@'))),

I do not know it's the great way or not, but anyway this behavior change leads a backword-compatibility break,
so that it should be noted in the migrating section in the document.
http://framework.zend.com/manual/en/zend.controller.migration.html

Activity

Hide
Ben Scholzen added a comment -

Except mentioning that in the migration chapter, we could also allow escaping special chars (being colon ":" and at "@" in the beginning of a segment). Thus you would be able to use them again without a dirty workaround.

Show
Ben Scholzen added a comment - Except mentioning that in the migration chapter, we could also allow escaping special chars (being colon ":" and at "@" in the beginning of a segment). Thus you would be able to use them again without a dirty workaround.
Hide
twk added a comment -

Maybe that's right, but I think every zf change that the zf-user needs to change his/her code should be noted in the migration chapter.
Even if you have introduce the escape character (or a way to change special characters), zf-user needs a small mod to add an escape character, so still it should be noted in the migration chapter.

Show
twk added a comment - Maybe that's right, but I think every zf change that the zf-user needs to change his/her code should be noted in the migration chapter. Even if you have introduce the escape character (or a way to change special characters), zf-user needs a small mod to add an escape character, so still it should be noted in the migration chapter.
Hide
Ben Scholzen added a comment -

Whoops, I meant "Beside mentioning that..."

Show
Ben Scholzen added a comment - Whoops, I meant "Beside mentioning that..."
Hide
Ben Scholzen added a comment -

Escaping for beginning special characters is now :: and @@

Show
Ben Scholzen added a comment - Escaping for beginning special characters is now :: and @@
Hide
twk added a comment -

http://framework.zend.com/code/browse/Zend_Framework/standard/branches/release-1.8/documentation/manual/en/module_specs/Zend_Controller-Migration.xml?r=15464#l20

> the <code>@</code> character is no a special character in the beginning of a route segment.
You mean "now a special character"?

Show
twk added a comment - http://framework.zend.com/code/browse/Zend_Framework/standard/branches/release-1.8/documentation/manual/en/module_specs/Zend_Controller-Migration.xml?r=15464#l20 > the <code>@</code> character is no a special character in the beginning of a route segment. You mean "now a special character"?
Hide
Dolf Schimmel (Freeaqingme) added a comment -

Yes, that is what's meant. The typo was solved yesterday, and will be put online within a few days (probably with the release of 1.8.1).

Closing for now.

Show
Dolf Schimmel (Freeaqingme) added a comment - Yes, that is what's meant. The typo was solved yesterday, and will be put online within a few days (probably with the release of 1.8.1). Closing for now.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: