Opened 6 weeks ago
Last modified 5 weeks ago
#65128 new defect (bug)
Warning on the post page.
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Awaiting Review | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | Administration | Keywords: | has-patch 2nd-opinion |
| Focuses: | Cc: |
Description
getting below warning on the /wp-admin/post.php page.
Warning: Attempt to read property "post_type" on null in `public\wp-includes\admin-bar.php` on line 816
Change History (10)
This ticket was mentioned in PR #11644 on WordPress/wordpress-develop by @gautammkgarg.
6 weeks ago
#1
- Keywords has-patch added
@gautammkgarg commented on PR #11644:
6 weeks ago
#2
thanks @apermo for approving the code.
What is the next step? Do I need to do anything or the code with be merged automatically?
#3
@
6 weeks ago
- Keywords reporter-feedback added
How did you access /wp-admin/post.php?
- If you followed a link, where was it?
- Does the URL have a query string after
post.php? - What can you accomplish on the admin page if
get_post()returnsnull? - Do you have any plugins active, and what is the theme?
I tried changing a post link to a nonexistent ID (wp-admin/post.php?post=55555&action=edit), and I got an error:
"You attempted to edit an item that does not exist. Perhaps it was deleted?"
When I tried accessing /wp-admin/post.php without any query string, it redirected me to /wp-admin/edit.php.
@apermo commented on PR #11644:
6 weeks ago
#4
A core committer will have a final review and either point out something they find or merge.
so just wait
#5
@
6 weeks ago
@sabernhardt and @mukeshpanchal27
I got this warning while working with our Plugin "Knit Pay". I thought if this warning is getting triggered in Knit Pay, then it can get triggered in other plugins/themes also. That's why I planned to fix it.
Here are the complete steps I followed, where I got this error.
- I installed [Knit Pay](https://wordpress.org/plugins/knit-pay/) plugin.
- Created new Configuration. Knit Pay >> Configurations >> Add new Payment Gateway Configuration.
- In Payment Provider, I chose "UPI QR".
- In "UPI VPA ID" field, write anything, like "abc".
- Publish the configuration.
- After page loads, scroll to the bottom of page, and in "Test" box, enter any amount, eg. 5 INR.
- Click on "Test" button.
- On this page, you will get the warning I mentioned.
I just realized, that I am getting one more Deprecated code message
<?php Deprecated: Function print_emoji_styles is deprecated since version 6.4.0! Use wp_enqueue_emoji_styles instead. in public\wp-includes\functions.php on line 6170
I am not sure if we should fix both these warning and deprecated message in same PR or keep 2 separate PR.
Environment I am using.
PHP: 8.1.29 - 8.5.1 (Getting warning on all the PHP versions)
WordPress: 7.0-RC2
Web server: nginx/1.26.1
#6
@
6 weeks ago
Patch Testing Report
Patch Tested: https://github.com/WordPress/wordpress-develop/pull/11644/commits/e4f03cb892735afaab1d7ec207b9ae3046d7f3dc
Environment:
- PHP: 8.2.29
- WordPress: 7.0-RC2-62242
- Web server: Apache
- Database: MySQL
- Browser: Chrome
- OS: Ubuntu 22.04.5 LTS
- Active Theme: Twenty Twenty-Five
Active Plugins:
- AI
- AI Provider for Google
- AI Provider for OpenAI
- Knit Pay
Steps performed:
- Installed the Knit Pay plugin from the WordPress repository
- Navigated to Knit Pay → Configurations and created a new payment gateway configuration
- Selected UPI QR as the payment provider
- Entered a sample value (e.g., "xyz") in the UPI VPA ID field and published the configuration.
- Published the configuration
- Once the page reloaded, scrolled down to the Test section
- Entered a test amount.
- Clicked the Test button and the warning appears on the resulting page
Result:
The patch is working as expected for the warning. However, I am also encountering a couple of deprecation notices. Please review the attached screenshots for reference.
Before Applied the patch: https://snipboard.io/GRBhPD.jpg
After Applied the patch: https://snipboard.io/XicjNZ.jpg
#7
@
6 weeks ago
Test Report
Description
This report verifies whether the patch correctly displays the warning during the Knit Pay UPI QR test flow and checks for any additional issues.
Patch Tested:
https://github.com/WordPress/wordpress-develop/pull/11644/commits/e4f03cb892735afaab1d7ec207b9ae3046d7f3dc
Environment
- WordPress: 7.0-RC2-62242
- PHP: 8.2.29
- Database: MySQL
- Browser: Chrome
- OS: Windows
- Theme: Twenty Twenty-Five
Active Plugins
- AI
- AI Provider for Google
- AI Provider for OpenAI
- Knit Pay
Steps to Reproduce
# Install and activate the Knit Pay plugin from the WordPress repository.
# Navigate to Knit Pay → Configurations.
# Create a new payment gateway configuration.
# Select UPI QR as the payment provider.
# Enter a sample value (e.g., xyz) in the UPI VPA ID field.
# Publish the configuration.
# After the page reloads, scroll down to the Test section.
# Enter a test amount.
# Click the Test button.
Expected Results
- A warning message should appear on the resulting page when testing with invalid or sample input.
Actual Results
- ✅ The warning message is displayed as expected, confirming the patch is functioning correctly.
- ⚠️ Additional deprecation notices are also observed during the process.
Notes
- The primary functionality introduced by the patch works as intended.
- The deprecation notices may indicate compatibility issues with the current PHP version or related components and should be reviewed separately.
#8
@
6 weeks ago
@gaurangsondagar and @darshitrajyaguru97
Thanks for doing patch testing.
@mukeshpanchal27 and @apermo, what would you suggest, should I raise a separate PR for fixing deprecation notices. or these should be fixed within same PR?
#9
follow-up:
↓ 10
@
6 weeks ago
- Keywords 2nd-opinion added; reporter-feedback removed
- Version trunk deleted
WordPress added the print_emoji_styles and wp_admin_bar_styles deprecation notices in [56682] for plugin and theme authors to update their code. The new enqueuing functions remove deprecated functions from the admin_head hook within the admin, or wp_head on the front end. [56682] did not account for anyone using wp_head() in the admin area.
Knit Pay calls both wp_head() and wp_footer(), which are front-end functions that echo output, within the <body> of redirect-via-html-with-message.php. The only purpose I found for this is to enqueue jquery and knit-pay-easy-qrcode (in UpiQR/Gateway.php). However, it enqueues all the front-end styles and scripts, plus <meta> and <link> tags, in addition to those two scripts. Theoretically the plugin could use wp_print_scripts() instead of wp_enqueue_script(), with knit-pay-easy-qrcode registered in the wp_print_scripts action, but I am not sure I should recommend that.
#10
in reply to:
↑ 9
@
5 weeks ago
Thanks for your suggestion, charges are implemented and will be released with next update on Knit Pay. These changes will fix the print_emoji_styles and wp_admin_bar_styles deprecation notices. as proper information was missing in the deprecation notice, it was little difficult to understand that these notices are due to use of wp_head() and wp_footer() functions. But now it's fixed.
Could you please review the PR also? It will fix the warning also.
Replying to sabernhardt:
WordPress added the
print_emoji_stylesandwp_admin_bar_stylesdeprecation notices in [56682] for plugin and theme authors to update their code. The new enqueuing functions remove deprecated functions from theadmin_headhook within the admin, orwp_headon the front end. [56682] did not account for anyone usingwp_head()in the admin area.
Knit Pay calls both
wp_head()andwp_footer(), which are front-end functions that echo output, within the<body>of redirect-via-html-with-message.php. The only purpose I found for this is to enqueuejqueryandknit-pay-easy-qrcode(in UpiQR/Gateway.php). However, it enqueues all the front-end styles and scripts, plus<meta>and<link>tags, in addition to those two scripts. Theoretically the plugin could usewp_print_scripts()instead ofwp_enqueue_script(), withknit-pay-easy-qrcoderegistered in thewp_print_scriptsaction, but I am not sure I should recommend that.
Patch for https://core.trac.wordpress.org/ticket/65128
Trac ticket: https://core.trac.wordpress.org/ticket/65128