Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined Offset on line 284 in question.php #15

Closed
dustinbrisebois opened this issue Nov 6, 2018 · 4 comments
Closed

Undefined Offset on line 284 in question.php #15

dustinbrisebois opened this issue Nov 6, 2018 · 4 comments

Comments

@dustinbrisebois
Copy link

Notice: Undefined offset: 26 in /var/www/data/pvschools/public_html/moodle/question/type/wordselect/question.php on line 286
Exception - Call to a member function get_without_delim() on null

As per line:

$summary .= " " . $allwords[substr($index, 1)]->get_without_delim() . " ";

Should be something more similar to this:

if (isset($allwords[substr($index, 1)])) {
          $summary .= " " . $allwords[substr($index, 1)]->get_without_delim() . " ";
} else {
          return '';
}

Where the assumption that the item exists in the array - if it doesn't it faults out.

@marcusgreen
Copy link
Owner

Thanks Dustin, Can you tell me how to reproduce this so that when I update the code I can include an automated test for it?

@marcusgreen
Copy link
Owner

would you email me at marcusgreen at mailbox.org

@dustinbrisebois
Copy link
Author

@marcusgreen were you able to sort this out?

@marcusgreen
Copy link
Owner

Hi Dustin
I was never able to reproduce this but I have just done a commit which I think is a slightly more concise version of your suggestion just in case. Please correct me if you think it doesn't do what you expect.
daf2e64
I am currently working on a branch that will support the mobile app so this will get pushed to the plugins database as part of that release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants