So after a day of diving into this issue; disabling modules, enabling modules, removing changes in local etc etc, I found the problem.
I used an extension called PhPro_Translate to do a large amount of translations for front and backend from English to Swedish and so in my std install I have just inserted all the rows of translations into core_translate (as the extension does). It turns out that one of the 80 or so translated strings under the Mage_Cms module cause the error. I honestly did not have the energy to look into exactly which string as I still have 3400 rows working :), but I have a vague idea it could have been a Swedish word with umlauts.
In the very unlikely event that someone else runs into the same problem, that's the answer!
Cheerio
UPDATE: Since this could have implications in other contexts, here's what caused the js error. In one of the translations I had used single quotes around a word to denote it was the original English term but I had forgotten to escape the quotes. VoilĂ !
<?php
namespace Vendor\Mymodule\App\Filesystem\DirectoryResolver;
use Magento\Framework\App\Filesystem\DirectoryList;
/**
* Magento directories resolver.
*/
class DirectoryResolver
{
/**
* @var DirectoryList
*/
private $directoryList;
/**
* @param DirectoryList $directoryList
*/
public function __construct(DirectoryList $directoryList)
{
$this->directoryList = $directoryList;
}
/**
* Validate path.
*
* Gets real path for directory provided in parameters and compares it with specified root directory.
* Will return TRUE if real path of provided value contains root directory path and FALSE if not.
* Throws the \Magento\Framework\Exception\FileSystemException in case when directory path is absent
* in Directories configuration.
*
* @param string $path
* @param string $directoryConfig
* @return bool
* @throws \Magento\Framework\Exception\FileSystemException
*/
public function validatePath($path, $directoryConfig = DirectoryList::MEDIA)
{
$realPath = realpath($path);
/**
* Since media directory is a symlink, need to run both paths through realpath in order for the comparison to
* work.
* The proper fix for this should involve a STORE > Configuration setting where an admin can choose whether to
* allow symlinked directories.
*/
$root = realpath($this->directoryList->getPath($directoryConfig));
// END EDIT
return strpos($realPath, $root) === 0;
}
}
Please create the require file for module registration.php and module.xml
Best Answer
looks like you are using the latest Magento 2.2.3. They did some security improvements that prevent using symlinks and so.
Maybe this issue will help you: https://github.com/magento/magento2/issues/13929