Skip to content

[#143][#144] Change !is_null to isset#145

Merged
gbarat87 merged 1 commit into
MOODLE_400_STABLEfrom
undefined-property-issues
Apr 13, 2026
Merged

[#143][#144] Change !is_null to isset#145
gbarat87 merged 1 commit into
MOODLE_400_STABLEfrom
undefined-property-issues

Conversation

@owenherbert-catalyst

Copy link
Copy Markdown
Contributor

This merge request fixes issues (#143 & #144) where accessing $fromform->saveandnext, $fromform->abandonbutton, $fromform->submitobservation could trigger an undefined property notice. Replaced !is_null($var->property) with isset($var->property), which ensures the property is checked safely before access.

Testing - UI & Unit tests

root@37cef3b8c11c:/var/www/mdl45-unicat-wr# vendor/bin/phpunit --testsuite mod_observation_testsuite
Moodle 4.5.10+ (Build: 20260327), 57b76e8ee0a041e563e9f42185d77a0897f1ac2e
Php: 8.3.26, pgsql: 17.9 (Debian 17.9-1.pgdg13+1), OS: Linux 6.17.0-1012-oem x86_64
PHPUnit 9.6.18 by Sebastian Bergmann and contributors.

..........................................................        58 / 58 (100%)

Time: 00:13.491, Memory: 113.00 MB

OK (58 tests, 164 assertions)

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR resolves undefined property notices in mod_observation when handling specific form button actions on the session marking page by switching from direct property access via !is_null(...) to safe existence checks with isset(...).

Changes:

  • Use isset($fromform->saveandnext) to safely detect the “Save and continue” action.
  • Use isset($fromform->abandonbutton) and isset($fromform->submitobservation) to safely detect no-submit button actions (cancel/submit flows).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@gbarat87 gbarat87 merged commit f8b528a into MOODLE_400_STABLE Apr 13, 2026
4 checks passed
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

Successfully merging this pull request may close these issues.

3 participants