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

Request #16192 Bad URL rewrite in PHP_Archive::webFrontController
Submitted: 2009-05-07 01:52 UTC
From: madmind Assigned:
Status: Open Package: PHP_Archive (version 0.11.4)
PHP Version: 5.2.9 OS: Windows
Roadmaps: (Not assigned)    
Subscription  


 [2009-05-07 01:52 UTC] madmind (Alex MadMind)
Description: ------------ The problem is that webFrontController rewrites all URI, not just the part after .phar file. Here is a trace for http://dev.mad.lan/QuizStats/quiz_stats.phar/ where it should show me the index.php from .phar file, but instead it searces for QuizStats/, that is wrong. 0.1217 551240 -> PHP_Archive::webFrontController($initfile = 'index.php') D:\Server\sites\dev\QuizStats\quiz_stats.phar:1232 0.1217 553600 -> parse_url('/QuizStats/quiz_stats.phar/') D:\Server\sites\dev\QuizStats\quiz_stats.phar:270 >=> array ('path' => '/QuizStats/quiz_stats.phar/') 0.1218 553440 -> realpath('D:/Server/sites/dev/QuizStats/quiz_stats.phar') D:\Server\sites\dev\QuizStats\quiz_stats.phar:271 >=> 'D:\\Server\\sites\\dev\\QuizStats\\quiz_stats.phar' 0.1219 553560 -> basename('D:\\Server\\sites\\dev\\QuizStats\\quiz_stats.phar') D:\Server\sites\dev\QuizStats\quiz_stats.phar:272 >=> 'quiz_stats.phar' 0.1220 553576 -> str_replace('/quiz_stats.phar', '', '/QuizStats/quiz_stats.phar/') D:\Server\sites\dev\QuizStats\quiz_stats.phar:272 >=> '/QuizStats/' 0.1220 553400 -> substr('/QuizStats/', 1) D:\Server\sites\dev\QuizStats\quiz_stats.phar:282 >=> 'QuizStats/' 0.1221 553336 -> PHP_Archive::_fileExists($archive = 'D:\\Server\\sites\\dev\\QuizStats\\quiz_stats.phar', $path = 'QuizStats/') D:\Server\sites\dev\QuizStats\quiz_stats.phar:282 >=> FALSE 0.1221 553544 -> header('HTTP/1.0 404 Not Found') D:\Server\sites\dev\QuizStats\quiz_stats.phar:283 >=> NULL >=> FALSE

Comments

 [2009-05-07 02:47 UTC] madmind (Alex MadMind)
Possible solution: replace line $subpath = str_replace('/' . basename($archive), '', $uri['path']); with $basename_achive=basename($archive); $subpath = str_replace(substr($uri['path'], 0, strpos($uri['path'], $basename_achive)+strlen($basename_achive)), '', $uri['path']);
 [2009-05-23 23:06 UTC] doconnor (Daniel O'Connor)
Want to make a small executable test case to prove your patch works or doesn't?