{"id":19018225,"date":"2026-09-12T04:16:00","date_gmt":"2026-09-12T04:16:00","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/php-8-warning-on-every-admin_init\/"},"modified":"2026-09-12T04:16:00","modified_gmt":"2026-09-12T04:16:00","slug":"php-8-warning-on-every-admin_init","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/php-8-warning-on-every-admin_init\/","title":{"rendered":"PHP 8 warning on every admin_init"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Undefined array key &#8220;input&#8221; in class-easyfancybox-admin.php line 609<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Environment<\/strong>: Firelight Lightbox 2.3.22 (the 2.3.23 changelog does not mention this, so I assume it is still present), WordPress 7.1, PHP 8.3, single site.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Every admin_init triggers this warning:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>PHP Warning:<\/strong> Undefined array key &#8220;input&#8221; in wp-content\/plugins\/easy-fancybox\/inc\/class-easyfancybox-admin.php on line 609<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The line is inside add_settings_fields_recursively():<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>if (\n    is_array( $option )\n    &amp;&amp; array_key_exists( 'options', $option )\n    \/\/ Exclude select inputs, which have options key.\n    &amp;&amp; 'select' !== $option&#091;'input']\n) {<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Some entries in the options tree have an &#8216;options&#8217; key but no &#8216;input&#8217; key, so the comparison reads an undefined index. The logic still evaluates as intended (a missing &#8216;input&#8217; is not &#8216;select&#8217;), so there is no functional bug, only the warning.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Because admin_init also fires on admin-ajax.php, this runs on every ajax request from every logged-in user, not just on admin pages. On a BuddyPress community with a few hundred active members we log roughly 11,000 of these warnings per day, which drowns out real errors.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Suggested fix, one line:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&amp;&amp; 'select' !== ( $option&#091;'input'] ?? '' )<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Optionally, register the settings fields only on the plugin&#8217;s own settings screen (or skip when wp_doing_ajax()) so the recursive walk does not run on every ajax call at all.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Happy to test a dev build. Thanks for maintaining the plugin.<\/p>\n","protected":false},"template":"","class_list":["post-19018225","topic","type-topic","status-publish","hentry","topic-tag-admin_init","topic-tag-warning"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/19018225","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/19018225\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=19018225"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}