[wp-trac] [WordPress Trac] #45018: Non-string needle parameters throw warning in PHP 7.3

WordPress Trac noreply at wordpress.org
Mon Oct 1 18:42:31 UTC 2018


#45018: Non-string needle parameters throw warning in PHP 7.3
--------------------------+-------------------------
 Reporter:  desrosj       |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  4.9.9
Component:  General       |    Version:
 Severity:  normal        |   Keywords:  needs-patch
  Focuses:                |
--------------------------+-------------------------
 In PHP 7.3,
 [https://wiki.php.net/rfc/deprecations_php_7_3#string_search_functions_with_integer_needle
 a new warning was added when a non-string is passed] as a needle to
 `strpos()`, or another similar function (see the link for a full list).

 > String search functions usually operate on a string needle. However, if
 a non-string is passed, it will be converted to an integer and interpreted
 as an ASCII codepoint.

 The warning will be removed in PHP 8 and the needle parameter will be
 changed to a string.

 Currently, [https://travis-ci.org/WordPress/wordpress-
 develop/jobs/435373113#L8584 there is one test displaying this warning
 when tests are run on PHP 7.3].

 > Tests_Nav_Menu_Theme_Change::test_numerical_locations
 >
 > stripos(): Non-string needles will be interpreted as strings in the
 future. Use an explicit chr() call to preserve the current behavior

 It's possible there are more instances, but this is the only one being
 exposed with tests.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/45018>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list