Opened 15 years ago
Closed 15 years ago
#18883 closed defect (bug) (fixed)
Notice generated by malformed permalink structures
| Reported by: | Viper007Bond | Owned by: | ryan |
|---|---|---|---|
| Priority: | lowest | Milestone: | 3.3 |
| Component: | Warnings/Notices | Version: | 3.3 |
| Severity: | trivial | Keywords: | has-patch |
| Cc: | Focuses: |
Description
Set your post permalink structure to this:
/%foobar/%year%/%monthnum%/%day%/%postname%/
Note the missing percent sign after foobar.
That generates this error after saving the structure:
( ! ) Notice: Undefined offset: -1 in \wp-includes\rewrite.php on line 1267
Call Stack
# Time Memory Function Location
1 0.0011 468272 {main}( ) ..\options-permalink.php:0
2 1.3076 25846048 WP_Rewrite->flush_rules( ) ..\options-permalink.php:124
3 1.3438 25837416 WP_Rewrite->wp_rewrite_rules( ) ..\rewrite.php:1861
4 1.3442 25839872 WP_Rewrite->rewrite_rules( ) ..\rewrite.php:1572
5 1.3444 25840976 WP_Rewrite->generate_rewrite_rules( ) ..\rewrite.php:1500
This is the line in question:
$query = ( isset($queries) && is_array($queries) ) ? $queries[$num_toks - 1] : '';
Attachments (1)
Change History (7)
#3
@
15 years ago
Invalid is a matter of opinion. %foobar gets treated as a static string, as if you were to just type foobar into there (as you can rightfully do). That said, Apache at least treats it as a malformed request so my example breaks permalinks.
I say just stop the notice from occurring and leave it be.
#5
@
15 years ago
- Cc added
I was able to recreate the original problem. After applying the patch, I threw a series of special characters at the permalink structure input including even / odd numbers of percents, blank strings, all percents, one percent, etc. I could not get a notice. Patch looks good.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Should we just hide the notice or display some error message for the user about invalid structure?