Reputation:
I am having these warnings in my code despite that it works so was wondering if I am not writing these code properly or something. Have a look.
$image_size = getimagesize($data[$module['_attr']['id']]); <-- works but gives warning (Filename cannot be empty)
echo call_user_func($module['_attr']['type'],$module); <-- works but gives warning (First argument is expected to be a valid callback)
So I am drawing to a conclusion that it doesn't like variables passed in or array elements. Or am I doing something wrong?
Thanks!
Upvotes: 0
Views: 105
Reputation: 5214
Are you sure your script is working?
I think the first error is because you aren't passing a image path to that function.
The 2nd, is because the first argument MUST be a function. Is $module['_attr']['type'] a function?
Are you debugging those variables?
Upvotes: 0
Reputation: 401182
I'm guessing $data[$module['_attr']['id']]
is empty (it doesn't contain a path to any file) -- which would explain the first warning.
And $module['_attr']['type']
probably doesn't contain a valid function name -- which would explain the second warning.
Try using something like this to know what's really in $module
and $data
:
var_dump($module, $data);
Notes :
Upvotes: 2