-
Notifications
You must be signed in to change notification settings - Fork 566
Closed
Description
Expected Behavior:
Namespace itself should not be considered a callable. It's part of a FQDN but can't be called directly.
Callable check should be case-sensitive?
Actual Behavior:
When registering a field, define a default parameter. If that parameter equals to a main namespace inside a plugin (n my case MyPlugin) - it generates a notice:
[18-Feb-2018 21:37:25 UTC] PHP Notice: CMB2_Field::__construct() was called with a parameter that is <strong>deprecated</strong> since version 2.2.3! Using the "default" field parameter as a callback has been deprecated in favor of the "default" parameter. in ....\wp-content\plugins\myplugin\vendor\webdevstudios\cmb2\includes\CMB2_Base.php on line 456
My plugin has a top level namespace MyPlugin, and all its classes are part of it, like \MyPlugin\Options or \MyPlugin\Migration. There is no MyPlugin class, but there is a myplugin() function (note the lower case comparing to a top level namespace), which acts like a service locator.
Call Stack
1. do_action('myplugin_page_myplugin_settings_emails')
wp-admin/admin.php:224
2. MyPlugin\Admin\PageAbstract->display()
wp-includes/class-wp-hook.php:286
3. MyPlugin\Admin\Pages\Settings->display_content()
wp-content/plugins/myplugin/src/Admin/PageAbstract.php:43
4. CMB2_Options_Hookup->options_page_metabox()
wp-content/plugins/myplugin/src/Admin/Pages/Settings.php:160
5. CMB2_hookup->show_form_for_type()
wp-content/plugins/myplugin/vendor/webdevstudios/cmb2/includes/CMB2_Options_Hookup.php:258
6. CMB2->show_form()
wp-content/plugins/myplugin/vendor/webdevstudios/cmb2/includes/CMB2_hookup.php:647
7. CMB2->render_field()
wp-content/plugins/myplugin/vendor/webdevstudios/cmb2/includes/CMB2.php:230
8. CMB2->get_field()
wp-content/plugins/myplugin/vendor/webdevstudios/cmb2/includes/CMB2.php:427
9. CMB2_Field->__construct()
wp-content/plugins/myplugin/vendor/webdevstudios/cmb2/includes/CMB2.php:1332
10. CMB2_Field->_set_field_defaults()
wp-content/plugins/myplugin/vendor/webdevstudios/cmb2/includes/CMB2_Field.php:139
11. CMB2_Field->convert_deprecated_params()
wp-content/plugins/myplugin/vendor/webdevstudios/cmb2/includes/CMB2_Field.php:1189
12. CMB2_Base->deprecated_param()
wp-content/plugins/myplugin/vendor/webdevstudios/cmb2/includes/CMB2_Field.php:1412
CMB2 Field Registration Code:
$cmb->add_field( array(
'name' => 'Test Radio',
'id' => 'wiki_test_radio',
'type' => 'radio',
'show_option_none' => true,
'options' => array(
'MyPlugin' => __( 'Option One', 'cmb2' ),
'WhateverElse' => __( 'Option Two', 'cmb2' ),
),
'default' => 'MyPlugin',
) );Metadata
Metadata
Assignees
Labels
No labels