The isset($item[0]['fid']) throws an error if $item[0] is not always an array. To be honest, the entire function looks dodgy...

  function scorm_attributes_access($node) {
        $arr = (array) $node;
        foreach($arr as $item) {
                if(isset($item[0])) {
                        if(iisset($item[0]['fid'])) {
                                if(file_is_scorm($item[0]['fid'])) {
                                        return TRUE;
                                }
                        }
                }
        }
  }

Notice:

[Fri Feb 18 15:07:44 2011] [error] [client 193.157.82.30] PHP Fatal error:  Cannot use object of type stdClass as array in /var/www/sites/all/modules/contrib/cck_scorm/SCORM.module on line 3046, referer: http://www.ourdomain.com/admin/content/node

Comments

dirk.westrup’s picture

Assigned: Unassigned » pgerling
pgerling’s picture

Status: Active » Fixed

This will be fixed in the next release.
Indeed, the whole function doesnt look that good. I still have to figure out a better way how to check if the node is using cck_scorm. I have some ideas on my mind and will discuss them with Dirk asap.

pgerling’s picture

Fixed - tho the function still looks that "strange" - feel free to tell me a better way to check for this particular file field ;)
Thanks a lot for your bug report!

fuzzy76’s picture

Status: Fixed » Active

You need to add another fix to the line below, like so:

               	if((is_array($item)) && isset($item[0])) {
                        if(is_array($item[0]) && isset($item[0]['fid'])) {
                                if(file_is_scorm($item[0]['fid'])) {
pgerling’s picture

Status: Active » Needs work

We fixed this issue and will distribute it with the next release.
Thanks a lot for your help! :o)

pgerling’s picture

Fixed in beta20.

pgerling’s picture

Status: Needs work » Closed (fixed)