Jump to:
| Project: | NodeReferrer |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | needs work |
Issue Summary
Hi, I get those errors after viewing a node that doesn't have any referrer yet:
warning: array_filter() [function.array-filter]: The first argument should be an array in /var/www/maw/sites/all/modules/nodereferrer/nodereferrer.module on line 162.
warning: array_values() [function.array-values]: The argument should be an array in /var/www/maw/sites/all/modules/nodereferrer/nodereferrer.module on line 162.
warning: array_filter() [function.array-filter]: The first argument should be an array in /var/www/maw/sites/all/modules/nodereferrer/nodereferrer.module on line 163.
warning: array_values() [function.array-values]: The argument should be an array in /var/www/maw/sites/all/modules/nodereferrer/nodereferrer.module on line 163.
using last 1.x dev.
Comments
#1
I also experience this bug. It's worth mentioning that I get this message for lines 135-136 as well as 162-163. My version is 6.x-1.0-rc2 (with a PostgreSQL database backend).
# warning: array_filter() [function.array-filter]: The first argument should be an array in /var/www/drupal/sites/all/modules/nodereferrer/nodereferrer.module on line 135.# warning: array_values() [function.array-values]: The argument should be an array in /var/www/drupal/sites/all/modules/nodereferrer/nodereferrer.module on line 135.
# warning: array_filter() [function.array-filter]: The first argument should be an array in /var/www/drupal/sites/all/modules/nodereferrer/nodereferrer.module on line 136.
# warning: array_values() [function.array-values]: The argument should be an array in /var/www/drupal/sites/all/modules/nodereferrer/nodereferrer.module on line 136.
# warning: array_filter() [function.array-filter]: The first argument should be an array in /var/www/drupal/sites/all/modules/nodereferrer/nodereferrer.module on line 162.
# warning: array_values() [function.array-values]: The argument should be an array in /var/www/drupal/sites/all/modules/nodereferrer/nodereferrer.module on line 162.
# warning: array_filter() [function.array-filter]: The first argument should be an array in /var/www/drupal/sites/all/modules/nodereferrer/nodereferrer.module on line 163.
# warning: array_values() [function.array-values]: The argument should be an array in /var/www/drupal/sites/all/modules/nodereferrer/nodereferrer.module on line 163.
#2
I have the same issue.
#3
I am seeing same issue with 6.x-1.0-rc2. It appears only on nodes without a referrer it seems
#4
Same here, 6.x-1.0-rc2:
warning: array_filter() [function.array-filter]: The first argument should be an array in
/sites/all/modules/nodereferrer/nodereferrer.module on line 135.
warning: array_values() [function.array-values]: The argument should be an array in
/sites/all/modules/nodereferrer/nodereferrer.module on line 135.
warning: array_filter() [function.array-filter]: The first argument should be an array in
/sites/all/modules/nodereferrer/nodereferrer.module on line 136.
warning: array_values() [function.array-values]: The argument should be an array in
/sites/all/modules/nodereferrer/nodereferrer.module on line 136.
#5
Please explain a steps to reproduce this bug
#6
Same issue in 6.x-1.0-rc2 here too.
In my setup, we have two content types, "Project" and "Portfolio Item" which refer to another content type "Client". Client has a nodereferrer field.
Maybe it's something to do with the fact that two content types are referring one.
After setting up the second node reference I forgot to check the box for that content type under "Referring Node Types:" as well as "Referring fields", but I have corrected that now and it doesn't seem to be related to this issue.
#7
Is this still an issue? Please test against current 6-dev
#8
Its still an issue with rc2. Havent tried it with dev.
But I think it is because I am using node reference url widget. Error disappears if I select the autocomplete widget (or any other default ones).
Anyone else using this module?
#9
I'm having the issue, but not using reference URL widget.
#10
Same issue with RC2.
#11
I have tested this against the current dev version dated 2011-Feb-25 and I can confirm that this is still an issue.
PHP version 5.3.6
Error message:
warning: array_values() expects parameter 1 to be array, null given in /home/bjncom/public_html/sites/all/modules/nodereferrer/nodereferrer.module on line 134.
warning: array_filter() expects parameter 1 to be array, string given in /home/bjncom/public_html/sites/all/modules/nodereferrer/nodereferrer.module on line 135.
#12
Same issue, lines 135, 136 with nodereferrer-6.x-1.0-rc2
- on nodes without refering nodes
#13
This seems to come with latest php versions that are more strict about data type.
I solved the issue by modifying lines 135-136 as follow
Current code
case 'load':$types = isset($field['referrer_types']) ? array_values(array_filter($field['referrer_types'])) : array();
$fields = isset($field['referrer_fields']) ? array_values(array_filter($field['referrer_fields'])) : array();
Modified code
case 'load':+ if (($field['referrer_types'])){
$types = isset($field['referrer_types']) ? array_values(array_filter($field['referrer_types'])) : array();
+ }
+ if (($field['referrer_fields'])){
$fields = isset($field['referrer_fields']) ? array_values(array_filter($field['referrer_fields'])) : array();
+ }
Idem for lines 162-163
Current code
$types = array_values(array_filter($field['referrer_types']));$fields = array_values(array_filter($field['referrer_fields']));
Modified code
if (($field['referrer_fields'])){$types = array_values(array_filter($field['referrer_types']));
}
if (($field['referrer_fields'])){
$fields = array_values(array_filter($field['referrer_fields']));
}
#14
can you provide a patch? also suppose we just need to change isset() to !empty() in both cases
#15
I don't know how to create a patch. (I installed Tortoie svn/cvs on my windows pc, but it looks like a piece of crap, or I did not spent enough time to gets the logic.)
I haven(t tried to change isset only, but the code breaks before, while evaluating the arguments, so I don't think your proposal would make it.
#16
Is it possible to fix this?
Thanks