nikolaystrikhar / gutenberg-forms

The Next Generation WordPress Form Builder.
https://gutenbergforms.com
GNU General Public License v2.0
121 stars 27 forks source link

register_rest_route warning for namespace name. #164

Closed dovy closed 1 year ago

dovy commented 4 years ago
register_rest_route was called incorrectly. Namespace must not start or end with a slash. Please see Debugging in WordPress for more information. (This message was added in version 5.4.2.)

register_rest_route()
wp-content/plugins/forms-gutenberg/controllers/entries/entries.controller.php:60
cwp_gf_Entries_Controller->register_routes()
wp-content/plugins/forms-gutenberg/controllers/index.php:13

;)

ZafarKamal123 commented 4 years ago

Hey @dovy, Thanks for mentioning this, I will definitely take another look at it! 👍

dovy commented 4 years ago

Super easy to fix, see: https://github.com/reduxframework/redux-framework-4/blob/master/redux-core/inc/classes/class-redux-rest-api-builder.php#L59

ZafarKamal123 commented 4 years ago

Thanks, I will take a look at this and get back to you! 🤞

haynzz commented 2 years ago

I'm also having this issue also. On my local development machine I can't use the plugin. Is there a workaround or any way to circumvent the exception? For me this is kind of a blocker.

I'm also willing to work on a pull request. Just not sure what makes sense?!

ErrorException thrown with message "register_rest_route was called <strong>incorrectly</strong>. Namespace must not start or end with a slash. Please see <a href="https://wordpress.org/support/article/debugging-in-wordpress/">Debugging in WordPress</a> for more information. (This message was added in version 5.4.2.)"

Stacktrace:
#15 ErrorException in /var/www/html/public/wordpress/wp-includes/functions.php:5663
#14 trigger_error in /var/www/html/public/wordpress/wp-includes/functions.php:5663
#13 _doing_it_wrong in /var/www/html/public/wordpress/wp-includes/rest-api.php:51
#12 register_rest_route in /var/www/html/public/wp-content/plugins/gutenberg-forms-local/controllers/entries/entries.summary.controller.php:25
#11 cwp_gf_Entries_Summary_Controller:register_routes in /var/www/html/public/wp-content/plugins/gutenberg-forms-local/controllers/entries/entries.controller.php:54
#10 cwp_gf_Entries_Controller:register_routes in /var/www/html/public/wp-content/plugins/gutenberg-forms-local/controllers/index.php:16
#9 {closure} in /var/www/html/public/wordpress/wp-includes/class-wp-hook.php:303
#8 WP_Hook:apply_filters in /var/www/html/public/wordpress/wp-includes/class-wp-hook.php:327
#7 WP_Hook:do_action in /var/www/html/public/wordpress/wp-includes/plugin.php:470
#6 do_action in /var/www/html/public/wordpress/wp-includes/rest-api.php:537
#5 rest_get_server in /var/www/html/public/wordpress/wp-includes/rest-api.php:495
#4 rest_do_request in /var/www/html/public/wordpress/wp-includes/rest-api.php:2832
#3 rest_preload_api_request in [internal]:0
#2 array_reduce in /var/www/html/public/wordpress/wp-includes/block-editor.php:444
#1 block_editor_rest_api_preload in /var/www/html/public/wordpress/wp-admin/edit-form-blocks.php:68
#0 require in /var/www/html/public/wordpress/wp-admin/post.php:187

EDIT: When I set WP_DEBUG=false. I can progress.