更新: 问题已定位,依赖s9e/text-formatter的extension初始化其BBCode模块会导致该报错,禁用后回复正常
参考之前官网论坛一个相似的问题,定位到vendor/s9e/text-formatter/src/Plugins/BBCodes/Configurator/repository.xml解析失败。
在服务器上执行了以下测试,可以正常解析该文件
<?php
$path = '/data/wwwroot/mountnoon/vendor/s9e/text-formatter/src/Plugins/BBCodes/Configurator/repository.xml';
error_reporting(-1);
#phpinfo();
$dom = new DOMDocument;
$dom->preserveWhiteSpace = false;
libxml_use_internal_errors(true);
var_dump($dom->load($path));
var_dump(libxml_get_errors());
die($dom->saveXML());
在浏览器远程执行失败,返回结果为
bool(false) array(1) { [0]=> object(LibXMLError)#2 (6) { ["level"]=> int(1) ["code"]=> int(1549) ["column"]=> int(0) ["message"]=> string(131) "failed to load external entity "/data/wwwroot/mountnoon/vendor/s9e/text-formatter/src/Plugins/BBCodes/Configurator/repository.xml" " ["file"]=> string(0) "" ["line"]=> int(0) } }
flarum debug信息
InvalidArgumentException thrown with message "Invalid repository file"
Stacktrace:
#75 InvalidArgumentException in /data/wwwroot/mountnoon/vendor/s9e/text-formatter/src/Plugins/BBCodes/Configurator/Repository.php:30
#74 s9e\TextFormatter\Plugins\BBCodes\Configurator\Repository:__construct in /data/wwwroot/mountnoon/vendor/s9e/text-formatter/src/Plugins/BBCodes/Configurator/RepositoryCollection.php:22
#73 s9e\TextFormatter\Plugins\BBCodes\Configurator\RepositoryCollection:normalizeValue in /data/wwwroot/mountnoon/vendor/s9e/text-formatter/src/Configurator.php:7906
#72 s9e\TextFormatter\Configurator\Collections\NormalizedCollection:set in /data/wwwroot/mountnoon/vendor/s9e/text-formatter/src/Configurator.php:7876
#71 s9e\TextFormatter\Configurator\Collections\NormalizedCollection:add in /data/wwwroot/mountnoon/vendor/s9e/text-formatter/src/Plugins/BBCodes/Configurator.php:80
#70 s9e\TextFormatter\Plugins\BBCodes\Configurator:setUp in /data/wwwroot/mountnoon/vendor/s9e/text-formatter/src/Plugins/ConfiguratorBase.php:35
#69 s9e\TextFormatter\Plugins\ConfiguratorBase:__construct in /data/wwwroot/mountnoon/vendor/s9e/text-formatter/src/Configurator.php:8621
#68 s9e\TextFormatter\Configurator\Collections\PluginCollection:load in /data/wwwroot/mountnoon/vendor/s9e/text-formatter/src/Configurator.php:57
#67 s9e\TextFormatter\Configurator:__get in /data/wwwroot/mountnoon/vendor/s9e/text-formatter/src/Plugins/MediaEmbed/Configurator.php:48
#66 s9e\TextFormatter\Plugins\MediaEmbed\Configurator:setUp in /data/wwwroot/mountnoon/vendor/s9e/text-formatter/src/Plugins/ConfiguratorBase.php:35
#65 s9e\TextFormatter\Plugins\ConfiguratorBase:__construct in /data/wwwroot/mountnoon/vendor/s9e/text-formatter/src/Configurator.php:8621
#64 s9e\TextFormatter\Configurator\Collections\PluginCollection:load in /data/wwwroot/mountnoon/vendor/s9e/text-formatter/src/Configurator.php:57
#63 s9e\TextFormatter\Configurator:__get in /data/wwwroot/mountnoon/vendor/c78/flarum-ext-mediaembed-https/bootstrap.php:14
#62 c78\MediaEmbed\{closure} in /data/wwwroot/mountnoon/vendor/illuminate/events/Dispatcher.php:221
#61 call_user_func_array in /data/wwwroot/mountnoon/vendor/illuminate/events/Dispatcher.php:221
#60 Illuminate\Events\Dispatcher:fire in /data/wwwroot/mountnoon/vendor/flarum/core/src/Formatter/Formatter.php:120
#59 Flarum\Formatter\Formatter:getConfigurator in /data/wwwroot/mountnoon/vendor/flarum/core/src/Formatter/Formatter.php:153
#58 Flarum\Formatter\Formatter:Flarum\Formatter\{closure} in /data/wwwroot/mountnoon/vendor/illuminate/cache/Repository.php:239
#57 Illuminate\Cache\Repository:rememberForever in /data/wwwroot/mountnoon/vendor/flarum/core/src/Formatter/Formatter.php:154
#56 Flarum\Formatter\Formatter:getComponent in /data/wwwroot/mountnoon/vendor/flarum/core/src/Formatter/Formatter.php:186
#55 Flarum\Formatter\Formatter:getRenderer in /data/wwwroot/mountnoon/vendor/flarum/core/src/Formatter/Formatter.php:76
#54 Flarum\Formatter\Formatter:render in /data/wwwroot/mountnoon/vendor/flarum/core/src/Core/Post/CommentPost.php:164
#53 Flarum\Core\Post\CommentPost:getContentHtmlAttribute in /data/wwwroot/mountnoon/vendor/illuminate/database/Eloquent/Model.php:2700
#52 Illuminate\Database\Eloquent\Model:mutateAttribute in /data/wwwroot/mountnoon/vendor/illuminate/database/Eloquent/Model.php:2602
#51 Illuminate\Database\Eloquent\Model:getAttributeValue in /data/wwwroot/mountnoon/vendor/illuminate/database/Eloquent/Model.php:2582
#50 Illuminate\Database\Eloquent\Model:getAttribute in /data/wwwroot/mountnoon/vendor/flarum/core/src/Database/AbstractModel.php:118
#49 Flarum\Database\AbstractModel:getAttribute in /data/wwwroot/mountnoon/vendor/illuminate/database/Eloquent/Model.php:3339
#48 Illuminate\Database\Eloquent\Model:__get in /data/wwwroot/mountnoon/vendor/flarum/core/src/Api/Serializer/PostBasicSerializer.php:47
#47 Flarum\Api\Serializer\PostBasicSerializer:getDefaultAttributes in /data/wwwroot/mountnoon/vendor/flarum/core/src/Api/Serializer/AbstractSerializer.php:71
#46 Flarum\Api\Serializer\AbstractSerializer:getAttributes in /data/wwwroot/mountnoon/vendor/tobscure/json-api/src/Resource.php:169
#45 Tobscure\JsonApi\Resource:getAttributes in /data/wwwroot/mountnoon/vendor/tobscure/json-api/src/Resource.php:75
#44 Tobscure\JsonApi\Resource:toArray in /data/wwwroot/mountnoon/vendor/tobscure/json-api/src/Document.php:187
#43 Tobscure\JsonApi\Document:Tobscure\JsonApi\{closure} in [internal]:0
#42 array_map in /data/wwwroot/mountnoon/vendor/tobscure/json-api/src/Document.php:188
#41 Tobscure\JsonApi\Document:toArray in /data/wwwroot/mountnoon/vendor/tobscure/json-api/src/Document.php:224
#40 Tobscure\JsonApi\Document:jsonSerialize in /data/wwwroot/mountnoon/vendor/flarum/core/src/Api/JsonApiResponse.php:29
#39 Flarum\Api\JsonApiResponse:__construct in /data/wwwroot/mountnoon/vendor/flarum/core/src/Api/Controller/AbstractSerializeController.php:112
#38 Flarum\Api\Controller\AbstractSerializeController:handle in /data/wwwroot/mountnoon/vendor/flarum/core/src/Api/Client.php:69
#37 Flarum\Api\Client:send in /data/wwwroot/mountnoon/vendor/flarum/core/src/Forum/Controller/IndexController.php:85
#36 Flarum\Forum\Controller\IndexController:getDocument in /data/wwwroot/mountnoon/vendor/flarum/core/src/Forum/Controller/IndexController.php:68
#35 Flarum\Forum\Controller\IndexController:getView in /data/wwwroot/mountnoon/vendor/flarum/core/src/Http/Controller/AbstractWebAppController.php:37
#34 Flarum\Http\Controller\AbstractWebAppController:render in /data/wwwroot/mountnoon/vendor/flarum/core/src/Http/Controller/AbstractHtmlController.php:25
#33 Flarum\Http\Controller\AbstractHtmlController:handle in /data/wwwroot/mountnoon/vendor/flarum/core/src/Http/Handler/ControllerRouteHandler.php:53
#32 Flarum\Http\Handler\ControllerRouteHandler:__invoke in /data/wwwroot/mountnoon/vendor/flarum/core/src/Http/Middleware/DispatchRoute.php:69
#31 Flarum\Http\Middleware\DispatchRoute:__invoke in /data/wwwroot/mountnoon/vendor/zendframework/zend-stratigility/src/Dispatch.php:212
#30 Zend\Stratigility\Dispatch:dispatchCallableMiddleware in /data/wwwroot/mountnoon/vendor/zendframework/zend-stratigility/src/Dispatch.php:88
#29 Zend\Stratigility\Dispatch:__invoke in /data/wwwroot/mountnoon/vendor/zendframework/zend-stratigility/src/Next.php:160
#28 Zend\Stratigility\Next:__invoke in /data/wwwroot/mountnoon/vendor/flarum/core/src/Http/Middleware/SetLocale.php:51
#27 Flarum\Http\Middleware\SetLocale:__invoke in /data/wwwroot/mountnoon/vendor/zendframework/zend-stratigility/src/Dispatch.php:212
#26 Zend\Stratigility\Dispatch:dispatchCallableMiddleware in /data/wwwroot/mountnoon/vendor/zendframework/zend-stratigility/src/Dispatch.php:88
#25 Zend\Stratigility\Dispatch:__invoke in /data/wwwroot/mountnoon/vendor/zendframework/zend-stratigility/src/Next.php:160
#24 Zend\Stratigility\Next:__invoke in /data/wwwroot/mountnoon/vendor/flarum/core/src/Http/Middleware/AuthenticateWithSession.php:36
#23 Flarum\Http\Middleware\AuthenticateWithSession:__invoke in /data/wwwroot/mountnoon/vendor/zendframework/zend-stratigility/src/Dispatch.php:212
#22 Zend\Stratigility\Dispatch:dispatchCallableMiddleware in /data/wwwroot/mountnoon/vendor/zendframework/zend-stratigility/src/Dispatch.php:88
#21 Zend\Stratigility\Dispatch:__invoke in /data/wwwroot/mountnoon/vendor/zendframework/zend-stratigility/src/Next.php:160
#20 Zend\Stratigility\Next:__invoke in /data/wwwroot/mountnoon/vendor/flarum/core/src/Http/Middleware/RememberFromCookie.php:39
#19 Flarum\Http\Middleware\RememberFromCookie:__invoke in /data/wwwroot/mountnoon/vendor/zendframework/zend-stratigility/src/Dispatch.php:212
#18 Zend\Stratigility\Dispatch:dispatchCallableMiddleware in /data/wwwroot/mountnoon/vendor/zendframework/zend-stratigility/src/Dispatch.php:88
#17 Zend\Stratigility\Dispatch:__invoke in /data/wwwroot/mountnoon/vendor/zendframework/zend-stratigility/src/Next.php:160
#16 Zend\Stratigility\Next:__invoke in /data/wwwroot/mountnoon/vendor/flarum/core/src/Http/Middleware/StartSession.php:48
#15 Flarum\Http\Middleware\StartSession:__invoke in /data/wwwroot/mountnoon/vendor/zendframework/zend-stratigility/src/Dispatch.php:212
#14 Zend\Stratigility\Dispatch:dispatchCallableMiddleware in /data/wwwroot/mountnoon/vendor/zendframework/zend-stratigility/src/Dispatch.php:88
#13 Zend\Stratigility\Dispatch:__invoke in /data/wwwroot/mountnoon/vendor/zendframework/zend-stratigility/src/Next.php:160
#12 Zend\Stratigility\Next:__invoke in /data/wwwroot/mountnoon/vendor/flarum/core/src/Http/Middleware/ParseJsonBody.php:31
#11 Flarum\Http\Middleware\ParseJsonBody:__invoke in /data/wwwroot/mountnoon/vendor/zendframework/zend-stratigility/src/Dispatch.php:212
#10 Zend\Stratigility\Dispatch:dispatchCallableMiddleware in /data/wwwroot/mountnoon/vendor/zendframework/zend-stratigility/src/Dispatch.php:88
#9 Zend\Stratigility\Dispatch:__invoke in /data/wwwroot/mountnoon/vendor/zendframework/zend-stratigility/src/Next.php:160
#8 Zend\Stratigility\Next:__invoke in /data/wwwroot/mountnoon/vendor/flarum/core/src/Http/Middleware/HandleErrors.php:61
#7 Flarum\Http\Middleware\HandleErrors:__invoke in /data/wwwroot/mountnoon/vendor/zendframework/zend-stratigility/src/Dispatch.php:212
#6 Zend\Stratigility\Dispatch:dispatchCallableMiddleware in /data/wwwroot/mountnoon/vendor/zendframework/zend-stratigility/src/Dispatch.php:88
#5 Zend\Stratigility\Dispatch:__invoke in /data/wwwroot/mountnoon/vendor/zendframework/zend-stratigility/src/Next.php:160
#4 Zend\Stratigility\Next:__invoke in /data/wwwroot/mountnoon/vendor/zendframework/zend-stratigility/src/MiddlewarePipe.php:111
#3 Zend\Stratigility\MiddlewarePipe:__invoke in /data/wwwroot/mountnoon/vendor/flarum/core/src/Http/AbstractServer.php:55
#2 Flarum\Http\AbstractServer:__invoke in /data/wwwroot/mountnoon/vendor/zendframework/zend-diactoros/src/Server.php:157
#1 Zend\Diactoros\Server:listen in /data/wwwroot/mountnoon/vendor/flarum/core/src/Http/AbstractServer.php:36
#0 Flarum\Http\AbstractServer:listen in /data/wwwroot/mountnoon/index.php:16