[wp-trac] [WordPress Trac] #58141: `wp_insert_post` considers `"0"` as empty content.
WordPress Trac
noreply at wordpress.org
Thu Aug 24 20:10:52 UTC 2023
#58141: `wp_insert_post` considers `"0"` as empty content.
-------------------------------------------------+-------------------------
Reporter: peterwilsoncc | Owner: (none)
Type: defect (bug) | Status: closed
Priority: normal | Milestone: 6.4
Component: Posts, Post Types | Version: 3.3
Severity: normal | Resolution: worksforme
Keywords: has-patch has-unit-tests needs- | Focuses:
testing |
-------------------------------------------------+-------------------------
Comment (by ugyensupport):
== Bug Report
=== Description
Describe the bug.
=== Environment
- WordPress: 6.4-alpha-56442
- PHP: 8.0.0
- Server: Apache/2.4.10 (Debian)
- Database: mysqli (Server: 5.5.59-MariaDB-1~wheezy / Client: 5.5.62)
- Browser: Chrome 116.0.0.0 (macOS)
- Theme: Twenty Twenty-One 1.9
- MU-Plugins: None activated
- Plugins:
* WordPress Beta Tester 3.5.3
=== Steps to Reproduce
1. As the code currently uses loose comparisons, the string "0" is
considered empty content, to reproduce:
2. Create a new post
3. Switch to code editing view
4. Set the title to 0
5. Set the content to 0
6. Attempt to publish the post
7. WordPress with throw an error: Publishing failed. Content, title and
excerpt are empty.
🐞 Bug occurs.: While 0 isn't great content, it is content so WordPress
should allow the publishing of articles with this. Converting the tests to
strict checks against an empty string should resolve the issue. and In
regard to WordPress 6.2 + Twenty Twenty-Three 1.1 It only display the
content but not title.
=== Expected Results
1. ✅ Works perfectly and fixed with 6.4-alpha-56442
--
Ticket URL: <https://core.trac.wordpress.org/ticket/58141#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list