Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal error: Uncaught Error: count(): Argument #1 ($value) must be of type Countable|array, null given in /url-removed/wp-includes/blocks/footnotes.php #53397

Closed
oldrup opened this issue Aug 7, 2023 · 8 comments
Labels
[Block] Footnotes Affects the Footnotes Block Needs Testing Needs further testing to be confirmed. [Type] Bug An existing feature does not function as intended

Comments

@oldrup
Copy link

oldrup commented Aug 7, 2023

Description

Added a footnote to a post, viewed the post - all good, error when trying to edit post agin.

Step-by-step reproduction instructions

Add footnote to post
Save and view post
Attempt to edit post

Screenshots, screen recording, code snippet

image

In text form:
`Fatal error: Uncaught Error: count(): Argument #1 ($value) must be of type Countable|array, null given
in /url-removed/wp-includes/blocks/footnotes.php on line 37

Call stack:

render_block_core_footnotes()
wp-includes/class-wp-block.php:258
WP_Block::render()
wp-includes/class-wp-block.php:244
WP_Block::render()
wp-includes/blocks.php:1133
render_block()
wp-includes/blocks.php:1171
do_blocks()
wp-includes/class-wp-hook.php:310
WP_Hook::apply_filters()
wp-includes/plugin.php:205
apply_filters()
wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php:611
WP_REST_Revisions_Controller::prepare_item_for_response()
wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php:414
WP_REST_Autosaves_Controller::prepare_item_for_response()
wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php:310
WP_REST_Autosaves_Controller::get_items()
wp-includes/rest-api/class-wp-rest-server.php:1188
WP_REST_Server::respond_to_request()
wp-includes/rest-api/class-wp-rest-server.php:1035
WP_REST_Server::dispatch()
wp-includes/rest-api.php:545
rest_do_request()
wp-includes/rest-api.php:2911
rest_preload_api_request()
array_reduce()
wp-includes/block-editor.php:743
block_editor_rest_api_preload()
wp-admin/edit-form-blocks.php:77
require()
wp-admin/post.php:187`

Environment info

