Home > Forum > General discussion/Presale questions > Site Discussion > Undefined offset 0 quiz.php line 401
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: Undefined offset 0 quiz.php line 401

Undefined offset 0 quiz.php line 401 2 years 1 month ago #25520

  • James
  • James's Avatar
  • Fresh Boarder
  • Posts: 4
  • Karma: 0

Another Notice so not necessarily a problem
Notice: Undefined offset: 0 in C:\.........\components\com_joomlaquiz\models\quiz.php on line 401
This line is using the list function to assign a result to a single variable which as it stands looks a bit overkill however there might be a reason for this or it could be legacy or future expansion.

The function being called is the JEventDispatcher trigger which returns an array of results so we have changed it to not do anything on an empty array of results and therefore doesn't complain about an undefined offset, otherwise we take the first array element.
list($processed_desc) = $dispatcher->trigger('onQuizCustomFieldsRender', array($quiz_params->c_description));
if($processed_desc) $quiz_params->c_description = $processed_desc;
if(!empty($processed_desc = $dispatcher->trigger('onQuizCustomFieldsRender', array($quiz_params->c_description)))) $quiz_params->c_description = $processed_desc[0];
Last Edit: 2 years 1 month ago by James. Reason: Needs to be moved to Joomla Quix Deluxe Category please
The administrator has disabled public write access.
  • Page:
  • 1
Time to create page: 0.141 seconds