[wp-trac] [WordPress Trac] #41079: PHP Notice: Undefined offset: -1 in /var/www/html/live/wp-includes/rewrite.php

WordPress Trac noreply at wordpress.org
Tue Apr 30 21:45:43 UTC 2024


#41079: PHP Notice: Undefined offset: -1 in /var/www/html/live/wp-
includes/rewrite.php
---------------------------+------------------------------
 Reporter:  myrmidon16     |       Owner:  (none)
     Type:  defect (bug)   |      Status:  new
 Priority:  normal         |   Milestone:  Awaiting Review
Component:  Rewrite Rules  |     Version:  4.3
 Severity:  normal         |  Resolution:
 Keywords:                 |     Focuses:
---------------------------+------------------------------

Comment (by gitinaaf54):

 array_search() returns false if invalid parameters are passed to it. There
 is a gate at line 363 that checks for that, yet the result is getting past
 that.
 Since $permastructs is the result of array_values(), it's safe to presume
 it is an indexed array. So if array_search() is not returning false,
 $postname_index is likely an index.
 And since $permastructs[$postname_index - 1] at lines 376 & 378 are
 looking for an offset of -1, I presume $postname_index is 0.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/41079#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list