`

wp-core

version: 6.3-RC3
site_language: da_DK
user_language: en_US
timezone: Europe/Copenhagen
permalink: /%postname%/
https_status: true
multisite: false
user_registration: 0
blog_public: 0
default_comment_status: open
environment_type: production
user_count: 1
dotorg_communication: true

wp-paths-sizes

wordpress_path: /home/removed/removed
wordpress_size: 223,02 MB (233854205 bytes)
uploads_path: /home/removed/removed/wp-content/uploads
uploads_size: 178,29 MB (186953637 bytes)
themes_path: /home/removed/removed/wp-content/themes
themes_size: 19,66 MB (20610747 bytes)
plugins_path: /home/removed/removed/wp-content/plugins
plugins_size: 122,76 MB (128719576 bytes)
database_size: 42,70 MB (4477747 bytes)
total_size: 586,43 MB (614915637 bytes)

wp-dropins (1)

object-cache.php: true

wp-active-theme

name: Blocksy (blocksy)
version: 2.0.0-beta14
author: CreativeThemes
author_website: https://creativethemes.com
parent_theme: none
theme_features: core-block-patterns, block-templates, widgets-block-editor, automatic-feed-links, responsive-embeds, html5, title-tag, custom-logo, lifterlms-sidebars, boostify-header-footer, fl-theme-builder-headers, fl-theme-builder-footers, fl-theme-builder-parts, editor-styles, editor-style, editor-color-palette, editor-gradient-presets, post-thumbnails, menus, align-wide, customize-selective-refresh-widgets, header-footer-elementor, widgets
theme_path: /home/removed/removed/wp-content/themes/blocksy
auto_update: Disabled

wp-themes-inactive (3)

Twenty Twenty-One: version: 1.9, author: the WordPress team, Auto-updates disabled
Twenty Twenty-Three: version: 1.2, author: the WordPress team, Auto-updates disabled
Twenty Twenty-Two: version: 1.5, author: the WordPress team, Auto-updates disabled

wp-plugins-active (23)

Activity Log: version: 2.8.7, author: Activity Log Team, Auto-updates disabled
Admin Columns Pro: version: 6.2.2, author: AdminColumns.com, Auto-updates disabled
Advanced Custom Fields: version: 6.1.8, author: WP Engine, Auto-updates disabled
Asset CleanUp: Page Speed Booster: version: 1.3.9.3, author: Gabe Livan, Auto-updates disabled
Blocksy Companion (Premium): version: 2.0.0-beta14, author: CreativeThemes, Auto-updates disabled
Clean Image Filenames: version: 1.4, author: Upperdog, Auto-updates enabled
Content Aware Sidebars: version: 3.19.1, author: Joachim Jensen - DEV Institute, Auto-updates disabled
Easy FancyBox: version: 1.9.5, author: RavanH, Auto-updates disabled
Exclude Image Thumbnails From UpdraftPlus Backups: version: 1.0.3, author: Dream-Encode, Auto-updates disabled
Getwid: version: 1.9.1, author: MotoPress, Auto-updates disabled
LiteSpeed Cache: version: 5.5.1, author: LiteSpeed Technologies, Auto-updates disabled
Loco Translate: version: 2.6.4, author: Tim Whitlock, Auto-updates enabled
Polylang: version: 3.4.5, author: WP SYNTEX, Auto-updates disabled
Query Monitor: version: 3.13.1, author: John Blackbourn, Auto-updates disabled
Real Custom Post Order: version: 1.3.59, author: devowl.io, Auto-updates disabled
Simple Local Avatars: version: 2.7.5, author: 10up, Auto-updates disabled
The Icon Block: version: 1.6.0, author: Nick Diego, Auto-updates disabled
The SEO Framework: version: 4.2.8, author: The SEO Framework Team, Auto-updates disabled
UpdraftPlus - Backup/Restore: version: 1.23.7, author: UpdraftPlus.Com, DavidAnderson, Auto-updates enabled
Wordfence Security: version: 7.10.3, author: Wordfence, Auto-updates enabled
WordPress Beta Tester: version: 3.5.2, author: WordPress Upgrade/Install Team, Auto-updates disabled
WPCodeBox 2: version: 1.0.3, author: WPCodeBox, Auto-updates disabled
WP Performance Pack: version: 2.5.3, author: Björn Ahrens, Auto-updates disabled

wp-plugins-inactive (9)

Accessibility Checker: version: 1.4.2, author: Equalize Digital, Auto-updates disabled
Admin Columns: version: 4.6.1, author: AdminColumns.com, Auto-updates enabled
Akismet Anti-Spam: Spam Protection: version: 5.2, author: Automattic - Anti Spam Team, Auto-updates disabled
Code Snippets: version: 3.4.2, author: Code Snippets Pro, Auto-updates disabled
Email Address Encoder: version: 1.0.22, author: Till Krüss, Auto-updates enabled
Password Protected: version: 2.6.4, author: WPExperts, Auto-updates disabled
Simple Custom CSS and JS PRO: version: 4.34, author: SilkyPress.com, Auto-updates disabled
TinyPNG - JPEG, PNG & WebP image compression: version: 3.4.1, author: TinyPNG, Auto-updates enabled
WP Htaccess Editor: version: 1.71, author: WebFactory Ltd, Auto-updates disabled

wp-media

image_editor: WP_Image_Editor_Imagick
imagick_module_version: 1808
imagemagick_version: ImageMagick 7.1.0-62 Q16-HDRI x86_64 20885 https://imagemagick.org
imagick_version: 3.7.0
file_uploads: File uploads is turned off
post_max_size: 50M
upload_max_filesize: 50M
max_effective_size: 50 MB
max_file_uploads: 20
imagick_limits:
imagick::RESOURCETYPE_AREA: 314 GB
imagick::RESOURCETYPE_DISK: 9.2233720368548E+18
imagick::RESOURCETYPE_FILE: 37500
imagick::RESOURCETYPE_MAP: 157 GB
imagick::RESOURCETYPE_MEMORY: 79 GB
imagick::RESOURCETYPE_THREAD: 1
imagick::RESOURCETYPE_TIME: 9.2233720368548E+18
imagemagick_file_formats: 3FR, 3G2, 3GP, AAI, AI, APNG, ART, ARW, ASHLAR, AVI, AVIF, AVS, BAYER, BAYERA, BGR, BGRA, BGRO, BIE, BMP, BMP2, BMP3, BRF, CAL, CALS, CANVAS, CAPTION, CIN, CIP, CLIP, CMYK, CMYKA, CR2, CR3, CRW, CUBE, CUR, CUT, DATA, DCM, DCR, DCRAW, DCX, DDS, DFONT, DNG, DOT, DPX, DXT1, DXT5, EPDF, EPI, EPS, EPS2, EPS3, EPSF, EPSI, EPT, EPT2, EPT3, ERF, EXR, FARBFELD, FAX, FF, FILE, FITS, FL32, FLV, FRACTAL, FTP, FTS, FTXT, G3, G4, GIF, GIF87, GRADIENT, GRAY, GRAYA, GROUP4, GV, HALD, HDR, HEIC, HEIF, HISTOGRAM, HRZ, HTM, HTML, HTTP, HTTPS, ICB, ICO, ICON, IIQ, INFO, INLINE, IPL, ISOBRL, ISOBRL6, J2C, J2K, JBG, JBIG, JNG, JNX, JP2, JPC, JPE, JPEG, JPG, JPM, JPS, JPT, JSON, K25, KDC, KERNEL, LABEL, M2V, M4V, MAC, MAP, MASK, MAT, MATTE, MEF, MIFF, MKV, MNG, MONO, MOV, MP4, MPC, MPEG, MPG, MRW, MSL, MSVG, MTV, MVG, NEF, NRW, NULL, ORA, ORF, OTB, OTF, PAL, PALM, PAM, PANGO, PATTERN, PBM, PCD, PCDS, PCL, PCT, PCX, PDB, PDF, PDFA, PEF, PES, PFA, PFB, PFM, PGM, PGX, PHM, PICON, PICT, PIX, PJPEG, PLASMA, PNG, PNG00, PNG24, PNG32, PNG48, PNG64, PNG8, PNM, POCKETMOD, PPM, PS, PS2, PS3, PSB, PSD, PTIF, PWP, QOI, RADIAL-GRADIENT, RAF, RAS, RAW, RGB, RGB565, RGBA, RGBO, RGF, RLA, RLE, RMF, RSVG, RW2, SCR, SCT, SFW, SGI, SHTML, SIX, SIXEL, SPARSE-COLOR, SR2, SRF, STEGANO, STRIMG, SUN, SVG, SVGZ, TEXT, TGA, THUMBNAIL, TIFF, TIFF64, TILE, TIM, TM2, TTC, TTF, TXT, UBRL, UBRL6, UIL, UYVY, VDA, VICAR, VID, VIFF, VIPS, VST, WBMP, WEBM, WEBP, WMF, WMV, WMZ, WPG, X, X3F, XBM, XC, XCF, XPM, XPS, XV, XWD, YAML, YCbCr, YCbCrA, YUV
gd_version: 2.3.3
gd_formats: GIF, JPEG, PNG, WebP, BMP, AVIF, XPM
ghostscript_version: 9.25

wp-server

server_architecture: Linux 3.10.0-962.3.2.lve1.5.64.el7.x86_64 x86_64
httpd_software: LiteSpeed
php_version: 8.1.21 64bit
php_sapi: litespeed
max_input_variables: 3000
time_limit: 90
memory_limit: 256M
max_input_time: 90
upload_max_filesize: 50M
php_post_max_size: 50M
curl_version: 7.87.0 OpenSSL/1.1.1p
suhosin: false
imagick_availability: true
pretty_permalinks: true
htaccess_extra_rules: true
current: 2023-08-07T15:51:19+00:00
utc-time: Monday, 07-Aug-23 15:51:19 UTC
server-time: 2023-08-07T17:51:17+02:00

wp-database

extension: mysqli
server_version: 10.5.21-MariaDB-cll-lve
client_version: mysqlnd 8.1.21
max_allowed_packet: 268435456
max_connections: 800

wp-constants

WP_HOME: undefined
WP_SITEURL: undefined
WP_CONTENT_DIR: /home/removed/removed/wp-content
WP_PLUGIN_DIR: /home/removed/removed/wp-content/plugins
WP_MEMORY_LIMIT: 40M
WP_MAX_MEMORY_LIMIT: 256M
WP_DEBUG: true
WP_DEBUG_DISPLAY: true
WP_DEBUG_LOG: false
SCRIPT_DEBUG: false
WP_CACHE: true
CONCATENATE_SCRIPTS: undefined
COMPRESS_SCRIPTS: undefined
COMPRESS_CSS: undefined
WP_ENVIRONMENT_TYPE: production
WP_DEVELOPMENT_MODE: undefined
DB_CHARSET: utf8mb4
DB_COLLATE: undefined

wp-filesystem

wordpress: writable
wp-content: writable
uploads: writable
plugins: writable
themes: writable
mu-plugins: writable

pll_options

browser: 1: Detect browser language activated
rewrite: 1: Remove /language/ in pretty permalinks
hide_default: 1: Hide URL language information for default language
force_lang: 1: The language is set from the directory name in pretty permalinks
redirect_lang: 0: The front page URL contains the page name or page id instead of the language code
media_support: 0: The media are not translated
sync:
0: taxonomies
1: post_date
2: post_format
3: menu_order
4: _thumbnail_id
post_types: post, page, wp_block
taxonomies: category, post_tag
version: 3.4.5
default_lang: da
previous_version: 3.4.4
menu_1: da => 10 | en => 93
menu_2: da => 0 | en => 0
menu_3: da => 0 | en => 0
footer: da => 10 | en => 93
footer_2: da => 0 | en => 0
menu_mobile: da => 10 | en => 93
menu_mobile_2: da => 0 | en => 0

pll_language_da

name: På Dansk
slug: da
term_group: 0
term_id: 17
locale: da_DK
is_rtl: 0
w3c: da-DK
facebook: da_DK
home_url: https://removed/
search_url: https://removed/
page_on_front: 4563
page_for_posts: 0
flag_code: dk
flag_url: https://removed/wp-content/plugins/polylang/flags/dk.png
custom_flag_url: 0
active: true
fallbacks: 0
is_default: true
term_props:
language/term_id: 17
language/term_taxonomy_id: 17
language/count: 9
term_language/term_id: 18
term_language/term_taxonomy_id: 18
term_language/count: 7

pll_language_en

name: In English
slug: en
term_group: 1
term_id: 140
locale: en_US
is_rtl: 0
w3c: en-US
facebook: en_US
home_url: https://removed/en/home/
search_url: https://removed/en/
page_on_front: 7217
page_for_posts: 0
flag_code: us
flag_url: https://removed/wp-content/plugins/polylang/flags/us.png
custom_flag_url: 0
active: true
fallbacks: 0
is_default: 0
term_props:
language/term_id: 140
language/term_taxonomy_id: 140
language/count: 8
term_language/term_id: 141
term_language/term_taxonomy_id: 141
term_language/count: 7

pll_warnings

wpml:
plugins/autodescription: /home/removed/removed/wp-content/plugins/autodescription/wpml-config.xml
plugins/content-aware-sidebars: /home/removed/removed/wp-content/plugins/content-aware-sidebars/wpml-config.xml
themes/blocksy: /home/removed/removed/wp-content/themes/blocksy/wpml-config.xml

`

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@jordesign
Copy link
Contributor

