Fixed XML Error Output Not Particularly Useful

pegasus

Well-known member
Affected version
2.1.7
When an expected XML response instead throws a PHP error, the existing output is not as useful as it can be for debugging. The stack trace lists files and line numbers, but the actual error that was thrown does not, so the line that has a problem is not specified. I temporarily fixed this on my test board by making the following edit to src/XF/Mvc/View.php.

Find:
Code:
            $rootNode->appendChild(
                \XF\Util\Xml::createDomElement($document, 'error', $exceptionMessage)
            );
Replace with:
Code:
            $errNode = \XF\Util\Xml::createDomElement($document, 'error', $exceptionMessage);
            $errNode->setAttribute('file', $e->getFile());
            $errNode->setAttribute('line', $e->getLine());

            $rootNode->appendChild($errNode);
 
Thank you for reporting this issue, it has now been resolved. We are aiming to include any changes that have been made in a future XF release (2.1.8).

Change log:
Include file and line number in exception XML response
There may be a delay before changes are rolled out to the XenForo Community.
 
Top Bottom