small error in condition, result: warning: array_key_exists() - fix attached
vpiotr - June 16, 2008 - 18:41
| Project: | Custom review |
| Version: | 5.x-2.0-1 |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Striky2 |
| Status: | closed |
Jump to:
Description
There is a small error in condition in custom_review_form_alter():
Error message:
warning: array_key_exists() [function.array-key-exists]:
The first argument should be either a string or an integer in
/home/x/public_html/modules/custom_review/custom_review.module on line 177
Solution - change:
$short_type = substr($form_id, 0, -10); // 'short_type_node_form' => 'short_type'
if (array_key_exists($short_type, $custom_review_reviewers)) {to:
$short_type = substr($form_id, 0, -10); // 'short_type_node_form' => 'short_type'
if (!empty($short_type) && array_key_exists($short_type, $custom_review_reviewers)) {
#1
Wow nice! I'll do my best to change that today. Thx! Btw, if you want to become co-maintainer of the module, feel free to ask! I'm seeing that people are interested in the way it works, so it can be great if we help each other on the module.
And I now get why I didn't see it... I was testing the module on an environment where warning logs were deactivated :)... oops!
#2
fixed in DRUPAL-5--2-1-1. thx again
#3
#4
other error :
$short_type = substr($form_id, 0, -10); // 'short_type_node_form' => 'short_type'
if (!empty($short_type) && !empty($short_type) && array_key_exists($short_type, $custom_review_reviewers)) {