Moodle

trigger_error() is used incorrectly in several places

Details

  • Type: Sub-task Sub-task
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 2.0
  • Fix Version/s: 2.0
  • Component/s: General
  • Labels:
    None
  • Affected Branches:
    MOODLE_20_STABLE
  • Fixed Branches:
    MOODLE_20_STABLE

Description

trigger_error() can not be used for informing users about fatal errors because it may not be displayed at all, it can be used only for debugging purposes
I think it should be better to use debugging() + error_log() instead in some cases

You can test it with following, it results in white page of death:

<?php
ini_set('display_errors', '0');
trigger_error('grrr');

We should not use trigger_error() before setting our error levels too because it leaks sensitive information.

Current default exception handler logs every print_error() in minimal debug mode.

Activity

Hide
Petr Škoda (skodak) added a comment -

done

Show
Petr Škoda (skodak) added a comment - done

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: