Debug Bar
$this is determined as an undefined variable (1 post)

  1. The debug bar determines $this as an undefined variable when used within a class\function call, but will happily accept &$this without any notices.


    class test_class {
      function make_menu() {
        $page_title = __( 'Page title' );
        $menu_title = __( 'Menu title' );
        $capability = 'read';
        $menu_slog  = 'test-slug';
        $function   = array( $this, 'menu_function );
        add_menu_page( $page_title, $menu_title, $capability, $menu_slug, $function );
      function menu_function() {

    The above will create a Notice that "this" isn't defined, but replace $this with &$this and it will no longer produce this notification.


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Debug Bar
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

  • RSS feed for this topic
  • Started 3 years ago by Marius L. J. (Clorith)
  • This topic is not resolved
  • WordPress version: 3.5.1


No tags yet.