[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
Thu Jun 15 19:42:45 UTC 2017


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

Comment (by myrmidon16):

 Replying to [comment:1 Presskopp]:
 > array_search() only returns NULL if invalid parameters are passed to it.
 So the question is, why the parameters are invalid in your case. 2c

 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:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list