New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inaccurate PHP notice in WP_Block_Type_Registry::register when $name is a path #36487
Comments
@ryanwelcher not sure if you have some insights to share here? |
@pdewouters what are the contents of the block.json file you are using for this example? I'm going to see if I can reproduce this locally. |
Just wanted to follow up on this @pdewouters. I have been able to reproduce this error only when the path didn't exist - which based on your example is not the same steps to reproduce. There does seem to be a case where the validation fails to see that there is an issue with the path when using the |
Ok, it seems that the issue might've resolved itself for now. I can't reproduce it anymore. |
Thanks for the follow up! |
I had the same issue. I got this error message about upper case names (and my whole path did indeed include upper case names) when in actual fact as @ryanwelcher also experienced, I was trying to register a block to a path that didn't exist. Once I fixed that, then the error disappeared - even though my whole path still did include upper case characters. |
Description
When I use
register_block_type( __DIR__, ...)
to register a block, a PHP notice is thrownPHP Notice: WP_Block_Type_Registry::register was called <strong>incorrectly</strong>. Block type names must not contain uppercase characters.
if the path calculated by__DIR__
contains uppercase letters. This doesn't seem right. A potential fix would be to make the check smarter ( detect if it's$name
is a valid path?)Step-by-step reproduction instructions
Register a block using snippet below, in an environment that will have an uppercase letter in the path, e.g.
/Users/...
, this happens on a local install on a macScreenshots, screen recording, code snippet
Environment info
WP 5.8.1
Does not have standalone Gutenberg plugin
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: