Description
When I use register_block_type( __DIR__, ...) to register a block, a PHP notice is thrown PHP 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 mac
Screenshots, screen recording, code snippet
register_block_type_from_metadata( __DIR__, [
'render_callback' => function( array $attributes ) : string {
ob_start();
include __DIR__ . '/template.php';
return ob_get_clean();
},
] );
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
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$nameis 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