Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.0.4

Bug #6100 relative urls don't work right.
Submitted: 2005-11-28 23:36 UTC
From: me at ben-xo dot com Assigned: firman
Status: Verified Package: Text_Wiki_BBCode
PHP Version: 4.4.0 OS:
Roadmaps: (Not assigned)    
Subscription  
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes. If this is not your bug, you can add a comment by following this link. If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
2006-10-17 01:33 UTC
Package:
Bug Type:
Summary:
From: me at ben-xo dot com
New email:
PHP Version: Package Version: OS:

 

 [2005-11-28 23:36 UTC] me at ben-xo dot com
Description: ------------ Text_Wiki 1.0.3 and Text_Wiki_BBCode 0.0.2 So i figured out how to turn on relative_urls in Url.php (not the easiest thing to figure out because the doc is currently incomplete; - but i worked it out). Anyway. It doesn't do what i expect. Looking at the way the regex has been set up, it's completely different from the patch I submitted. Fair enough, as i don't know all the criteria and decision that went into the editing that you did, but still - it doesn't work right (: Test script: --------------- [url=/contact]Use this form please.[/url] [url]/contact[/url] Expected result: ---------------- <a href="/contact">Use this form please</a> <a href="/contact">/contact</a> Actual result: -------------- <a href="/contact">/contact</a> <a href="http:///contact">/contact</a>

Comments

 [2005-11-29 01:42 UTC] me at ben-xo dot com
Wait. I fixed it. diff -ur Text_Wiki_BBCode-0.0.2/Text/Wiki/Parse/BBCode/Url.php Text_Wiki_BBCode-0.0.2-benxo/Text/Wiki/Parse/BBCode/Url.php --- Text_Wiki_BBCode-0.0.2/Text/Wiki/Parse/BBCode/Url.php 2005-11-06 06:59:02.000000000 +0000 +++ Text_Wiki_BBCode-0.0.2-benxo/Text/Wiki/Parse/BBCode/Url.php 2005-11-29 01:41:57.000000000 +0000 @@ -52,7 +52,7 @@ 'refused' => array('script', 'about', 'applet', 'activex', 'chrome'), 'prefixes' => array('www', 'ftp'), 'host_regexp' => '(?:[^.\s/"\'<\\\#delim#\ca-\cz]+\.)*[a-z](?:[-a-z0-9]*[a-z0-9])?\.?', - 'path_regexp' => '(?:/[^][\'\s"<\\\#delim#\ca-\cz]*)?', + 'path_regexp' => '(?:(/)[^][\'\s"<\\\#delim#\ca-\cz]*)?', 'user_regexp' => '[^]()<>[:;@\,."\s\\\#delim#\ca-\cz]+(?:\.[^]()<>[:;@\,."\s\\\#delim#\ca-\cz]+)*', 'inline_enable' => true, 'relative_enable' => false
 [2005-11-29 01:46 UTC] me at ben-xo dot com
That's a bit messy but ... '(?:/[^][\'\s"<\\\#delim#\ca-\cz]*)?', becomes '(?:(/)[^][\'\s"<\\\#delim#\ca-\cz]*)?', that's the only change. capturing the (/) has the same effect in the decision login as if it had captured a URL protocol; it bases whether or not it's a URL with a URL link or a URL with a text description link on the number/content of captured subexps.
 [2005-11-29 06:00 UTC] me at ben-xo dot com
Disregard my last patch, it breaks other things! Here is a new one... i have tested with as many examples as i could think of, but i may not have tested it fully --- Text_Wiki_BBCode-0.0.2/Text/Wiki/Parse/BBCode/Url.php 2005-11-06 06:59:02.000000000 +0000 +++ Text_Wiki_BBCode-0.0.2-benxo/Text/Wiki/Parse/BBCode/Url.php 2005-11-29 05:36:01.000000000 +0000 @@ -52,7 +52,7 @@ 'refused' => array('script', 'about', 'applet', 'activex', 'chrome'), 'prefixes' => array('www', 'ftp'), 'host_regexp' => '(?:[^.\s/"\'<\\\#delim#\ca-\cz]+\.)*[a-z](?:[-a-z0-9]*[a-z0-9])?\.?', - 'path_regexp' => '(?:/[^][\'\s"<\\\#delim#\ca-\cz]*)?', + 'path_regexp' => '(?:/()[^][\'\s"<\\\#delim#\ca-\cz]*)?', 'user_regexp' => '[^]()<>[:;@\,."\s\\\#delim#\ca-\cz]+(?:\.[^]()<>[:;@\,."\s\\\#delim#\ca-\cz]+)*', 'inline_enable' => true, 'relative_enable' => false @@ -156,7 +156,7 @@ $pre = $matches[1]; if (!$matches[2]) { $matches[2] = 'mailto:' . $matches[3]; - $matches[4] = $matches[3]; + $matches[5] = $matches[3]; } } } @@ -164,7 +164,7 @@ $options = array( 'type' => $type, 'href' => (isset($matches[3]) ? '' : 'http://') . $matches[2], - 'text' => isset($matches[4]) ? $matches[4] : $matches[2] + 'text' => isset($matches[5]) ? $matches[5] : (!empty($matches[4]) ? $matches[4] : $matches[2]) ); // tokenize
 [2005-11-29 07:02 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!