Thanks for the report @oldrup! Could you please try testing again with a default theme (like TwentyTwentyThree) active, and all plugins disabled to see if the error still occurs?

@jordesign jordesign added [Type] Bug An existing feature does not function as intended [Status] Needs More Info Follow-up required in order to be actionable. [Block] Footnotes Affects the Footnotes Block labels Aug 8, 2023
@oldrup
Copy link
Author

oldrup commented Aug 8, 2023

I forgot one apparently crucial step on how to reproduce:
4. Put the footnote block in a Group block (for styling purposes).

Here how it looks in TwentyTwentyThree:
image

Trying to edit that post, and WordPress crashes.

I can of course delete, the post and carry on. Or use a plugin to restore a previous revision, delete all revisions, and then edit the post.

It's an edge case. But I don't think I'm the only one who will attempt to put the footnote block into a group block for styling.

Oh, and RC4 now, btw.

@oldrup
Copy link
Author

oldrup commented Aug 8, 2023

Ah. Console reveals an interesting thing. Even if I changed to a default theme afterwards, errors seems to relate to the theme I originally created the post in. I now both created and edited a post containing foodnotes in a group, without any errors; not reproducing the error.

Will troubleshoot futher with theme developers instead ;)

@oldrup oldrup closed this as completed Aug 8, 2023
@markhowellsmead
Copy link

