10up / simple-podcasting

A simple podcasting solution for WordPress.
https://wordpress.org/plugins/simple-podcasting/
GNU General Public License v2.0
185 stars 30 forks source link

PHP 8.1 throws deprecation warnings: passing null to `strpos()` and `str_replace()` #231

Closed peterwilsoncc closed 1 year ago

peterwilsoncc commented 1 year ago

Describe the bug

The plugin is throwing two deprecation warnings on all admin screens when running PHP 8.1:

This is caused by the PHP 8.1 deprecation of Passing null to non-nullable internal function parameters is deprecated.

Steps to Reproduce

  1. Ensure debug logging is enabled
  2. Activate plugin
  3. Navigate through admin
  4. Observe deprecation notices thrown on each screen (Query Monitor may help here)

Screenshots, screen recording, code snippet

Stack trace, although it varies a little on each screen:

[12-Apr-2023 00:25:25 UTC] PHP Deprecated:  strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /vagrant/wp-build/wp-includes/functions.php on line 7053
[12-Apr-2023 00:25:25 UTC] PHP Stack trace:
[12-Apr-2023 00:25:25 UTC] PHP   1. {main}() /vagrant/wp-build/wp-admin/upload.php:0
[12-Apr-2023 00:25:25 UTC] PHP   2. require_once() /vagrant/wp-build/wp-admin/upload.php:10
[12-Apr-2023 00:25:25 UTC] PHP   3. require() /vagrant/wp-build/wp-admin/admin.php:158
[12-Apr-2023 00:25:25 UTC] PHP   4. require_once() /vagrant/wp-build/wp-admin/menu.php:420
[12-Apr-2023 00:25:25 UTC] PHP   5. do_action($hook_name = 'admin_menu', ...$arg = variadic('')) /vagrant/wp-build/wp-admin/includes/menu.php:155
[12-Apr-2023 00:25:25 UTC] PHP   6. WP_Hook->do_action($args = [0 => '']) /vagrant/wp-build/wp-includes/plugin.php:517
[12-Apr-2023 00:25:25 UTC] PHP   7. WP_Hook->apply_filters($value = '', $args = [0 => '']) /vagrant/wp-build/wp-includes/class-wp-hook.php:332
[12-Apr-2023 00:25:25 UTC] PHP   8. tenup_podcasting\admin\register_onoarding_page('') /vagrant/wp-build/wp-includes/class-wp-hook.php:308
[12-Apr-2023 00:25:25 UTC] PHP   9. add_submenu_page($parent_slug = NULL, $page_title = 'Simple Podcasting Onboarding', $menu_title = '', $capability = 'manage_options', $menu_slug = 'simple-podcasting-onboarding', $callback = '\\tenup_podcasting\\admin\\render_page_contents', $position = *uninitialized*) /vagrant/content/plugins/simple-podcasting/includes/admin/onboarding.php:20
[12-Apr-2023 00:25:25 UTC] PHP  10. plugin_basename($file = NULL) /vagrant/wp-build/wp-admin/includes/plugin.php:1405
[12-Apr-2023 00:25:25 UTC] PHP  11. wp_normalize_path($path = NULL) /vagrant/wp-build/wp-includes/plugin.php:768
[12-Apr-2023 00:25:25 UTC] PHP  12. wp_is_stream($path = NULL) /vagrant/wp-build/wp-includes/functions.php:2158
[12-Apr-2023 00:25:25 UTC] PHP  13. strpos($haystack = NULL, $needle = '://') /vagrant/wp-build/wp-includes/functions.php:7053
[12-Apr-2023 00:25:25 UTC] PHP Deprecated:  str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /vagrant/wp-build/wp-includes/functions.php on line 2165
[12-Apr-2023 00:25:25 UTC] PHP Stack trace:
[12-Apr-2023 00:25:25 UTC] PHP   1. {main}() /vagrant/wp-build/wp-admin/upload.php:0
[12-Apr-2023 00:25:25 UTC] PHP   2. require_once() /vagrant/wp-build/wp-admin/upload.php:10
[12-Apr-2023 00:25:25 UTC] PHP   3. require() /vagrant/wp-build/wp-admin/admin.php:158
[12-Apr-2023 00:25:25 UTC] PHP   4. require_once() /vagrant/wp-build/wp-admin/menu.php:420
[12-Apr-2023 00:25:25 UTC] PHP   5. do_action($hook_name = 'admin_menu', ...$arg = variadic('')) /vagrant/wp-build/wp-admin/includes/menu.php:155
[12-Apr-2023 00:25:25 UTC] PHP   6. WP_Hook->do_action($args = [0 => '']) /vagrant/wp-build/wp-includes/plugin.php:517
[12-Apr-2023 00:25:25 UTC] PHP   7. WP_Hook->apply_filters($value = '', $args = [0 => '']) /vagrant/wp-build/wp-includes/class-wp-hook.php:332
[12-Apr-2023 00:25:25 UTC] PHP   8. tenup_podcasting\admin\register_onoarding_page('') /vagrant/wp-build/wp-includes/class-wp-hook.php:308
[12-Apr-2023 00:25:25 UTC] PHP   9. add_submenu_page($parent_slug = NULL, $page_title = 'Simple Podcasting Onboarding', $menu_title = '', $capability = 'manage_options', $menu_slug = 'simple-podcasting-onboarding', $callback = '\\tenup_podcasting\\admin\\render_page_contents', $position = *uninitialized*) /vagrant/content/plugins/simple-podcasting/includes/admin/onboarding.php:20
[12-Apr-2023 00:25:25 UTC] PHP  10. plugin_basename($file = NULL) /vagrant/wp-build/wp-admin/includes/plugin.php:1405
[12-Apr-2023 00:25:25 UTC] PHP  11. wp_normalize_path($path = NULL) /vagrant/wp-build/wp-includes/plugin.php:768
[12-Apr-2023 00:25:25 UTC] PHP  12. str_replace($search = '\\', $replace = '/', $subject = NULL) /vagrant/wp-build/wp-includes/functions.php:2165

