{"id":16709005,"date":"2023-05-04T01:37:43","date_gmt":"2023-05-04T01:37:43","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/php-8-errors-11\/"},"modified":"2023-05-04T01:37:43","modified_gmt":"2023-05-04T01:37:43","slug":"php-8-errors-11","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/php-8-errors-11\/","title":{"rendered":"PHP 8 errors"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">The plugin breaks under PHP 8. For example these errors will break the site under PHP 8:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">media-settings.php line 43: &#8216;create_function&#8217; was removed in 8.0 PHP version<br \/>media-tags.php line line 48: &#8216;create_function&#8217; was removed in 8.0 PHP version<br \/>media-tags.php line line 55: &#8216;create_function&#8217; was removed in 8.0 PHP version<br \/>And there are also many undefined variable and undefined constant errors that will break under PHP 8.<br \/>This is the full error and warning report:<br \/><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>'Inspections Results' project 52 errors 99 warnings 27 weak warnings<br \/>PHP group 52 errors 99 warnings 27 weak warnings<br \/>Code smell group 9 warnings<br \/>Inconsistent return points inspection 9 warnings<br \/>file attachments-custom-fields.php 2 warnings<br \/>WARNING Missing return argument<br \/>WARNING Missing return argument<br \/>file file-gallery.php 1 warning<br \/>WARNING Missing return argument<br \/>file main.php 2 warnings<br \/>WARNING Missing return argument<br \/>WARNING Missing 'return' statement<br \/>file media-tags.php 1 warning<br \/>WARNING Missing 'return' statement<br \/>file TreeBuilder.php 3 warnings<br \/>WARNING Missing 'return' statement<br \/>WARNING Missing 'return' statement<br \/>WARNING Missing 'return' statement<br \/>Control flow group 1 warning<br \/>Unreachable statement inspection 1 warning<br \/>file mime-types.php 1 warning<br \/>WARNING Unreachable statement<br \/>General group 3 errors 2 warnings<br \/>Array index is immediately rewritten inspection 2 warnings<br \/>file media-settings.php 1 warning<br \/>WARNING Array index is immediately overwritten before accessing<br \/>file regenerate-images.php 1 warning<br \/>WARNING Array index is immediately overwritten before accessing<br \/>Element is not available in configured PHP version inspection 3 errors<br \/>file media-settings.php 1 error<br \/>ERROR 'create_function' was removed in 8.0 PHP version<br \/>file media-tags.php 2 errors<br \/>ERROR 'create_function' was removed in 8.0 PHP version<br \/>ERROR 'create_function' was removed in 8.0 PHP version<br \/>Probable bugs group 1 error 45 warnings<br \/>Empty index operator not supported for strings inspection 1 error<br \/>file main.php 1 error<br \/>ERROR '&#091;]' operator not supported for strings<br \/>Expression result unused inspection 1 warning<br \/>file TreeBuilder.php 1 warning<br \/>WARNING Expression result is not used anywhere<br \/>Optional before required parameter inspection 2 warnings<br \/>file attachments.php 1 warning<br \/>WARNING Optional parameter is provided before required<br \/>file file-gallery.php 1 warning<br \/>WARNING Optional parameter is provided before required<br \/>Statement has empty body inspection 41 warnings<br \/>file attachments-custom-fields.php 2 warnings<br \/>WARNING Statement has empty body<br \/>WARNING Statement has empty body<br \/>file InputStream.php 1 warning<br \/>WARNING Statement has empty body<br \/>file Tokenizer.php 7 warnings<br \/>WARNING Statement has empty body<br \/>WARNING Statement has empty body<br \/>WARNING Statement has empty body<br \/>WARNING Statement has empty body<br \/>WARNING Statement has empty body<br \/>WARNING Statement has empty body<br \/>WARNING Statement has empty body<br \/>file TreeBuilder.php 31 warnings<br \/>WARNING Statement has empty body<br \/>WARNING Statement has empty body<br \/>WARNING Statement has empty body<br \/>WARNING Statement has empty body<br \/>WARNING Statement has empty body<br \/>WARNING Statement has empty body<br \/>WARNING Statement has empty body<br \/>WARNING Statement has empty body<br \/>WARNING Statement has empty body<br \/>WARNING Statement has empty body<br \/>WARNING Statement has empty body<br \/>WARNING Statement has empty body<br \/>WARNING Statement has empty body<br \/>WARNING Statement has empty body<br \/>WARNING Statement has empty body<br \/>WARNING Statement has empty body<br \/>WARNING Statement has empty body<br \/>WARNING Statement has empty body<br \/>WARNING Statement has empty body<br \/>WARNING Statement has empty body<br \/>WARNING Statement has empty body<br \/>WARNING Statement has empty body<br \/>WARNING Statement has empty body<br \/>WARNING Statement has empty body<br \/>WARNING Statement has empty body<br \/>WARNING Statement has empty body<br \/>WARNING Statement has empty body<br \/>WARNING Statement has empty body<br \/>WARNING Statement has empty body<br \/>WARNING Statement has empty body<br \/>WARNING Statement has empty body<br \/>Void function result used inspection 1 warning<br \/>file TreeBuilder.php 1 warning<br \/>WARNING 'void' method 'emitToken' result used<br \/>Type compatibility group 1 error 23 warnings<br \/>Arithmetic operation with unsupported operands inspection 1 error<br \/>file attachments-custom-fields.php 1 error<br \/>ERROR Unsupported operand types in '\\unknown_type % int' will cause a PHP 8 TypeError<br \/>Incompatible return type inspection 3 warnings<br \/>file attachments-custom-fields.php 3 warnings<br \/>WARNING Return value type is not compatible with declared<br \/>WARNING Return value type is not compatible with declared<br \/>WARNING Return value type is not compatible with declared<br \/>Parameter type inspection 20 warnings<br \/>file attachments-custom-fields.php 3 warnings<br \/>WARNING Parameter '$count' type is not compatible with declaration<br \/>WARNING Parameter '$metadata' type is not compatible with declaration<br \/>WARNING Parameter '$post' type is not compatible with declaration<br \/>file templating.php 1 warning<br \/>WARNING Parameter 'wp_get_attachment_link($attachment\u2011&gt;ID)' type is not compatible with declaration<br \/>file Tokenizer.php 16 warnings<br \/>WARNING Parameter 'self::WHITESPACE' type is not compatible with declaration<br \/>WARNING Parameter '$mask' type is not compatible with declaration<br \/>WARNING Parameter 'self::ALPHA' type is not compatible with declaration<br \/>WARNING Parameter 'self::UPPER_ALPHA' type is not compatible with declaration<br \/>WARNING Parameter '\"\\t\\n\\x0C \/&gt;\" . self::UPPER_ALPHA' type is not compatible with declaration<br \/>WARNING Parameter 'self::UPPER_ALPHA' type is not compatible with declaration<br \/>WARNING Parameter '\"\\t\\n\\x0C \/=&gt;\\\"'\" . self::UPPER_ALPHA' type is not compatible with declaration<br \/>WARNING Parameter ''\"&amp;'' type is not compatible with declaration<br \/>WARNING Parameter '\"'&amp;\"' type is not compatible with declaration<br \/>WARNING Parameter '\"\\t\\n\\x0c &amp;&gt;\\\"'=\"' type is not compatible with declaration<br \/>WARNING Parameter ''&gt;'' type is not compatible with declaration<br \/>WARNING Parameter ''\u2011'' type is not compatible with declaration<br \/>WARNING Parameter 'self::ALPHA' type is not compatible with declaration<br \/>WARNING Parameter ''\u2011'' type is not compatible with declaration<br \/>WARNING Parameter 'self::ALPHA' type is not compatible with declaration<br \/>WARNING Parameter '$char_class' type is not compatible with declaration<br \/>Undefined symbols group 47 errors 19 warnings 27 weak warnings<br \/>Undefined class inspection 16 warnings<br \/>file attachments-custom-fields.php 4 warnings<br \/>WARNING Undefined class 'unknown_type'<br \/>WARNING Undefined class 'unknown_type'<br \/>WARNING Undefined class 'unknown'<br \/>WARNING Undefined class 'unknown_type'<br \/>file attachments.php 1 warning<br \/>WARNING Undefined class 'echoes'<br \/>file file-gallery.php 1 warning<br \/>WARNING Undefined class 'Debug_Bar_Panel'<br \/>file InputStream.php 3 warnings<br \/>WARNING Undefined class 'Data'<br \/>WARNING Undefined class 'Bytes'<br \/>WARNING Undefined class 'Bytes'<br \/>file Parser.php 6 warnings<br \/>WARNING Undefined class 'HTML'<br \/>WARNING Undefined class 'Custom'<br \/>WARNING Undefined class 'Parsed'<br \/>WARNING Undefined class 'HTML'<br \/>WARNING Undefined class 'Custom'<br \/>WARNING Undefined class 'Parsed'<br \/>file Tokenizer.php 1 warning<br \/>WARNING Undefined class 'Data'<br \/>Undefined class constant inspection 1 error<br \/>file TreeBuilder.php 1 error<br \/>ERROR Constant 'INBODY' not found<br \/>Undefined constant inspection 1 error<br \/>file media-tags.php 1 error<br \/>WARNING Undefined constant 'MEDIA_TAGS_URL'<br \/>Undefined method inspection 3 warnings<br \/>file file-gallery.php 1 warning<br \/>WARNING Method 'title' is undefined<br \/>file regenerate-images.php 1 warning<br \/>WARNING Method 'get_error_message' is undefined<br \/>file TreeBuilder.php 1 warning<br \/>WARNING Method 'insertToken' is undefined<br \/>Undefined property inspection 4 weak warnings<br \/>file attachments.php 2 weak warnings<br \/>WARNING Property declared dynamically<br \/>WARNING Property declared dynamically<br \/>file TreeBuilder.php 2 weak warnings<br \/>WARNING Property declared dynamically<br \/>WARNING Property declared dynamically<br \/>Undefined variable inspection 45 errors 23 weak warnings<br \/>file attachments.php 2 weak warnings<br \/>ERROR Variable '$possible_new_attachments' is probably undefined<br \/>ERROR Variable '$promoted_id' is probably undefined<br \/>file file-gallery.php 1 error<br \/>ERROR Undefined variable '$acf_localize'<br \/>ERROR Undefined variable '$acf_options'<br \/>ERROR Variable '$transient' is probably undefined<br \/>file gallery.php 5 errors 1 weak warning<br \/>ERROR Undefined variable '$startcol'<br \/>ERROR Undefined variable '$endcol'<br \/>ERROR Undefined variable '$title'<br \/>ERROR Undefined variable '$thumb_link'<br \/>ERROR Undefined variable '$size'<br \/>ERROR Variable '$title' is probably undefined<br \/>file gallery.php 11 errors 1 weak warning<br \/>ERROR Undefined variable '$itemtag'<br \/>ERROR Undefined variable '$startcol'<br \/>ERROR Undefined variable '$endcol'<br \/>ERROR Undefined variable '$icontag'<br \/>ERROR Undefined variable '$title'<br \/>ERROR Undefined variable '$thumb_link'<br \/>ERROR Undefined variable '$thumb_width'<br \/>ERROR Undefined variable '$thumb_height'<br \/>ERROR Undefined variable '$size'<br \/>ERROR Undefined variable '$thumb_alt'<br \/>ERROR Variable '$title' is probably undefined<br \/>ERROR Undefined variable '$captiontag'<br \/>file gallery.php 11 errors 3 weak warnings<br \/>ERROR Undefined variable '$link'<br \/>ERROR Undefined variable '$file_gallery_this_template_counter'<br \/>ERROR Undefined variable '$link_class'<br \/>ERROR Variable '$link' is probably undefined<br \/>ERROR Undefined variable '$endcol'<br \/>ERROR Variable '$diff' is probably undefined<br \/>ERROR Undefined variable '$caption'<br \/>ERROR Undefined variable '$thumb_link'<br \/>ERROR Undefined variable '$thumb_width'<br \/>ERROR Undefined variable '$thumb_height'<br \/>ERROR Undefined variable '$title'<br \/>ERROR Undefined variable '$size'<br \/>ERROR Undefined variable '$thumb_alt'<br \/>ERROR Variable '$link' is probably undefined<br \/>file gallery.php 2 errors 1 weak warning<br \/>ERROR Undefined variable '$endcol'<br \/>ERROR Undefined variable '$title'<br \/>ERROR Variable '$title' is probably undefined<br \/>file main-form.php 10 errors 7 weak warnings<br \/>ERROR Undefined variable '$output'<br \/>ERROR Undefined variable '$checked_attachments'<br \/>ERROR Undefined variable '$delete_what'<br \/>ERROR Undefined variable '$post_id'<br \/>ERROR Undefined variable '$gallery_state'<br \/>ERROR Variable '$file_gallery_options' is probably undefined<br \/>ERROR Variable '$gallery_state' is probably undefined<br \/>ERROR Undefined variable '$sizes'<br \/>ERROR Variable '$templates_dropdown' is probably undefined<br \/>ERROR Variable '$templates_dropdown' is probably undefined<br \/>ERROR Undefined variable '$single_state'<br \/>ERROR Variable '$single_state' is probably undefined<br \/>ERROR Variable '$post_id' is probably undefined<br \/>ERROR Undefined variable '$files_or_tags'<br \/>ERROR Undefined variable '$attachment_orderby'<br \/>ERROR Undefined variable '$attachment_order'<br \/>ERROR Variable '$post_id' is probably undefined<br \/>file media-settings.php 2 errors 1 weak warning<br \/>ERROR Variable '$output' is probably undefined<br \/>ERROR Undefined variable '$values'<br \/>ERROR Undefined variable '$values'<br \/>file mime-types.php 1 weak warning<br \/>ERROR Variable '$out' is probably undefined<br \/>file templates-media-wp39.php 1 error<br \/>ERROR Undefined variable '$post'<br \/>file templates-media-wp40.php 1 error<br \/>ERROR Undefined variable '$post'<br \/>file templates-media-wp43.php 1 error<br \/>ERROR Undefined variable '$post'<br \/>file templating.php 1 weak warning<br \/>ERROR Variable '$transient' is probably undefined<br \/>file Tokenizer.php 1 weak warning<br \/>ERROR Variable '$id' is probably undefined<br \/>file TreeBuilder.php 4 weak warnings<br \/>ERROR Variable '$in_stack' is probably undefined<br \/>ERROR Variable '$fe_af_pos' is probably undefined<br \/>ERROR Variable '$fe_af_pos' is probably undefined<br \/>ERROR Variable '$fe_af_pos' is probably undefined<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"template":"","class_list":["post-16709005","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/16709005","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\/16709005\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=16709005"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}