Moodle

lib/simpletest/testfilelib.php causing fatal errors

Details

  • Type: Bug Bug
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: 2.0
  • Fix Version/s: STABLE backlog
  • Component/s: Files API
  • Labels:
    None
  • Affected Branches:
    MOODLE_20_STABLE

Description

lib/simpletest/testfilelib.php does require_once($CFG->dirroot.'/user/lib.php'); which does not exist, causing fatal errors.

CVS says you introduced it Nico. Please fix.

I have committed a temporary change commenting out that line.

(Also many blog unit test failures for me.)

Issue Links

Activity

Hide
Tim Hunt added a comment -

Actually commenting that out was insufficient, since one of the tests uses a non-existant create_user function.

New interim fix: lib/simpletest/testfilelib.php renamed to lib/simpletest/broken_testfilelib.php

Show
Tim Hunt added a comment - Actually commenting that out was insufficient, since one of the tests uses a non-existant create_user function. New interim fix: lib/simpletest/testfilelib.php renamed to lib/simpletest/broken_testfilelib.php
Hide
Gabriel Dias added a comment -

Hi there, i submitted a patch where i replace the create_user function call for $this->user->id = $DB->insert_record('user', $this->user);
Then the tests run fine but there is some issue with test test_encodepath when comparing
http://test.url.com/path/to/page.php%3Fvar1%3Dvalue1%26var2%3Dvalue2%26forcedownload%3D1
with
file_encode_url('http://test.url.com', '/path/to/page.php?var1=value1&var2=value2', true)

The file_encode_url function returns "http://test.url.com/path/to/page.php%3Fvar1%3Dvalue1%26var2%3Dvalue2?forcedownload=1". As you can see the last "?" is wrong. I think there is no check over the quantity of parameters passed with the url when calling this function, if you agree i can create a bug and submit a patch too.

Show
Gabriel Dias added a comment - Hi there, i submitted a patch where i replace the create_user function call for $this->user->id = $DB->insert_record('user', $this->user); Then the tests run fine but there is some issue with test test_encodepath when comparing http://test.url.com/path/to/page.php%3Fvar1%3Dvalue1%26var2%3Dvalue2%26forcedownload%3D1 with file_encode_url('http://test.url.com', '/path/to/page.php?var1=value1&var2=value2', true) The file_encode_url function returns "http://test.url.com/path/to/page.php%3Fvar1%3Dvalue1%26var2%3Dvalue2?forcedownload=1". As you can see the last "?" is wrong. I think there is no check over the quantity of parameters passed with the url when calling this function, if you agree i can create a bug and submit a patch too.
Hide
Martin Dougiamas added a comment -

Is this still a problem?

Show
Martin Dougiamas added a comment - Is this still a problem?
Hide
Petr Škoda (skodak) added a comment -

unfortunately the 'broken' file tests need a complete rewrite, lowering priority for now

Show
Petr Škoda (skodak) added a comment - unfortunately the 'broken' file tests need a complete rewrite, lowering priority for now

People

Vote (1)
Watch (0)

Dates

  • Created:
    Updated: