Undefined Variable Warnings
-
When attempting to upload video files through the WordPress media library, I receive the error: “Unexpected response from the server. The file may have been uploaded successfully. Check in the media library or reload the page.” The videos do not appear in the media library after this error.
The server logs show multiple PHP warnings related to undefined $media variables in the WP-Stateless plugin’s class-sync-non-media.php file, along with “Media object is not valid or empty” messages.
Error Log Excerpt:
[19-Apr-2025 14:46:03 UTC] PHP Warning: Undefined variable $media in /home/runcloud/webapps/app-medelevus/wp-content/plugins/wp-stateless/lib/classes/class-sync-non-media.php on line 189[19-Apr-2025 14:46:03 UTC] PHP Warning: Undefined variable $media in ... on line 198[19-Apr-2025 14:46:03 UTC] Media object is not valid or empty. Unable to update non-library file.[19-Apr-2025 14:46:03 UTC] PHP Warning: Undefined variable $media in ... on line 200[19-Apr-2025 14:46:11 UTC] PHP Deprecated: Creation of dynamic property wpCloud\StatelessMedia\SyncNonMedia::$client is deprecated in ... on line 101Environment Details:
WP-Stateless Version: 4.1.3
WordPress Version: 6.8
PHP Version: 8.3.17
Mode: Stateless
Bucket: Configured and accessible
Supported File Types includes mp4, mov, avi, mkv, webm
Plugins: Elementor Pro, WooCommerce, Ultimate Member, and others (full list in status)Steps to Reproduce:
Go to Media → Add New
Upload a video file (tested with MP4)
The upload progress completes but then shows the error messageExpected Behavior:
Video should upload successfully to Google Cloud Storage and appear in the media library.Additional Information:
The issue occurs consistently with video files (images seem to work fine)
There are also multiple “_load_textdomain_just_in_time” notices from various plugins, though I’m not sure if they’re related
The server has sufficient resources (512MB PHP memory, 600s timeout, 2048MB upload limit)Plugin Status Report:
### Server Server architecture: Linux 6.8.0-1026-gcp x86_64 Web server: Apache/2.4.63 (Unix) OpenSSL/3.0.2 MySQL version: 10.11.11-MariaDB-ubu2204 MySQL default engine: InnoDB PHP Version: 8.3.17 PHP Memory Limit: 512M PHP Max Input Vars: 1000 PHP Max Post Size: 2048M PHP Time Limit: 600 Max Upload Size: 2048M Allow URL-aware fopen Wrappers: Yes Loaded Extensions: Core, date, libxml, openssl, pcre, zlib, dom, enchant, FFI, filter, gmp, hash, json, pcntl, random, Reflection, SPL, session, standard, cgi-fcgi, mysqlnd, PDO, readline, xml, xmlreader, xmlwriter, bcmath, bz2, calendar, ctype, curl, mbstring, fileinfo, ftp, gd, gettext, iconv, igbinary, imap, intl, exif, memcache, memcached, msgpack, mysqli, pdo_mysql, pdo_sqlite, Phar, posix, pspell, realpath_turbo, redis, shmop, SimpleXML, soap, sockets, sodium, sqlite3, swoole, sysvmsg, sysvsem, sysvshm, tidy, timezonedb, tokenizer, xmlrpc, xsl, zip, Zend OPcache ### WordPress Home URL: https://medelevus.com Site URL: https://medelevus.com Version: 6.8 Multisite: No Memory Limit: 40M Total Attachments: 1050 Image Sizes (17): (150x150) thumbnail, (300x300) medium, (768x0) medium_large, (1024x1024) large, 1536x1536, 2048x2048, (0x0) gamipress-points, (0x0) gamipress-achievement, (0x0) gamipress-rank, (0x0) woocommerce_thumbnail, (0x0) woocommerce_single, (0x0) woocommerce_gallery_thumbnail, (0x0) profile_24, (0x0) profile_48, (0x0) profile_96, (0x0) profile_150, (0x0) profile_300 Theme: Astra 4.10.0 Active Plugins: Adminimize 1.11.11, Advanced Custom Fields 6.4.0.1, All-In-One Security (AIOS) 5.4.0, Big File Uploads 2.1.6, Code Snippets 3.6.8, Contact Form 7 6.0.6, CURCY - Multi Currency for WooCommerce 2.2.8, Elementor 3.28.3, Elementor Pro 3.28.3, EWWW Image Optimizer 8.1.3, Flamingo 2.5, FV Player 7.5.49.7212, FV Player Pro 7.5.50.7212, GamiPress 7.3.6.3, Honeypot for Contact Form 7 2.1.7, LearnPress 4.2.8.2, LearnPress - Certificates 4.1.4, LearnPress - Content Drip 4.0.7, LearnPress - Course Review 4.1.5, LearnPress - Course Wishlist 4.0.8, LearnPress - Live Course Add-on 4.0.2, LearnPress - Prerequisites Courses 4.0.8, LearnPress - Students List 4.0.2, LearnPress - WooCommerce Payment Methods Integration 4.1.6, LiteSpeed Cache 7.0.1, LoginPress 4.0.1, Paymob for WooCommerce 3.1.1, Profile Builder 3.13.7, Redirection 5.5.2, Site Kit by Google 1.150.0, Ultimate Addons for Elementor Lite 2.3.0, Ultimate Member 2.10.2, Unlimited Elements for Elementor (Premium) 1.5.129, UpdraftPlus - Backup/Restore 1.25.5, WooCommerce 9.8.1, WooCommerce PayPal Payments 3.0.3, WP-Stateless 4.1.3, WP-Stateless - Elementor Website Builder Addon 0.0.4, WP-Stateless - LiteSpeed Cache Addon 0.0.1, WP Activity Log 5.3.4.1, WP Content Copy Protection & No Right Click 3.6.3, WP Mail SMTP 4.4.0, WP Mobile Bottom Menu 1.3.0, WP phpMyAdmin 5.2.1.13, Yoast SEO 24.9 ### WP-Stateless Version: 4.1.3 Database Version: 1.2 Mode: Stateless File URL Replacement: Enable Editor & Meta Supported File Types: jpg jpeg png gif pdf mp4 mov avi mkv webm Bucket: Set Bucket Accessible: Yes Service Account JSON: Set Cache-Control: Default: public, max-age=36000, must-revalidate Delete GCS File: Enable Folder: media Domain: Not set Cache-Busting: Enable Dynamic Image Support: Disable Use Site URL for REST API Requests: WP_HOME REST API Status: Ok AJAX Status: Ok Use Post Meta: Enable Total Files: 1 Total File Sizes: 0 Compatibility Files: 0 Data Optimization: 20240423174109: Skipped, 20240219175240: Finished ### Google Cloud Storage Class: STANDARD Public Access Prevention: Inherited Access Control: Uniform Versioning: Enabled Soft Delete: EnabledCould you please help identify why the media object is not being properly handled during video uploads and how to resolve this issue?
The topic ‘Undefined Variable Warnings’ is closed to new replies.