Title: PHP 8 errors
Last modified: May 4, 2023

---

# PHP 8 errors

 *  [odedstr2](https://wordpress.org/support/users/odedstr2/)
 * (@odedstr2)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/php-8-errors-11/)
 * The plugin breaks under PHP 8. For example these errors will break the site under
   PHP 8:
 * media-settings.php line 43: ‘create_function’ was removed in 8.0 PHP version
   
   media-tags.php line line 48: ‘create_function’ was removed in 8.0 PHP versionmedia-
   tags.php line line 55: ‘create_function’ was removed in 8.0 PHP versionAnd there
   are also many undefined variable and undefined constant errors that will break
   under PHP 8.This is the full error and warning report:
 *     ```wp-block-code
       'Inspections Results' project 52 errors 99 warnings 27 weak warningsPHP group 52 errors 99 warnings 27 weak warningsCode smell group 9 warningsInconsistent return points inspection 9 warningsfile attachments-custom-fields.php 2 warningsWARNING Missing return argumentWARNING Missing return argumentfile file-gallery.php 1 warningWARNING Missing return argumentfile main.php 2 warningsWARNING Missing return argumentWARNING Missing 'return' statementfile media-tags.php 1 warningWARNING Missing 'return' statementfile TreeBuilder.php 3 warningsWARNING Missing 'return' statementWARNING Missing 'return' statementWARNING Missing 'return' statementControl flow group 1 warningUnreachable statement inspection 1 warningfile mime-types.php 1 warningWARNING Unreachable statementGeneral group 3 errors 2 warningsArray index is immediately rewritten inspection 2 warningsfile media-settings.php 1 warningWARNING Array index is immediately overwritten before accessingfile regenerate-images.php 1 warningWARNING Array index is immediately overwritten before accessingElement is not available in configured PHP version inspection 3 errorsfile media-settings.php 1 errorERROR 'create_function' was removed in 8.0 PHP versionfile media-tags.php 2 errorsERROR 'create_function' was removed in 8.0 PHP versionERROR 'create_function' was removed in 8.0 PHP versionProbable bugs group 1 error 45 warningsEmpty index operator not supported for strings inspection 1 errorfile main.php 1 errorERROR '[]' operator not supported for stringsExpression result unused inspection 1 warningfile TreeBuilder.php 1 warningWARNING Expression result is not used anywhereOptional before required parameter inspection 2 warningsfile attachments.php 1 warningWARNING Optional parameter is provided before requiredfile file-gallery.php 1 warningWARNING Optional parameter is provided before requiredStatement has empty body inspection 41 warningsfile attachments-custom-fields.php 2 warningsWARNING Statement has empty bodyWARNING Statement has empty bodyfile InputStream.php 1 warningWARNING Statement has empty bodyfile Tokenizer.php 7 warningsWARNING Statement has empty bodyWARNING Statement has empty bodyWARNING Statement has empty bodyWARNING Statement has empty bodyWARNING Statement has empty bodyWARNING Statement has empty bodyWARNING Statement has empty bodyfile TreeBuilder.php 31 warningsWARNING Statement has empty bodyWARNING Statement has empty bodyWARNING Statement has empty bodyWARNING Statement has empty bodyWARNING Statement has empty bodyWARNING Statement has empty bodyWARNING Statement has empty bodyWARNING Statement has empty bodyWARNING Statement has empty bodyWARNING Statement has empty bodyWARNING Statement has empty bodyWARNING Statement has empty bodyWARNING Statement has empty bodyWARNING Statement has empty bodyWARNING Statement has empty bodyWARNING Statement has empty bodyWARNING Statement has empty bodyWARNING Statement has empty bodyWARNING Statement has empty bodyWARNING Statement has empty bodyWARNING Statement has empty bodyWARNING Statement has empty bodyWARNING Statement has empty bodyWARNING Statement has empty bodyWARNING Statement has empty bodyWARNING Statement has empty bodyWARNING Statement has empty bodyWARNING Statement has empty bodyWARNING Statement has empty bodyWARNING Statement has empty bodyWARNING Statement has empty bodyVoid function result used inspection 1 warningfile TreeBuilder.php 1 warningWARNING 'void' method 'emitToken' result usedType compatibility group 1 error 23 warningsArithmetic operation with unsupported operands inspection 1 errorfile attachments-custom-fields.php 1 errorERROR Unsupported operand types in '\unknown_type % int' will cause a PHP 8 TypeErrorIncompatible return type inspection 3 warningsfile attachments-custom-fields.php 3 warningsWARNING Return value type is not compatible with declaredWARNING Return value type is not compatible with declaredWARNING Return value type is not compatible with declaredParameter type inspection 20 warningsfile attachments-custom-fields.php 3 warningsWARNING Parameter '$count' type is not compatible with declarationWARNING Parameter '$metadata' type is not compatible with declarationWARNING Parameter '$post' type is not compatible with declarationfile templating.php 1 warningWARNING Parameter 'wp_get_attachment_link($attachment‑>ID)' type is not compatible with declarationfile Tokenizer.php 16 warningsWARNING Parameter 'self::WHITESPACE' type is not compatible with declarationWARNING Parameter '$mask' type is not compatible with declarationWARNING Parameter 'self::ALPHA' type is not compatible with declarationWARNING Parameter 'self::UPPER_ALPHA' type is not compatible with declarationWARNING Parameter '"\t\n\x0C />" . self::UPPER_ALPHA' type is not compatible with declarationWARNING Parameter 'self::UPPER_ALPHA' type is not compatible with declarationWARNING Parameter '"\t\n\x0C /=>\"'" . self::UPPER_ALPHA' type is not compatible with declarationWARNING Parameter ''"&'' type is not compatible with declarationWARNING Parameter '"'&"' type is not compatible with declarationWARNING Parameter '"\t\n\x0c &>\"'="' type is not compatible with declarationWARNING Parameter ''>'' type is not compatible with declarationWARNING Parameter ''‑'' type is not compatible with declarationWARNING Parameter 'self::ALPHA' type is not compatible with declarationWARNING Parameter ''‑'' type is not compatible with declarationWARNING Parameter 'self::ALPHA' type is not compatible with declarationWARNING Parameter '$char_class' type is not compatible with declarationUndefined symbols group 47 errors 19 warnings 27 weak warningsUndefined class inspection 16 warningsfile attachments-custom-fields.php 4 warningsWARNING Undefined class 'unknown_type'WARNING Undefined class 'unknown_type'WARNING Undefined class 'unknown'WARNING Undefined class 'unknown_type'file attachments.php 1 warningWARNING Undefined class 'echoes'file file-gallery.php 1 warningWARNING Undefined class 'Debug_Bar_Panel'file InputStream.php 3 warningsWARNING Undefined class 'Data'WARNING Undefined class 'Bytes'WARNING Undefined class 'Bytes'file Parser.php 6 warningsWARNING Undefined class 'HTML'WARNING Undefined class 'Custom'WARNING Undefined class 'Parsed'WARNING Undefined class 'HTML'WARNING Undefined class 'Custom'WARNING Undefined class 'Parsed'file Tokenizer.php 1 warningWARNING Undefined class 'Data'Undefined class constant inspection 1 errorfile TreeBuilder.php 1 errorERROR Constant 'INBODY' not foundUndefined constant inspection 1 errorfile media-tags.php 1 errorWARNING Undefined constant 'MEDIA_TAGS_URL'Undefined method inspection 3 warningsfile file-gallery.php 1 warningWARNING Method 'title' is undefinedfile regenerate-images.php 1 warningWARNING Method 'get_error_message' is undefinedfile TreeBuilder.php 1 warningWARNING Method 'insertToken' is undefinedUndefined property inspection 4 weak warningsfile attachments.php 2 weak warningsWARNING Property declared dynamicallyWARNING Property declared dynamicallyfile TreeBuilder.php 2 weak warningsWARNING Property declared dynamicallyWARNING Property declared dynamicallyUndefined variable inspection 45 errors 23 weak warningsfile attachments.php 2 weak warningsERROR Variable '$possible_new_attachments' is probably undefinedERROR Variable '$promoted_id' is probably undefinedfile file-gallery.php 1 errorERROR Undefined variable '$acf_localize'ERROR Undefined variable '$acf_options'ERROR Variable '$transient' is probably undefinedfile gallery.php 5 errors 1 weak warningERROR Undefined variable '$startcol'ERROR Undefined variable '$endcol'ERROR Undefined variable '$title'ERROR Undefined variable '$thumb_link'ERROR Undefined variable '$size'ERROR Variable '$title' is probably undefinedfile gallery.php 11 errors 1 weak warningERROR Undefined variable '$itemtag'ERROR Undefined variable '$startcol'ERROR Undefined variable '$endcol'ERROR Undefined variable '$icontag'ERROR Undefined variable '$title'ERROR Undefined variable '$thumb_link'ERROR Undefined variable '$thumb_width'ERROR Undefined variable '$thumb_height'ERROR Undefined variable '$size'ERROR Undefined variable '$thumb_alt'ERROR Variable '$title' is probably undefinedERROR Undefined variable '$captiontag'file gallery.php 11 errors 3 weak warningsERROR Undefined variable '$link'ERROR Undefined variable '$file_gallery_this_template_counter'ERROR Undefined variable '$link_class'ERROR Variable '$link' is probably undefinedERROR Undefined variable '$endcol'ERROR Variable '$diff' is probably undefinedERROR Undefined variable '$caption'ERROR Undefined variable '$thumb_link'ERROR Undefined variable '$thumb_width'ERROR Undefined variable '$thumb_height'ERROR Undefined variable '$title'ERROR Undefined variable '$size'ERROR Undefined variable '$thumb_alt'ERROR Variable '$link' is probably undefinedfile gallery.php 2 errors 1 weak warningERROR Undefined variable '$endcol'ERROR Undefined variable '$title'ERROR Variable '$title' is probably undefinedfile main-form.php 10 errors 7 weak warningsERROR Undefined variable '$output'ERROR Undefined variable '$checked_attachments'ERROR Undefined variable '$delete_what'ERROR Undefined variable '$post_id'ERROR Undefined variable '$gallery_state'ERROR Variable '$file_gallery_options' is probably undefinedERROR Variable '$gallery_state' is probably undefinedERROR Undefined variable '$sizes'ERROR Variable '$templates_dropdown' is probably undefinedERROR Variable '$templates_dropdown' is probably undefinedERROR Undefined variable '$single_state'ERROR Variable '$single_state' is probably undefinedERROR Variable '$post_id' is probably undefinedERROR Undefined variable '$files_or_tags'ERROR Undefined variable '$attachment_orderby'ERROR Undefined variable '$attachment_order'ERROR Variable '$post_id' is probably undefinedfile media-settings.php 2 errors 1 weak warningERROR Variable '$output' is probably undefinedERROR Undefined variable '$values'ERROR Undefined variable '$values'file mime-types.php 1 weak warningERROR Variable '$out' is probably undefinedfile templates-media-wp39.php 1 errorERROR Undefined variable '$post'file templates-media-wp40.php 1 errorERROR Undefined variable '$post'file templates-media-wp43.php 1 errorERROR Undefined variable '$post'file templating.php 1 weak warningERROR Variable '$transient' is probably undefinedfile Tokenizer.php 1 weak warningERROR Variable '$id' is probably undefinedfile TreeBuilder.php 4 weak warningsERROR Variable '$in_stack' is probably undefinedERROR Variable '$fe_af_pos' is probably undefinedERROR Variable '$fe_af_pos' is probably undefinedERROR Variable '$fe_af_pos' is probably undefined
       ```
   

The topic ‘PHP 8 errors’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/file-gallery_fdfbfb.svg)
 * [File Gallery](https://wordpress.org/plugins/file-gallery/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/file-gallery/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/file-gallery/)
 * [Active Topics](https://wordpress.org/support/plugin/file-gallery/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/file-gallery/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/file-gallery/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [odedstr2](https://wordpress.org/support/users/odedstr2/)
 * Last activity: [3 years, 1 month ago](https://wordpress.org/support/topic/php-8-errors-11/)
 * Status: not resolved