#47216 closed defect (bug) (fixed)
Block Editor crashes on custom post types without title support
Reported by: | markjaquith | Owned by: | audrasjb |
---|---|---|---|
Milestone: | 5.3 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Editor | Keywords: | |
Focuses: | javascript | Cc: |
Description
Create a custom post type that supports 'editor' but not 'title'. Save Draft. Reload the page. Crashes.
<?php add_action( 'init', function () { register_post_type( 'movie', [ 'labels' => [ 'name' => 'Movies', 'singular_name' => 'Movie', ], 'public' => true, 'has_archive' => true, 'rewrite' => [ 'slug' => 'movies' ], 'show_in_rest' => true, 'supports' => [ //'title', 'editor', ], ] ); });
Attachments (2)
Change History (18)
This ticket was mentioned in Slack in #core-editor by earnjam. View the logs.
6 years ago
This ticket was mentioned in Slack in #core by desrosj. View the logs.
6 years ago
#3
@
6 years ago
- Keywords needs-patch added
- Milestone changed from Awaiting Review to 5.3
- Priority changed from normal to high
This ticket was mentioned in Slack in #core-js by splitti. View the logs.
5 years ago
This ticket was mentioned in Slack in #core-editor by chrisvanpatten. View the logs.
5 years ago
#8
@
5 years ago
- Resolution set to fixed
- Status changed from new to closed
The patch has been merged in https://github.com/WordPress/gutenberg/pull/16236 and should be included in core the next time Gutenberg packages are merged.
#9
@
5 years ago
- Keywords needs-testing fixed-major added
- Milestone changed from 5.3 to 5.2.3
- Resolution fixed deleted
- Status changed from closed to reopened
Reopening this so it can be back-ported to the 5.2 branch, also needs testing to validate if this ticket is good to land in 5.2.3.
This ticket was mentioned in Slack in #core by marybaum. View the logs.
5 years ago
#11
@
5 years ago
- Keywords close added
@JeffPaul Looks like it was fixed in Gutenberg so I guess there is nothing to backport here.
https://github.com/WordPress/gutenberg/pull/16236/files/cd82bed57c1f3722460d93438148b0edd92e3892
Asking in #core-editor for confirmation :)
This ticket was mentioned in Slack in #core-editor by audrasjb. View the logs.
5 years ago
#14
@
5 years ago
- Keywords has-patch needs-testing fixed-major close removed
- Milestone 5.2.3 deleted
- Priority changed from high to normal
- Resolution set to reported-upstream
- Status changed from reviewing to closed
I asked in #core-editor and the answer was clear:
While I agree it would be good to fix the process to update the packages in Core is still not that straightforward. So given that we'll be focusing on WordPress 5.3 a lot in the next weeks and the timeline for the feature-freeze being in a month or so. I'd prefer if we just land this in WordPress 5.3 due to that overheard.
Unfortunately, the Gutenberg patch (already merged) is not going to land in 5.2.3 but it the issue will definitely be fixed in 5.3.
By the way, I'm going to close the ticket as reported-upstream
since it's already fixed in Gutenberg.
The problem is caused by this line in PostLink.
It assumes that
cleanForSlug
(see here) can deal with parameters that aren't strings. If this were a documentary, the narrator would now say "It can't."There are at least two options on how to resolve this problem.
cleanForSlug
bail whenever it gets invalid input.cleanForSlug
with something that isn't always a string.Following the Robustness Principle, I opted for (1) in my patch.
I'm not sure what's the best way to indicate that the function wasn't able to perform the desired action, but I think returning undefined is probably a good start, but I'd like to hear your opinions on that as well as any preference for another option :)