Non-existing .php files in request path cause redirect to main page

Bug #514873 reported by Tilman Blumenbach
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Quam Plures
Fix Released
Medium
Tilman Blumenbach

Bug Description

When requesting a non-existing page through an URL like "http://example.com/index.php/abc", Quam Plures displays a 404 Not Found error by default.
If one changes the last part of the URL to end with .php (e. g. http://example.com/index.php/abc.php), Quam Plures redirects to the main page.

This buggy behaviour is caused by the following redundant check in inc/_blog_main.inc.php, lines 143-147:

> if( isset( $path_elements[0] ) && preg_match( '#.*\.php[0-9]?$#', $path_elements[0] ) )
> { // Ignore element ending with .php (fp: note: may be just '.php')
> array_shift( $path_elements );
> $Debuglog->add( 'Ignoring *.php in extra path info' , 'params' );
> }

Why is this check redundant? A base file name like index.php gets removed in line 124:

> if( preg_match( $blog_baseuri_regexp, $ReqPath, $matches ) )

...and a possible stub file gets array_shift()'d later, in lines 149-155:

> if( isset( $path_elements[0] )
> && ( $path_elements[0] == $Blog->stub
> || $path_elements[0] == $Blog->urlname ) )
> { // Ignore stub file (if it ends with .php it should already have been filtered out above)
> array_shift( $path_elements );
> $Debuglog->add( 'Ignoring stub filename OR blog urlname in extra path info' , 'params' );
> }

The fix for this bug obviously is to remove the redundant check.

Related branches

Changed in quam-plures:
status: In Progress → Fix Committed
Yabs (yabs)
Changed in quam-plures:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.