[wp-trac] [WordPress Trac] #45696: Undefined index: pagenow notice from php
WordPress Trac
noreply at wordpress.org
Wed Dec 19 01:54:56 UTC 2018
#45696: Undefined index: pagenow notice from php
------------------------------------+-----------------------------
Reporter: drtonyb | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Login and Registration | Version: 5.0.1
Severity: minor | Keywords:
Focuses: |
------------------------------------+-----------------------------
I am running my development WordPress environment in debug mode and have
noticed that since the release of WordPress 5.0, I have been seeing this
when my login expires and I'm requested to login again:
Notice: undefined index: pagenow in ...\wordpress\wp-includes\l10n.php on
line 141
This doesn't occur when I login normally at wp-login.php, only if my login
expires and I'm asked to login again.
I can see that this is new code for version 5 and line 141 is
{{{#!php
<?php
if ( ! empty( $_GET['wp_lang'] ) && 'wp-login.php' === $GLOBALS['pagenow']
) {
}}}
Testing a value in an array without checking that the indexed value is
actually defined is poor programming practice unless you can be guaranteed
that it will be defined.
Obviously this is not the case here, so {{{$GLOBALS['pagenow']}}}
shouldn't be accessed unless it is known to be not empty.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/45696>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list