Dont worry Yoran, it's not a big deal:
On the latest dev (2011-Jun-18) i got a Fatal error here: PHP Fatal error: Unsupported operand types in /Users/nico/Sites/drupal/modules/filebrowser/filebrowser.module on line 149. And i think it comes from PHP5 (i can not test with PHP4):

$form += _filebrowser_form_file_handlers_part($file_handlers, $parts_weight++);
// Fatal error because the result == NULL

Why not do something like this:

$form = array_merge($form, (array)_filebrowser_form_file_handlers_part($file_handlers, $parts_weight++));

You have to typecasting the result to be compatible with array_merge() PHP5. But needs to be tested with PHP4 (Status to this tracker to needs review)

Comments

Nicolas Georget’s picture

StatusFileSize
new848 bytes
new896 bytes

For those who wants try with PHP5:

  • modify the file filebrowser.module » function filebrowser_form(&$node, $form_state) line 144 to 147:
    $form = array_merge($form, (array)_filebrowser_form_presentation_part($presentation, $parts_weight++));
    $form = array_merge($form, (array)_filebrowser_form_rights_part($rights, $parts_weight++));
    $form = array_merge($form, (array)_filebrowser_form_uploads_part($uploads, $parts_weight++));
    $form = array_merge($form, (array)_filebrowser_form_file_handlers_part($file_handlers, $parts_weight++));
    
  • modify the file filebrowser.admin.inc » function filebrowser_admin_settings() line 31 to 34:
    $form['filebrowser'] = array_merge($form['filebrowser'], (array)_filebrowser_form_presentation_part());
    $form['filebrowser'] = array_merge($form['filebrowser'], (array)_filebrowser_form_rights_part());
    $form['filebrowser'] = array_merge($form['filebrowser'], (array)_filebrowser_form_uploads_part());
    $form['filebrowser'] = array_merge($form['filebrowser'], (array)_filebrowser_form_file_handlers_part());
    
Yoran’s picture

Sorry but I'm not sure this is the way to solve this. By design, _filebrowser_form_XXX_part should never return NULL. For this is where the bug is (the first part at least). Is this the only reason you choose array_merge vs lighter "+=" ?

Nicolas Georget’s picture

It's this one who returns NULL on line 147:

$form += _filebrowser_form_file_handlers_part($file_handlers, $parts_weight++);

And in node.inc » _filebrowser_form_file_handlers_part function, the $handlers variable:

$handlers = module_implements("filebrowser_handler_info");
// $handlers == array(0) { }

So the following condition is not executed:

if (count($handlers)) {
  [...]
Is this the only reason you choose array_merge vs lighter "+=" ?

Yes ;-)

Yoran’s picture

Status: Needs review » Fixed

I just added a $form=array(); at the beginning of the function in order to make this "compliant" :)

Nicolas Georget’s picture

Perfect, It's compliant now!

Status: Fixed » Closed (fixed)

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