Hi,

I'm running a CVS version of Drupal (so have E_NOTICE enabled). On every page, the breadcrumb builder for some reason is checking the access hook for swfupload, and because there's no sid etc (or POST at all), swfupload_access() is raising an E_NOTICE error.

Also, the name of this function conflicts with hook_access(), although that's not an issue unless you're declaring a custom node type. All the same, probably less confusing to not risk that.

I've attached a patch that fixes the errors and renames the function to swfupload_upload_access.

Thanks

Comments

skilip’s picture

Hey, thanks for the patch. You're right about the hook_access conflict. I'm surprised this hasn't been noticed before. After changing the name to swfuploaf_upload_access(), is your problem not already solved? I mean, is the !empty() statement still needed?

neilnz’s picture

Well yes, in theory you still need it. In the case where there is no sid parameter in $_POST for instance, if ($p->sid) will throw an E_NOTICE, whereas if (!empty($p->sid) won't. You could also use if (isset($p->sid) if you prefer.

I found this access hook was being called on every page load by the breadcrumb building function, but I'm not quite sure why. Here's the backtrace from an ordinary page request with nothing at all to do with swfupload:

array
  0 =>
    array
      'function' => string 'swfupload_upload_access' (length=23)
      'args' =>
        array
          empty
  1 =>
    array
      'file' => string '/home/user/myproject/includes/menu.inc' (length=38)
      'line' => int 452
      'function' => string 'call_user_func_array' (length=20)
      'args' =>
        array
          0 => &string 'swfupload_upload_access' (length=23)
          1 => &
            array
              ...
  2 =>
    array
      'file' => string '/home/user/myproject/includes/menu.inc' (length=38)
      'line' => int 662
      'function' => string '_menu_check_access' (length=18)
      'args' =>
        array
          0 => &
            array
              ...
          1 => &
            array
              ...
  3 =>
    array
      'file' => string '/home/user/myproject/includes/menu.inc' (length=38)
      'line' => int 1026
      'function' => string '_menu_link_translate' (length=20)
      'args' =>
        array
          0 => &
            array
              ...
  4 =>
    array
      'file' => string '/home/user/myproject/includes/menu.inc' (length=38)
      'line' => int 1015
      'function' => string '_menu_tree_check_access' (length=23)
      'args' =>
        array
          0 => &
            array
              ...
  5 =>
    array
      'file' => string '/home/user/myproject/includes/menu.inc' (length=38)
      'line' => int 953
      'function' => string 'menu_tree_check_access' (length=22)
      'args' =>
        array
          0 => &
            array
              ...
          1 => &
            array
              ...
  6 =>
    array
      'file' => string '/home/user/myproject/includes/menu.inc' (length=38)
      'line' => int 1559
      'function' => string 'menu_tree_page_data' (length=19)
      'args' =>
        array
          0 => &string 'navigation' (length=10)
  7 =>
    array
      'file' => string '/home/user/myproject/includes/menu.inc' (length=38)
      'line' => int 1593
      'function' => string 'menu_set_active_trail' (length=21)
      'args' =>
        array
          empty
  8 =>
    array
      'file' => string '/home/user/myproject/includes/menu.inc' (length=38)
      'line' => int 1628
      'function' => string 'menu_get_active_trail' (length=21)
      'args' =>
        array
          empty
  9 =>
    array
      'file' => string '/home/user/myproject/includes/path.inc' (length=38)
      'line' => int 188
      'function' => string 'menu_get_active_title' (length=21)
      'args' =>
        array
          empty
  10 =>
    array
      'file' => string '/home/user/myproject/includes/theme.inc' (length=39)
      'line' => int 1844
      'function' => string 'drupal_get_title' (length=16)
      'args' =>
        array
          empty
  11 =>
    array
      'function' => string 'template_preprocess_page' (length=24)
      'args' =>
        array
          0 => &
            array
              ...
          1 => &string 'page' (length=4)
  12 =>
    array
      'file' => string '/home/user/myproject/includes/theme.inc' (length=39)
      'line' => int 697
      'function' => string 'call_user_func_array' (length=20)
      'args' =>
        array
          0 => &string 'template_preprocess_page' (length=24)
          1 => &
            array
              ...
  13 =>
    array
      'file' => string '/home/user/myproject/index.php' (length=30)
      'line' => int 36
      'function' => string 'theme' (length=5)
      'args' =>
        array
          0 => &string 'page' (length=4)
          1 => &string '<div id="homepage">
  <h2 class="feature-showreels">Featured</h2>

  <div id="homepage-featured">
    <div id="main-content-flow" class="ContentFlow">
      <div class="loadIndicator"><div class="indicator"></div></div>
      <div class="flow">
              <a href="/people/672/showcase" class="item"><img src="http://myproject.rikako.abelard.wgtn.cat-it.co.nz/sites/default/files/imagecache/player_thumbnail/DHoff.jpg" alt="Dillbox Test" title=""  class="content" width="310" height="286" /></a>
   '... (length=5605)
skilip’s picture

Version: 6.x-2.0-beta3 » 6.x-2.0-beta4
Status: Needs review » Patch (to be ported)
StatusFileSize
new1.27 KB

Thanks nielnz!

skilip’s picture

Status: Patch (to be ported) » Fixed

Added in BETA5

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.