Issue Details (XML | Word | Printable)

Key: MDL-16954
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Dongsheng Cai
Reporter: Robert Allerstorfer
Votes: 0
Watchers: 2
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle

cron.php executed on the CLI makes output to STDERR

Created: 21/Oct/08 10:04 PM   Updated: 31/Dec/08 12:57 AM
Component/s: Administration
Affects Version/s: 1.9.3
Fix Version/s: 1.9.4

File Attachments: 1. Text File [MDL-16954].patch (0.7 kB)

Environment: Unix + PHP 5.2.6

Database: Any
Participants: Dongsheng Cai, Eloy Lafuente (stronk7), Petr Škoda (skodak), Robert Allerstorfer and Tatsuya Shirai
Security Level: None
QA Assignee: Petr Škoda (skodak)
Resolved date: 03/Nov/08
Affected Branches: MOODLE_19_STABLE
Fixed Branches: MOODLE_19_STABLE


 Description  « Hide
I am executing cron.php the recommended way - via PHP's CLI instead of accessing it with a browser, having browser access completely disallowed (Site Administration -> Security -> Site policies -> Cron execution via command line only: Yes). My crontab entry is:

*/30 * * * * php -d safe_mode="off" -d open_basedir="" /path_to/moodle/admin/cron.php > /dev/null

However, this writes a warning to STDOUT, which will then get emailed every time:
PHP Notice: Undefined index: REMOTE_ADDR in /path_to/moodle/lib/moodlelib.php on line 7513

The notice of course does not harm, it is annoying however to receive all these emails. Thus, the code should be cleaned ensuring not producing any notice/warning.



 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Robert Allerstorfer added a comment - 23/Oct/08 09:14 AM
The attached patch fixes this bug.

Eloy Lafuente (stronk7) added a comment - 02/Nov/08 08:20 PM
Addressing for 1.9.4+ and assigning to Dongsheng. Patch looks fine IMO. Thanks Robert!

Dongsheng Cai added a comment - 03/Nov/08 02:26 PM
Thanks, Robert, please review.

Tatsuya Shirai added a comment - 11/Dec/08 01:01 PM

The same notice occurs in function getremoteaddr() when admin/cron.php is executed via PHP's CLI.

return cleanremoteaddr($_SERVER['REMOTE_ADDR']);

Futrhermore, if any errors are happened while cron process is running, null data is recorded in the IPaddress cell of log table (mdl_log)...


Dongsheng Cai added a comment - 11/Dec/08 02:18 PM
Thanks for your report, Tatsuya, I fixed these on CVS.

Petr Škoda (skodak) added a comment - 31/Dec/08 12:57 AM
reviewed, thanks