developer.jelix.org n'est plus utilisée, et existe uniquement pour son historique. Postez les nouveaux tickets sur le compte github.
Opened 8 years ago
Last modified 8 years ago
#1511 new bug
New implementation of jUrl::getCurrentUrl() is not compatible with some usage of url handlers
Reported by: | bricet | Owned by: | |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | jelix:core | Version: | trunk |
Severity: | normal | Keywords: | jurl getCurrentUrl |
Cc: | Blocked By: | ||
Blocking: | Documentation needed: | no | |
Hosting Provider: | Php version: |
Description
When using a url handler, it is sometimes convenient to delete some url parameters and to transmit new ones (computed from originals) to the action.
Those parameters, though, do not permit to rebuild the url as jUrl::getCurrentUrl() does ...
I have no proposal for a better implementation.
Change History (4)
comment:1 Changed 8 years ago by laurentj
- Milestone set to Jelix 1.5.3
- Status changed from new to confirmed
comment:2 follow-up: ↓ 3 Changed 8 years ago by laurentj
- Milestone Jelix 1.5.3 deleted
- Status changed from confirmed to new
comment:3 in reply to: ↑ 2 ; follow-up: ↓ 4 Changed 8 years ago by bricet
Here is a test case.
Let's have this url handler :
class myHandlerUrlsHandler implements jIUrlSignificantHandler { function parse($url){ if(preg_match("/^\/(.+)$/",$url->pathInfo,$match)){ $urlact = new jUrlAction($url->params); $urlact->setParam( 'actionParam', strrev( jUrl::unescape($match[1]) ) ); $urlact->setParam( 'module', 'test1511' ); $urlact->setParam( 'action', 'default:handlerTarget' ); return $urlact; }else return false; } function create($urlact, $url){ $p=jUrl::escape($url->getParam('jurlParam')); $url->pathInfo = "/$p"; $url->delParam('jurlParam'); } }
And let have this in urls.xml :
<url handler="test1511~myHandler" module="test1511" action="handler:untruc" />
Now if we make this url :
{jurl 'test1511~handler:untruc', array('jurlParam'=>'value')}
The given url is something like : /index.php/value
But if in this action test1511~handler:untruc we print jUrl::getCurrentUrl(), we get : /index.php?module=test1511&action=default:handlerTarget&actionParam=eulav
comment:4 in reply to: ↑ 3 Changed 8 years ago by bricet
But if in this action test1511~handler:untruc we print jUrl::getCurrentUrl(), we get : /index.php?module=test1511&action=default:handlerTarget&actionParam=eulav
Sorry. I meant : "But if in this action test1511~default:handlerTarget ...
Sorry, I don't see (or I don't remember) how the new implementation prevents to return your own jUrlAction object, or to modify the global request object in an url handler...