Environment information

WordPress information

Site Health Info ``` ### wp-core ### version: 6.2.1-alpha-55611 site_language: en_US user_language: en_US timezone: +00:00 permalink: undefined https_status: false multisite: false user_registration: 0 blog_public: 1 default_comment_status: open environment_type: local user_count: 1 dotorg_communication: true ### wp-paths-sizes ### wordpress_path: /vagrant/wp-build wordpress_size: loading... uploads_path: /vagrant/content/uploads uploads_size: loading... themes_path: /vagrant/content/themes themes_size: loading... plugins_path: /vagrant/content/plugins plugins_size: loading... database_size: loading... total_size: loading... ### wp-dropins (1) ### db.php: true ### wp-active-theme ### name: Twenty Twenty-Three (twentytwentythree) version: 1.1 author: the WordPress team author_website: https://wordpress.org parent_theme: none theme_features: core-block-patterns, post-thumbnails, responsive-embeds, editor-styles, html5, automatic-feed-links, block-templates, widgets-block-editor theme_path: /vagrant/wp-build/wp-content/themes/twentytwentythree ### wp-themes-inactive (12) ### Twenty Eleven: version: 4.3, author: the WordPress team Twenty Fifteen: version: 3.4, author: the WordPress team Twenty Fourteen: version: 3.6, author: the WordPress team Twenty Nineteen: version: 2.5, author: the WordPress team Twenty Seventeen: version: 3.2, author: the WordPress team Twenty Sixteen: version: 2.9, author: the WordPress team Twenty Ten: version: 3.8, author: the WordPress team Twenty Thirteen: version: 3.8, author: the WordPress team Twenty Twelve: version: 3.9, author: the WordPress team Twenty Twenty: version: 2.2, author: the WordPress team Twenty Twenty-One: version: 1.8, author: the WordPress team Twenty Twenty-Two: version: 1.4, author: the WordPress team ### wp-mu-plugins (6) ### ad-refresh-tests.php: author: (undefined), version: (undefined) ctp.php: author: (undefined), version: (undefined) no-rest.php: author: (undefined), version: (undefined) no-ssl.php: author: (undefined), version: (undefined) rsa-allow-private-range.php: author: (undefined), version: (undefined) spa-sortable-posts.php: author: (undefined), version: (undefined) ### wp-plugins-active (3) ### Query Monitor: version: 3.12.1, author: John Blackbourn Simple Podcasting: version: 1.4.0, author: 10up User Switching: version: 1.7.0, author: John Blackbourn & contributors ### wp-plugins-inactive (20) ### Accessibility CheckUp: version: 1.2.2, author: 10up Ad Refresh Control: version: 1.1.1, author: 10up Ads.txt Manager: version: 1.4.2, author: 10up Autoshare for Twitter: version: 1.3.0, author: 10up Block for Apple Maps: version: 1.1.0, author: 10up Classic Editor: version: 1.6.3, author: WordPress Contributors Convert to Blocks: version: 1.1.1, author: 10up Eight Day Week: version: 1.2.1, author: 10up Insecure Content Warning: version: 1.0.3, author: 10up Insert Special Characters: version: 1.0.6, author: 10up Mention Notifier: version: 0.0.1, author: 10up Publisher Media Kit: version: 1.3.1, author: 10up Restricted Site Access: version: 7.3.5, author: 10up Retro Winamp Block: version: 1.2.0, author: 10up Safe Redirect Manager: version: 1.11.1, author: 10up Safe SVG: version: 2.1.1, author: 10up Simple Google News Sitemap: version: 1.0.2, author: 10up Simple Local Avatars: version: 2.7.4, author: 10up Simple Page Ordering: version: 2.4.4, author: 10up Speedy SEO: version: 0.1.0, author: 10up ### wp-media ### image_editor: WP_Image_Editor_GD imagick_module_version: Not available imagemagick_version: Not available imagick_version: Not available file_uploads: File uploads is turned off post_max_size: 1024M upload_max_filesize: 1024M max_effective_size: 1 GB max_file_uploads: 20 gd_version: 2.3.3 gd_formats: GIF, JPEG, PNG, WebP, BMP, AVIF, XPM ghostscript_version: not available ### wp-server ### server_architecture: Linux 5.15.0-30-generic x86_64 httpd_software: nginx/1.18.0 php_version: 8.1.17 64bit php_sapi: fpm-fcgi max_input_variables: 1000 time_limit: 900 memory_limit: 128M admin_memory_limit: 256M max_input_time: 900 upload_max_filesize: 1024M php_post_max_size: 1024M curl_version: 7.81.0 OpenSSL/3.0.2 suhosin: false imagick_availability: false pretty_permalinks: true ### wp-database ### extension: mysqli server_version: 8.0.30-0ubuntu0.22.04.1 client_version: mysqlnd 8.1.17 max_allowed_packet: 16777216 max_connections: 151 ### wp-constants ### WP_HOME: http://xu-osp-plugins.local WP_SITEURL: http://xu-osp-plugins.local/wp WP_CONTENT_DIR: /vagrant/content WP_PLUGIN_DIR: /vagrant/content/plugins WP_MEMORY_LIMIT: 40M WP_MAX_MEMORY_LIMIT: 256M WP_DEBUG: true WP_DEBUG_DISPLAY: false WP_DEBUG_LOG: true SCRIPT_DEBUG: true WP_CACHE: false CONCATENATE_SCRIPTS: undefined COMPRESS_SCRIPTS: undefined COMPRESS_CSS: undefined WP_ENVIRONMENT_TYPE: local DB_CHARSET: utf8 DB_COLLATE: undefined ### wp-filesystem ### wordpress: writable wp-content: writable uploads: writable plugins: writable themes: writable mu-plugins: writable ``` ### Code of Conduct - [X] I agree to follow this project's Code of Conduct