Yoast / Yoast/duplicate-post

The script tried to modify a property on an incomplete object.

Open
#316 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
53
Forks
38
Avg merge
4d 8h
Merged PRs (30d)
1

Description

  • I've searched for any related issues and avoided creating a duplicate issue.
Please give us a description of what happened

Recently, the function "new draft" in the post list started throwing an uncaught PHP error and shows the white screen with "Your page encountered a severe issue." instead of the WP admin backend. Something goes wrong inside the duplicate_post function as it looks...

To Reproduce
Step-by-step reproduction instructions
  1. In the post list, click on "New draft"
Expected results
  1. The post is cloned into a new draft without errors.
Actual results
  1. The post is cloned into a new draft and an uncaught PHP error is issued: The script tried to modify a property on an incomplete object.
Screenshots, screen recording, code snippet

[30-Jul-2023 08:16:07 UTC] PHP Fatal error: Uncaught Error: The script tried to modify a property on an incomplete object. Please ensure that the class definition "Wpil_Model_Link" of the object you are trying to operate on was loaded before unserialize() gets called or provide an autoloader to load the class definition in /var/web/site/public_html/wp-includes/formatting.php:5058

PHP Stacktrace:

undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
/var/web/site/public_html/wp-includes/formatting.php(5053): map_deep(Object(__PHP_Incomplete_Class), 'duplicate_post_...')
/var/web/site/public_html/wp-content/plugins/duplicate-post/admin-functions.php(400): map_deep(Array, 'duplicate_post_...')
/var/web/site/public_html/wp-content/plugins/duplicate-post/admin-functions.php(424): duplicate_post_addslashes_deep(Array)
/var/web/site/public_html/wp-content/plugins/duplicate-post/admin-functions.php(386): duplicate_post_wp_slash(Array)
/var/web/site/public_html/wp-includes/class-wp-hook.php(310): duplicate_post_copy_post_meta_info(19351, Object(WP_Post))
/var/web/site/public_html/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters('', Array)
/var/web/site/public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
/var/web/site/public_html/wp-content/plugins/duplicate-post/admin-functions.php(721): do_action('dp_duplicate_po...', 19351, Object(WP_Post), 'draft')
/var/web/site/public_html/wp-content/plugins/duplicate-post/src/handlers/link-handler.php(87): duplicate_post_create_duplicate(Object(WP_Post), 'draft')
/var/web/site/public_html/wp-includes/class-wp-hook.php(308): Yoast\WP\Duplicate_Post\Handlers\Link_Handler->new_draft_link_action_handler('')
/var/web/site/public_html/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters('', Array)
/var/web/site/public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
/var/web/site/public_html/wp-admin/admin.php(419): do_action('admin_action_du...')
{main} thrown in /var/web/site/public_html/wp-includes/formatting.php on line 5058
Technical info
  • If relevant, which editor is affected (or editors):
  • Block Editor
  • Gutenberg Editor
  • Classic Editor
  • Other:
  • Which browser is affected (or browsers):
  • Chrome
  • Firefox
  • Safari
  • Other:
Used versions
  • Device you are using: HP ENVY x360
  • Operating system: Windows 11 Home
  • PHP version: 8.0
  • WordPress version: 6.2.2
  • WordPress Theme: Astra 4.1.6
  • Yoast Duplicate Post version: 4.5
  • Gutenberg plugin version:
  • Classic Editor plugin version:
  • Relevant plugins in case of a bug:

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the new-draft flow from src/handlers/link-handler.php through duplicate_post_create_duplicate() and admin-functions.php, especially duplicate_post_copy_post_meta_info() and the deep-slash helpers around lines 386-424. Reproduce the failure from the post list with the listed WordPress, PHP, and plugin versions. Done means New draft creates a cloned draft without the incomplete-object fatal error.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.