[Bb-trac] Re: [bbPress] #589: Improvement to #575

bbPress bb-trac at lists.bbpress.org
Tue Feb 20 05:08:00 GMT 2007


#589: Improvement to #575
-------------------------+--------------------------------------------------
 Reporter:  ascarid68    |        Owner:      
     Type:  enhancement  |       Status:  new 
 Priority:  low          |    Milestone:  1.0 
Component:  Front-end    |      Version:  0.80
 Severity:  minor        |   Resolution:      
 Keywords:               |  
-------------------------+--------------------------------------------------
Comment (by ascarid68):

 The best I can come up with to satisfy your question is if someone manages
 to name a directory in the path with a : at the end. Even then, it would
 have to be part of a url before it caused a problem.
 This was a php -a session from the bb-includes directory
 {{{
 php > include 'functions.php';
 php > echo bb_convert_path_base('/path/to/bbpress/extras:/plugins/',
 php ( '/path/to/bbpress',
 php ( 'http://www.example.com');
 http://www.example.com/extras://plugins/
 }}}

 I think what I don't understand is the use of bb_trim_common_path_right.
 It seems that the function would work just fine without the extra work of
 trimming the common path. In fact, it is what caused #575. After closer
 inspection of the function, I noticed the same core of the function as was
 in what I suggested:
 {{{
 $r = $to_base . substr($path, strlen($from_base)) . $last_char;
 }}}

 I also don't understand the presence of $last_char. Nothing is done to
 $path to cause it to lose its last character, as demonstrated after I
 removed that code here:
 {{{
 php > include 'functions.php';
 php > echo bb_convert_path_base('/path/to/bbpress/extras:/plugins/',
 php ( '/path/to/bbpress',
 php ( 'http://www.example.com');
 http://www.example.com/extras://plugins/
 }}}

 I'll attach another patch that includes the original sanity checks. I
 should note that without the new regex and bb_trim_common_path_right, my
 example works as well as for the original problem with the url name in the
 path. There is also a slight gain in performance.

-- 
Ticket URL: <http://trac.bbpress.org/ticket/589#comment:2>
bbPress <http://bbpress.org/>
Innovative forum development


More information about the Bb-trac mailing list