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

Added case for when certificationInstruments inside the getCertificat… #3627

Conversation

maltheism
Copy link
Member

…ionInstruments() function has empty string and fixes console warning

This pull request Fresh install of Loris will output a console warning when going to Clinical->Training. Fixed by checking if the variable $certificationInstruments is a blank string inside the function getCertificationInstruments() and resulting in the warning as no array was created..

See also: Bug #14380

@maltheism maltheism added Category: Bug PR or issue that aims to report or fix a bug [branch] bugfix labels May 2, 2018
@maltheism maltheism force-pushed the clinical_training_empty_certificationInstruments_fix branch from 35ddfb2 to dacb837 Compare May 2, 2018 13:29
…ionInstruments() function has empty string and fixes console warning
@maltheism maltheism force-pushed the clinical_training_empty_certificationInstruments_fix branch from dacb837 to 93dcf92 Compare May 2, 2018 17:40
PapillonMcGill
PapillonMcGill previously approved these changes May 7, 2018
Copy link
Contributor

@PapillonMcGill PapillonMcGill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ZainVirani
Copy link
Contributor

Was this PR supposed to remove the console warning or change it?

I am getting a new warning now

[Mon May 07 11:29:22.989918 2018] [:error] [pid 19758] [client 142.157.144.81:53714] PHP Warning:  trim() expects parameter 1 to be string, array given in /var/www/LORIS/Loris/modules/training/php/training.class.inc on line 119, referer: http://132.206.37.24//statistics/
[Mon May 07 11:29:22.990017 2018] [:error] [pid 19758] [client 142.157.144.81:53714] PHP Stack trace:, referer: http://132.206.37.24//statistics/
[Mon May 07 11:29:22.990061 2018] [:error] [pid 19758] [client 142.157.144.81:53714] PHP   1. {main}() /var/www/LORIS/Loris/htdocs/main.php:0, referer: http://132.206.37.24//statistics/
[Mon May 07 11:29:22.990082 2018] [:error] [pid 19758] [client 142.157.144.81:53714] PHP   2. NDB_Caller->load() /var/www/LORIS/Loris/htdocs/main.php:169, referer: http://132.206.37.24//statistics/
[Mon May 07 11:29:22.990101 2018] [:error] [pid 19758] [client 142.157.144.81:53714] PHP   3. LORIS\\training\\Module->loadPage() /var/www/LORIS/Loris/php/libraries/NDB_Caller.class.inc:138, referer: http://132.206.37.24//statistics/
[Mon May 07 11:29:22.990118 2018] [:error] [pid 19758] [client 142.157.144.81:53714] PHP   4. LORIS\\training\\Training->setup() /var/www/LORIS/Loris/php/libraries/Module.class.inc:151, referer: http://132.206.37.24//statistics/
[Mon May 07 11:29:22.990135 2018] [:error] [pid 19758] [client 142.157.144.81:53714] PHP   5. LORIS\\training\\Training->getCertificationInstruments() /var/www/LORIS/Loris/modules/training/php/training.class.inc:46, referer: http://132.206.37.24//statistics/
[Mon May 07 11:29:22.990152 2018] [:error] [pid 19758] [client 142.157.144.81:53714] PHP   6. trim() /var/www/LORIS/Loris/modules/training/php/training.class.inc:119, referer: http://132.206.37.24//statistics/

"SELECT ID
FROM test_names
WHERE Test_name
LIKE '%$test_key%'"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these lines should be aligned with the query, other than that its ready to be approved

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay fixed 👍

@ZainVirani ZainVirani added the Passed manual tests PR has been successfully tested by at least one peer label May 14, 2018
@ZainVirani
Copy link
Contributor

ZainVirani commented May 14, 2018

Unrelated but I believe the selectOne function should not be used as it does not support prepared statements. Ideally it would be pselectOne, but that change is out of the scope of this PR.

Ignore this -- fixed on major

= \Utility::toArray($certificationInstruments['test']);
foreach ($certificationInstruments['test'] as $certificationInstrument) {
$test_key = $certificationInstrument['@']['value'];
$testID = $DB->selectOne(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be pselectOne()

@maltheism maltheism dismissed stale reviews from PapillonMcGill and ZainVirani May 18, 2018 12:46

switched it to pselectOne

@driusan driusan merged commit 193e2f4 into aces:bugfix May 28, 2018
@ridz1208 ridz1208 added this to the 19.1.1 milestone May 28, 2018
@maltheism maltheism deleted the clinical_training_empty_certificationInstruments_fix branch May 24, 2020 02:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Bug PR or issue that aims to report or fix a bug Passed manual tests PR has been successfully tested by at least one peer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants