Skip to content

Conversation

@awps
Copy link

@awps awps commented Jun 23, 2025

Description

Not sure when this is emitted, but sometimes I see this warning and it is flooding the logs. Probably the problem is somewhere else, or is not a problem at all, but this should mute this warning:

PHP Warning:  Attempt to read property "post_type" on string in .../edit-flow/modules/custom-status/custom-status.php on line 1476

ingeniumed and others added 2 commits June 4, 2024 09:58
… .../custom-status.php on line 1476

Not sure when this is emitted, but sometimes I see this warning and it is flooding the logs. Probably the problem is somewhere else, or is not a problem at all, but this should mute this warning: 

```
PHP Warning:  Attempt to read property "post_type" on string in .../edit-flow/modules/custom-status/custom-status.php on line 1476
```
@GaryJones GaryJones changed the base branch from main to develop November 13, 2025 15:58
GaryJones added a commit that referenced this pull request Dec 12, 2025
The `fix_preview_link_part_two()` filter callback could receive a string URL instead of a WP_Post object when `get_post()` returns null, causing a PHP warning when attempting to access the `post_type` property. This guard clause ensures the parameter is a valid post object before proceeding with any property access.

Uses `instanceof WP_Post` for stricter type checking rather than `is_object()`, which would incorrectly accept any object type. Fixes indentation to match surrounding code standards (tabs instead of spaces).

Based on PR #747 by @dev4starter, rebased onto develop with improvements.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@GaryJones
Copy link
Contributor

Thank you for this fix, @dev4starter! 🙏

I've incorporated your fix into #834 with a couple of improvements:

  • Rebased onto the develop branch (this PR was against master which doesn't run CI)
  • Used instanceof WP_Post instead of is_object() for stricter type checking
  • Fixed indentation to use tabs matching surrounding code

Your contribution is credited in the commit message and PR description.

@GaryJones GaryJones closed this Dec 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants