------------------------------------------------------------
revno: 868
committer: Roger Martin <[email protected]>
branch nick: aikiframework
timestamp: Fri 2011-06-24 21:32:29 +0200
message:
escaped | in regex for display_url
modified:
src/libs/url.php
--
lp:aikiframework
https://code.launchpad.net/~aikiframework-devel/aikiframework/trunk
Your team Aiki Framework Developers is subscribed to branch lp:aikiframework.
To unsubscribe from this branch go to
https://code.launchpad.net/~aikiframework-devel/aikiframework/trunk/+edit-subscription
=== modified file 'src/libs/url.php'
--- src/libs/url.php 2011-06-22 21:36:01 +0000
+++ src/libs/url.php 2011-06-24 19:32:29 +0000
@@ -113,7 +113,15 @@
public function match($displayString){
if ( $displayString ) {
- foreach ( explode("|",$displayString) as $displayUrl) {
+ // a regular expression can containe a | character, that must be
+ // escaped, so in this case use preg_split.
+ if ( strpos($displayString,"#") !== false ){
+ $displayUrls= preg_split('#(?<!\\\)\|#',$displayString);
+ } else {
+ $displayUrls= explode("|",$displayString);
+ }
+
+ foreach ( $displayUrls as $displayUrl) {
if (!$displayUrl) {
continue;
@@ -128,8 +136,9 @@
//regular expression?
if ( strpos( $displayUrl, "#")===0 &&
- preg_match ('/^#.+#[Uims]*$/', $displayUrl) ) {
- //it's a regex, so or match or continue.
+ preg_match ('/^#.+#[Uims]*$/', $displayUrl) ) {
+ $displayUrl = str_replace( "\|","|",$displayUrl); //unescaped
+ //it's a regex, so or match or continue.
if ( preg_match ( $displayUrl, $this->pretty) ) {
return true;
} else {
_______________________________________________
Mailing list: https://launchpad.net/~aikiframework-devel
Post to : [email protected]
Unsubscribe : https://launchpad.net/~aikiframework-devel
More help : https://help.launchpad.net/ListHelp