• Resolved llucax

    (@llucax)


    Using WP in DEBUG mode, I get a few notices from AAM 1.0:

    Notice: Undefined index: page in /home/luca/repos/sca/wp-content/plugins/advanced-access-manager/mvb_wp_access.php on line 52
    
    Call Stack:
        0.0006     816552   1. {main}() /home/luca/repos/sca/wp-admin/post.php:0
        0.0009     946112   2. require_once('/home/luca/repos/sca/wp-admin/admin.php') /home/luca/repos/sca/wp-admin/post.php:12
        0.0011     968864   3. require_once('/home/luca/repos/sca/wp-load.php') /home/luca/repos/sca/wp-admin/admin.php:30
        0.0012     990384   4. require_once('/home/luca/repos/sca/wp-config.php') /home/luca/repos/sca/wp-load.php:29
        0.0016    1128448   5. require_once('/home/luca/repos/sca/wp-settings.php') /home/luca/repos/sca/wp-config.php:93
        0.2452   41982496   6. do_action() /home/luca/repos/sca/wp-settings.php:302
        0.2621   42417304   7. call_user_func_array() /home/luca/repos/sca/wp-includes/plugin.php:405
        0.2621   42417360   8. init_wpaccess() /home/luca/repos/sca/wp-includes/plugin.php:0
        0.2621   42417744   9. mvb_WPAccess->__construct() /home/luca/repos/sca/wp-content/plugins/advanced-access-manager/mvb_functions.php:33
    
    Notice: Undefined index: whole in /home/luca/repos/sca/wp-content/plugins/advanced-access-manager/module/class-module_filtermenu.php on line 67
    
    Call Stack:
        0.0006     816552   1. {main}() /home/luca/repos/sca/wp-admin/post.php:0
        0.0009     946112   2. require_once('/home/luca/repos/sca/wp-admin/admin.php') /home/luca/repos/sca/wp-admin/post.php:12
        0.0011     968864   3. require_once('/home/luca/repos/sca/wp-load.php') /home/luca/repos/sca/wp-admin/admin.php:30
        0.0012     990384   4. require_once('/home/luca/repos/sca/wp-config.php') /home/luca/repos/sca/wp-load.php:29
        0.0016    1128448   5. require_once('/home/luca/repos/sca/wp-settings.php') /home/luca/repos/sca/wp-config.php:93
        0.2844   43191064   6. do_action() /home/luca/repos/sca/wp-settings.php:323
        0.2844   43193248   7. call_user_func_array() /home/luca/repos/sca/wp-includes/plugin.php:405
        0.2844   43193304   8. mvb_WPAccess->check() /home/luca/repos/sca/wp-includes/plugin.php:0
        0.2849   43424568   9. module_filterMenu->checkAccess() /home/luca/repos/sca/wp-content/plugins/advanced-access-manager/mvb_wp_access.php:577
    
    Notice: Undefined index: sub in /home/luca/repos/sca/wp-content/plugins/advanced-access-manager/module/class-module_filtermenu.php on line 71
    
    Call Stack:
        0.0006     816552   1. {main}() /home/luca/repos/sca/wp-admin/post.php:0
        0.0009     946112   2. require_once('/home/luca/repos/sca/wp-admin/admin.php') /home/luca/repos/sca/wp-admin/post.php:12
        0.0011     968864   3. require_once('/home/luca/repos/sca/wp-load.php') /home/luca/repos/sca/wp-admin/admin.php:30
        0.0012     990384   4. require_once('/home/luca/repos/sca/wp-config.php') /home/luca/repos/sca/wp-load.php:29
        0.0016    1128448   5. require_once('/home/luca/repos/sca/wp-settings.php') /home/luca/repos/sca/wp-config.php:93
        0.2844   43191064   6. do_action() /home/luca/repos/sca/wp-settings.php:323
        0.2844   43193248   7. call_user_func_array() /home/luca/repos/sca/wp-includes/plugin.php:405
        0.2844   43193304   8. mvb_WPAccess->check() /home/luca/repos/sca/wp-includes/plugin.php:0
        0.2849   43424568   9. module_filterMenu->checkAccess() /home/luca/repos/sca/wp-content/plugins/advanced-access-manager/mvb_wp_access.php:577
    
    Notice: Undefined index: whole in /home/luca/repos/sca/wp-content/plugins/advanced-access-manager/module/class-module_filtermenu.php on line 40
    
    Call Stack:
        0.0006     816552   1. {main}() /home/luca/repos/sca/wp-admin/post.php:0
        0.0009     946112   2. require_once('/home/luca/repos/sca/wp-admin/admin.php') /home/luca/repos/sca/wp-admin/post.php:12
        0.3065   48915080   3. require('/home/luca/repos/sca/wp-admin/menu.php') /home/luca/repos/sca/wp-admin/admin.php:106
        0.3104   49117096   4. require_once('/home/luca/repos/sca/wp-admin/includes/menu.php') /home/luca/repos/sca/wp-admin/menu.php:262
        0.3160   49090040   5. do_action() /home/luca/repos/sca/wp-admin/includes/menu.php:97
        0.3187   49122552   6. call_user_func_array() /home/luca/repos/sca/wp-includes/plugin.php:405
        0.3187   49122608   7. mvb_WPAccess->admin_menu() /home/luca/repos/sca/wp-includes/plugin.php:0
        0.3194   49353136   8. module_filterMenu->manage() /home/luca/repos/sca/wp-content/plugins/advanced-access-manager/mvb_wp_access.php:595
    
    Notice: Undefined index: page in /home/luca/repos/sca/wp-content/plugins/advanced-access-manager/mvb_wp_access.php on line 383
    
    Call Stack:
        0.0006     816552   1. {main}() /home/luca/repos/sca/wp-admin/post.php:0
        0.3271   49016960   2. include('/home/luca/repos/sca/wp-admin/edit-form-advanced.php') /home/luca/repos/sca/wp-admin/post.php:189
        0.3576   49930552   3. require_once('/home/luca/repos/sca/wp-admin/admin-header.php') /home/luca/repos/sca/wp-admin/edit-form-advanced.php:193
        0.3608   49960624   4. do_action() /home/luca/repos/sca/wp-admin/admin-header.php:77
        0.3608   49962808   5. call_user_func_array() /home/luca/repos/sca/wp-includes/plugin.php:405
        0.3608   49962864   6. print_head_scripts() /home/luca/repos/sca/wp-includes/plugin.php:0
        0.3608   49963016   7. do_action() /home/luca/repos/sca/wp-includes/script-loader.php:632
        0.3609   49965208   8. call_user_func_array() /home/luca/repos/sca/wp-includes/plugin.php:405
        0.3609   49965264   9. mvb_WPAccess->wp_print_scripts() /home/luca/repos/sca/wp-includes/plugin.php:0
Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter llucax

    (@llucax)

    Here is a patch to silence all the notices I observed. I don’t know if silence them is the right call, maybe they are hiding some bug, but just in case, here is the patch:

    commit 8ad19738348d69b82a317f4a78be6de368dccc12
    Author: Leandro Lucarella <[email protected]>
    Date:   Sat Aug 27 21:54:01 2011 -0300
    
        Advanced Access Manager: silence supposedly harmless notices
    
    diff --git a/wp-content/plugins/advanced-access-manager/module/class-module_filtermenu.php b/wp-content/plugins/advanced-access-manager/module/class-module_filtermenu.php
    index d1f715d..b1cb5e6 100644
    --- a/wp-content/plugins/advanced-access-manager/module/class-module_filtermenu.php
    +++ b/wp-content/plugins/advanced-access-manager/module/class-module_filtermenu.php
    @@ -35,9 +35,9 @@ class module_filterMenu extends module_User {
             $userRoles = $this->getCurrentUserRole();
             if (is_array($userRoles)) {
                 foreach ($userRoles as $role) {
    -                if (is_array($this->cParams[$role]['menu'])) {
    +                if (is_array(@$this->cParams[$role]['menu'])) {
                         foreach ($this->cParams[$role]['menu'] as $main => $data) {
    -                        if ($data['whole'] == 1) {
    +                        if (@$data['whole'] == 1) {
                                 $this->unsetMainMenuItem($main);
                             } elseif (is_array($data['sub'])) {
                                 foreach ($data['sub'] as $sub => $dummy) {
    @@ -64,11 +64,11 @@ class module_filterMenu extends module_User {
    
                     if (is_array($this->cParams[$role]['menu'])) {
                         foreach ($this->cParams[$role]['menu'] as $menu => $sub) {
    -                        if (($sub['whole']) == 1 && ($this->compareMenus($requestedMenu, $menu))) {
    +                        if ((@$sub['whole']) == 1 && ($this->compareMenus($requestedMenu, $menu))) {
                                 return FALSE;
                             }
    
    -                        if (is_array($sub['sub'])) {
    +                        if (is_array(@$sub['sub'])) {
                                 foreach ($sub['sub'] as $subMenu => $dummy) {
                                     if ($this->compareMenus($requestedMenu, $subMenu)) {
                                         return FALSE;
    @@ -171,4 +171,4 @@ class module_filterMenu extends module_User {
    
     }
    
    -?>
    \ No newline at end of file
    +?>
    diff --git a/wp-content/plugins/advanced-access-manager/mvb_wp_access.php b/wp-content/plugins/advanced-access-manager/mvb_wp_access.php
    index 1e41360..cc4b82a 100644
    --- a/wp-content/plugins/advanced-access-manager/mvb_wp_access.php
    +++ b/wp-content/plugins/advanced-access-manager/mvb_wp_access.php
    @@ -49,7 +49,7 @@ class mvb_WPAccess extends mvb_corePlugin {
    
             if (is_admin()) {
    
    -            if ($_GET['page'] == 'wp_access') {
    +            if (@$_GET['page'] == 'wp_access') {
                     parent::__construct(WPACCESS_BASE_URL, WP_PLUGIN_DIR);
                     //css
                     wp_enqueue_style('jquery-ui', WPACCESS_CSS_URL . 'ui/jquery.ui.all.css');
    @@ -380,7 +380,7 @@ class mvb_WPAccess extends mvb_corePlugin {
          */
    
         function wp_print_scripts() {
    -        if ($_GET['page'] == 'wp_access') {
    +        if (@$_GET['page'] == 'wp_access') {
                 parent::scripts();
                 wp_enqueue_script('jquery-ui', WPACCESS_JS_URL . 'ui/jquery-ui.min.js');
                 wp_enqueue_script('wpaccess-admin', WPACCESS_JS_URL . 'admin-options.js');
    @@ -609,4 +609,4 @@ class mvb_WPAccess extends mvb_corePlugin {
     register_activation_hook(__FILE__, array('mvb_WPAccess', 'activate'));
     register_deactivation_hook(__FILE__, array('mvb_WPAccess', 'deactivate'));
     add_action('init', 'init_wpaccess');
    -?>
    \ No newline at end of file
    +?>

    Hi llucax,
    I appreciate your involvement in this project. You already helped me a lot. I’ll apply your patch to my next version 1.2. It’s almost done.

    Thanks a lot!

    Thread Starter llucax

    (@llucax)

    There is another problem I don’t know how to fix:

    Notice: Array to string conversion in /home/luca/repos/sca/wp-content/plugins/advanced-access-manager/core/class-mvb_coretemplate.php on line 109
    
    Call Stack:
        0.0012     892552   1. {main}() /home/luca/repos/sca/wp-admin/users.php:0
        0.0016    1022104   2. require_once('/home/luca/repos/sca/wp-admin/admin.php') /home/luca/repos/sca/wp-admin/users.php:10
        0.3650   49401104   3. do_action() /home/luca/repos/sca/wp-admin/admin.php:151
        0.3651   49403312   4. call_user_func_array() /home/luca/repos/sca/wp-includes/plugin.php:405
        0.3651   49403368   5. mvb_WPAccess->manager_page() /home/luca/repos/sca/wp-includes/plugin.php:0
        0.3661   49731144   6. module_optionManager->manage() /home/luca/repos/sca/wp-content/plugins/advanced-access-manager/mvb_wp_access.php:604
        0.3662   49731448   7. module_optionManager->getMainOptionsList() /home/luca/repos/sca/wp-content/plugins/advanced-access-manager/module/class-module_optionmanager.php:131
        0.3664   49741616   8. module_optionManager->renderMainMenuOptions() /home/luca/repos/sca/wp-content/plugins/advanced-access-manager/module/class-module_optionmanager.php:200
        0.3715   49960904   9. module_optionManager->renderMetaboxList() /home/luca/repos/sca/wp-content/plugins/advanced-access-manager/module/class-module_optionmanager.php:271
        0.3751   50060240  10. mvb_coreTemplate->updateMarkers() /home/luca/repos/sca/wp-content/plugins/advanced-access-manager/module/class-module_optionmanager.php:347
        0.3752   50064032  11. str_replace() /home/luca/repos/sca/wp-content/plugins/advanced-access-manager/core/class-mvb_coretemplate.php:109

    The problem is this function call:
    $template = str_replace($marker, $content, $template);

    $marker is “###args###”, $content is array(“taxonomy” => “category”) (the problematic argument), and $template is some HTML which seems to be a meta box. Same happens with other taxonomies and with other cases where the array has the form array(“box” => 0) (or another integer).

    Another case has $marker == “###callback###” and the $content array in question is huge, is a metabox from Subscribe2 plug-in.

    Thread Starter llucax

    (@llucax)

    And here is another patch with more notices silencing:

    commit 1794f3ce48bbd10e72f9ee00cb2bee76527ae95f
    Author: Leandro Lucarella <[email protected]>
    Date:   Sun Aug 28 13:08:55 2011 -0300
    
        AAM: Remove more notice messages
    
    diff --git a/wp-content/plugins/advanced-access-manager/module/class-module_optionmanager.php b/wp-content/plugins/advanced-access-manager/module/class-module_optionmanager.php
    index 0eee5f2..328e757 100644
    --- a/wp-content/plugins/advanced-access-manager/module/class-module_optionmanager.php
    +++ b/wp-content/plugins/advanced-access-manager/module/class-module_optionmanager.php
    @@ -79,7 +79,6 @@ class module_optionManager extends mvb_corePlugin {
         function __construct($curentRole = FALSE, $return = FALSE) {
             global $table_prefix;
    
    -        $this->pObj = $pObj;
             $this->return = $return;
             $this->templObj = new mvb_coreTemplate();
             $templatePath = WPACCESS_TEMPLATE_DIR . 'admin_options.html';
    @@ -285,7 +284,7 @@ class module_optionManager extends mvb_corePlugin {
                     $markers = array(
                         '###role###' => $this->currentRole,
                         '###title###' => $cap,
    -                    '###description###' => htmlspecialchars($capabilitiesDesc[$cap], ENT_QUOTES),
    +                    '###description###' => htmlspecialchars(@$capabilitiesDesc[$cap], ENT_QUOTES),
                         '###checked###' => $this->checkChecked('capability', array($cap)),
                         '###cap_name###' => $m->getCapabilityHumanTitle($cap)
                     );
    @@ -383,21 +382,21 @@ class module_optionManager extends mvb_corePlugin {
             $checked = '';
             switch ($type) {
                 case 'submenu':
    -                if ($this->currentParams[$this->currentRole]['menu'][$args[0]]['sub'][$args[1]] ||
    -                        $this->currentParams[$this->currentRole]['menu'][$args[0]]['whole']) {
    +                if (@$this->currentParams[$this->currentRole]['menu'][$args[0]]['sub'][$args[1]] ||
    +                        @$this->currentParams[$this->currentRole]['menu'][$args[0]]['whole']) {
    
                         $checked = 'checked';
                     }
                     break;
    
                 case 'menu':
    -                if ($this->currentParams[$this->currentRole]['menu'][$args[0]]['whole']) {
    +                if (@$this->currentParams[$this->currentRole]['menu'][$args[0]]['whole']) {
                         $checked = 'checked';
                     }
                     break;
    
                 case 'capability':
    -                if (isset($this->roles[$this->currentRole][capabilities][$args[0]])) {
    +                if (isset($this->roles[$this->currentRole]['capabilities'][$args[0]])) {
                         $checked = 'checked';
                     }
                     break;
    diff --git a/wp-content/plugins/advanced-access-manager/mvb_wp_access.php b/wp-content/plugins/advanced-access-manager/mvb_wp_access.php
    index cc4b82a..474c8be 100644
    --- a/wp-content/plugins/advanced-access-manager/mvb_wp_access.php
    +++ b/wp-content/plugins/advanced-access-manager/mvb_wp_access.php
    @@ -600,7 +600,7 @@ class mvb_WPAccess extends mvb_corePlugin {
          */
    
         function manager_page() {
    -        $m = new module_optionManager($_POST['current_role']);
    +        $m = new module_optionManager(@$_POST['current_role']);
             $m->manage();
         }
    
    diff --git a/wp-content/plugins/advanced-access-manager/module/class-module_user.php b/wp-content/plugins/advanced-access-manager/module/class-module_user.php
    index f0932d5..c0c4fa0 100644
    --- a/wp-content/plugins/advanced-access-manager/module/class-module_user.php
    +++ b/wp-content/plugins/advanced-access-manager/module/class-module_user.php
    @@ -25,7 +25,7 @@ class module_User extends WP_User {
         }
    
         function getCurrentUserRole() {
    -        if (is_array($this->data->{$this->cap_key})){
    +        if ($this->data && is_array($this->data->{$this->cap_key})){
                 $result = array_keys($this->data->{$this->cap_key});
             }else{
                 $result = array();

    Hi llucax,
    I took in consideration all your remarks and fixed a lot places where these notifications appeared.
    My suggestion to you – do not use operand @. This slow down a script a lot.
    Probably today I’ll release next version of a plugin. And a lot of new features. And I pretty sure there will be some bugs.
    Regards,

    Thread Starter llucax

    (@llucax)

    Thanks!

    Do you have any references on why using @ slow down scripts? Thank you.

    Thread Starter llucax

    (@llucax)

    Hi, I installed 1.2 and still getting some notices:

    Notice: Undefined index: administrator in /home/luca/repos/sca/wp-content/plugins/advanced-access-manager/mvb_wp_access.php on line 506
    
    Call Stack:
        0.0001     655696   1. {main}() /home/luca/repos/sca/index.php:0
        0.0002     661160   2. require('/home/luca/repos/sca/wp-blog-header.php') /home/luca/repos/sca/index.php:17
        0.2860   40013488   3. wp() /home/luca/repos/sca/wp-blog-header.php:14
        0.2860   40013704   4. WP->main() /home/luca/repos/sca/wp-includes/functions.php:1567
        0.2928   40118328   5. do_action_ref_array() /home/luca/repos/sca/wp-includes/class-wp.php:504
        0.2928   40119848   6. call_user_func_array() /home/luca/repos/sca/wp-includes/plugin.php:486
        0.2928   40119904   7. mvb_WPAccess->wp_front() /home/luca/repos/sca/wp-includes/plugin.php:0
        0.2929   40119984   8. mvb_WPAccess->checkPostAccess() /home/luca/repos/sca/wp-content/plugins/advanced-access-manager/mvb_wp_access.php:148

    Hi llucax,
    There are a lot of places to look into where this notice can appear. I’m planning totally reorganize code in 2.0 version to avoid many problems. More over add ability to write addons and add new functionality. So everybody will be able to create or customize some features.
    Regards,

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Notice messages in version 1.0’ is closed to new replies.