Comment 13 for bug 1340151

Revision history for this message
Aaron Wells (u-aaronw) wrote :

Okay, fixed a couple problems in the code, so that now we always set the state of libxml_disable_entity_loader() back to what it was initially, unless the script crashes unexpectedly before we can do that.

Now it passes my tests. The state of the entity loader remains the same before and after running a Mahara script. If anyone wants to try to replicate my tests using my script from comment 11, here's the stops:

1. Have an affected PHP version installed (you can do php -v at the commandline, or run phpinfo() in a web script, to check this). See comment 8 for affected versions.

2. Copy my test script into a file called "test.php", and put it into your web root.

3. Restart Apache.

4. Load up my test.php script in your web browser. Reload it a few times. Note what it says (it will probably be "false" every time).

5. Install Mahara

6. Export a Leap2a archive from Mahara

7. Load up test.php again, and see what it says now. Refresh it a dozen or so times in case your Apache is using multiple workers or threads.

Expected result: The value you get from test.php in step 7 should be the same as the value you got in step 4.

Actual result (before patch): The value you got from test.php in step 7 was always "true".

As a further test you can alter test.php so that it leaves the the entity loader set to "true". Then revert it back to its original state that merely checks the state of the entity loader. You should now find that reloading test.php always shows "true". Now try running a Leap2a export from Mahara again, and then load up test.php after. It should again continue to show "true". Mahara should not have changed the current setting of libxml_disable_entity_loader().

Cheers,
Aaron