Invalid repository file with PHP7 and Debian 9

Get help with installation and running phpBB 3.2.x here. Please do not post bug reports, feature requests, or extension related questions here.
Post Reply
ekalin
Registered User
Posts: 4
Joined: Sat Sep 09, 2017 2:34 pm

Invalid repository file with PHP7 and Debian 9

Post by ekalin » Sat Sep 09, 2017 2:51 pm

I upgraded my server to Debian 9, which brough in PHP 7 (7.0.19, to be more exact).

My old phpBB 3.1.10 stopped worked, so I decided to upgrade to the latest 3.2.1. I followed the instructions at https://www.phpbb.com/support/docs/en/3 ... upgrade31/, basically replacing everything with the new version, expect for config.php and the directories listed there.

The database upgrade was successful, and I can access the ACP (or at least some parts of it). But the main forum page does not load. I get the following errors in the log:

Code: Select all

2017-09-09 11:44:00: (mod_fastcgi.c.2543) FastCGI-stderr: PHP Fatal error:  Uncaught InvalidArgumentException: Invalid repository file in /storage/www/kildclient/forum/vendor/s9e/text-formatter/src/Plugins/BBCodes/Configurator/Repository.php:30
2017-09-09 11:44:00: (mod_fastcgi.c.2543) FastCGI-stderr: Stack trace:
2017-09-09 11:44:00: (mod_fastcgi.c.2543) FastCGI-stderr: #0 /storage/www/kildclient/forum/vendor/s9e/text-formatter/src/Plugins/BBCodes/Configurator/RepositoryCollection.php(22): s9e\TextFormatter\Plugins\BBCodes\Configurator\Repository->__construct('/storage/www/ki...', Object(s9e\TextFormatter\Plugins\BBCodes\Configurator\BBCodeMonkey))
2017-09-09 11:44:00: (mod_fastcgi.c.2543) FastCGI-stderr: #1 /storage/www/kildclient/forum/vendor/s9e/text-formatter/src/Configurator.php(7941): s9e\TextFormatter\Plugins\BBCodes\Configurator\RepositoryCollection->normalizeValue('/storage/www/ki...')
2017-09-09 11:44:00: (mod_fastcgi.c.2543) FastCGI-stderr: #2 /storage/www/kildclient/forum/vendor/s9e/text-formatter/src/Configurator.php(7911): s9e\TextFormatter\Configurator\Collections\NormalizedCollection->set('default', '/storage/www/ki...')
2017-09-09 11:44:00: (mod_fastcgi.c.2543) FastCGI-stderr: #3 /storage/www/kildclient/forum/vendor/s9e/text-formatter/src/Plugins/BBCodes/Configurator.php(80): s9e\TextFormatter\Configurator\Collections\NormalizedCollection->add('defau in /storage/www/kildclient/forum/vendor/s9e/text-formatter/src/Plugins/BBCodes/Configurator/Repository.php on line 30
Does anyone have any idea how to solve that?

Thanks,

User avatar
JoshyPHP
Code Contributor
Posts: 657
Joined: Mon Jul 11, 2011 12:28 am

Re: Invalid repository file with PHP7 and Debian 9

Post by JoshyPHP » Sat Sep 09, 2017 5:29 pm

Something related to XML, maybe an issue with the DOM extension. Put the following code in a PHP file, upload it to your server, execute it and it may give you a better error message:

Code: Select all

<?php

$dom = new DOMDocument;
$dom->preserveWhiteSpace = false;
var_dump($dom->load('/storage/www/kildclient/forum/vendor/s9e/text-formatter/src/Plugins/BBCodes/Configurator/repository.xml'));
I wrote the thing that does the BBCodes in 3.2. Unless it broke yours, in which case it was somebody else with a similar name.

ekalin
Registered User
Posts: 4
Joined: Sat Sep 09, 2017 2:34 pm

Re: Invalid repository file with PHP7 and Debian 9

Post by ekalin » Sat Sep 09, 2017 6:26 pm

Running that file through the webserver, I get this error:

PHP Warning: DOMDocument::load(): I/O warning : failed to load external entity &quot;/storage/www/kildclient/forum/vendor/s9e/text-formatter/src/Plugins/BBCodes/Configurator/repository.xml&quot; in /storage/www/kildclient/test-l.php on line 5

Running the script directly in the command line works, so the file itself is OK.

Permissions are also fine. I tested this script got the contents of the file:

Code: Select all

<?php
$c = file_get_contents('/storage/www/kildclient/forum/vendor/s9e/text-formatter/src/Plugins/BBCodes/Configurator/repository.xml')
echo $c
I was able to make your script work by adding

Code: Select all

libxml_disable_entity_loader(false);
to the file. Adding this to config.php made the forum load again. However, this seems to me like a hack, and from what I searched this apparently disables a security feature.

User avatar
JoshyPHP
Code Contributor
Posts: 657
Joined: Mon Jul 11, 2011 12:28 am

Re: Invalid repository file with PHP7 and Debian 9

Post by JoshyPHP » Sat Sep 09, 2017 6:38 pm

There's no external entity in this XML file. It would be interesting to remove parts of the file (the <bbcode> elements) until you find out which one triggers this error.
I wrote the thing that does the BBCodes in 3.2. Unless it broke yours, in which case it was somebody else with a similar name.

ekalin
Registered User
Posts: 4
Joined: Sat Sep 09, 2017 2:34 pm

Re: Invalid repository file with PHP7 and Debian 9

Post by ekalin » Sat Sep 09, 2017 6:53 pm

I think the "external entity" is the whole file.

I tried with an empty xml file, and got the same error. Also, running the script in the command line works.

Moreover, this works, for the same file:

Code: Select all

<?php

$dom = new DOMDocument;
$dom->preserveWhiteSpace = false;
$c = file_get_contents('/storage/www/kildclient/forum/vendor/s9e/text-formatter/src/Plugins/BBCodes/Configurator/repository.xml');
var_dump($dom->loadXML($c));
For the record, I'm using lighttpd with its FastCGI module. It seems to be some restriction imposed by this setup that prevents libxml from directly reading files.

Mortal
Registered User
Posts: 1
Joined: Wed Sep 13, 2017 5:33 pm

Re: Invalid repository file with PHP7 and Debian 9

Post by Mortal » Wed Sep 13, 2017 5:41 pm

Got the same problem here: I installed the package php-fdomdocument and it fixes the problem.

ekalin
Registered User
Posts: 4
Joined: Sat Sep 09, 2017 2:34 pm

Re: Invalid repository file with PHP7 and Debian 9

Post by ekalin » Wed Sep 13, 2017 8:06 pm

Well, now the problem does not happen even after I reverted the little hack I had used (and restarted the http server, just to be sure). But I'll keep this solution in mind if the problem happens again.

Post Reply

Return to “[3.2.x] Support Forum”

cron