markhowellsmead commented Aug 8, 2023

@oldrup This error is now occurring on my site. PHP 8.1, WordPress 6.3 and Twenty Twenty Three theme, no other plugins in use. Just added a single unformatted footnote, tried to save the post and now the editor and the public view of the post throw the fatal error.

@jordesign jordesign added Needs Testing Needs further testing to be confirmed. and removed [Status] Needs More Info Follow-up required in order to be actionable. labels Aug 8, 2023
@oldrup
Copy link
Author

oldrup commented Aug 9, 2023

@markhowellsmead If you need to roll back the edits of the post, here's what worked for me:

  • Install https://wordpress.org/plugins/revisionary/ to be able to restore a previous revision (without the footnote) of the post. With the plugin, you can restore revisions, without opening the editor (which might crash)
  • Use your caching plugin or DB optimization procedure, to purge all revisions. The editor might crash, even though you rolled back the pre-footnote, just because there is a footnote in some of the revisions.
  • Obviously, you should to some backuping before.

@topher1kenobe
Copy link

I've now gotten it on a fresh install, 2023 theme, no plugins, never changed themes.

@tellthemachines
Copy link
Contributor

Do the footnotes on the page that errors have quotes in them? If so, it might be this bug which has already been fixed in Gutenberg and will be added to core when 6.3.1 is released - likely early next week.

@hellofromtonya
Copy link
Contributor

This issue was also reported in WP Core's Trac. I closed the Trac ticket and redirected folks to here if the problem still persists today,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Footnotes Affects the Footnotes Block Needs Testing Needs further testing to be confirmed. [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

6 participants