在Magento中上载产品图像时出现PHP Foreach错误
感谢您对这个问题的帮助,当我从后端管理面板上传产品图片时,我收到了这个错误在Magento中上载产品图像时出现PHP Foreach错误,php,magento,Php,Magento,感谢您对这个问题的帮助,当我从后端管理面板上传产品图片时,我收到了这个错误 Warrning: Invalid argument supplied for foreach() in /Applications/AMPPS/www/magento/app/code/core/Mage/Core/Model/File/Validator/NotProtectedExtension.php on line 91 经过一点调试,我明白了这一点 $extensions = $helper->get
Warrning: Invalid argument supplied for foreach() in /Applications/AMPPS/www/magento/app/code/core/Mage/Core/Model/File/Validator/NotProtectedExtension.php on line 91
经过一点调试,我明白了这一点
$extensions = $helper->getProtectedFileExtensions()
返回null,因此返回foreach错误
我最近没有上传任何图像,所以我不知道是什么特定的更改触发了这一点。请检查您是否有以下内容:
<protected_extensions>
<!-- PHP script file extension -->
<php>php</php>
<!-- File extension of configuration of an Apache Web server -->
<htaccess>htaccess</htaccess>
<!-- Java script file extension -->
<jsp>jsp</jsp>
<!-- Perl script file extension -->
<pl>pl</pl>
<!-- Python script file extension -->
<py>py</py>
<!-- Active Server Page script file extension -->
<asp>asp</asp>
<!-- UNIX command prompt file extension -->
<sh>sh</sh>
<!-- Common Gateway Interface script extension type -->
<cgi>cgi</cgi>
<!-- BOF HTML file extensions -->
<htm>htm</htm>
<html>html</html>
<phtml>phtml</phtml>
<shtml>shtml</shtml>
<!-- EOF HTML file extensions -->
</protected_extensions>
请检查您是否有:
<protected_extensions>
<!-- PHP script file extension -->
<php>php</php>
<!-- File extension of configuration of an Apache Web server -->
<htaccess>htaccess</htaccess>
<!-- Java script file extension -->
<jsp>jsp</jsp>
<!-- Perl script file extension -->
<pl>pl</pl>
<!-- Python script file extension -->
<py>py</py>
<!-- Active Server Page script file extension -->
<asp>asp</asp>
<!-- UNIX command prompt file extension -->
<sh>sh</sh>
<!-- Common Gateway Interface script extension type -->
<cgi>cgi</cgi>
<!-- BOF HTML file extensions -->
<htm>htm</htm>
<html>html</html>
<phtml>phtml</phtml>
<shtml>shtml</shtml>
<!-- EOF HTML file extensions -->
</protected_extensions>
在花了一天的时间调试错误之后,我发现了这个问题 我可能弄乱了设置脚本,在核心配置数据表中插入了下一行
path => 'general', value => NULL
这导致“general”的配置树指向NULL,从而指向密钥
'general/file/protected_extensions'
它永远不会被传下去。由于数据库值是在从xml文件获取配置值之后填充和添加的,因此上面的行删除了以路径general开始的所有键在花费一天时间调试错误后解决了问题 我可能弄乱了设置脚本,在核心配置数据表中插入了下一行
path => 'general', value => NULL
这导致“general”的配置树指向NULL,从而指向密钥
'general/file/protected_extensions'
它永远不会被传下去。由于数据库值是在从xml文件获取配置值之后填充和添加的,因此上面的一行删除了以路径general开始的所有键。感谢OSdave的快速回复,我尝试了您的所有3个建议,一切都如预期的那样,但仍然是sameThanks OSdave的快速回复,我尝试了你所有的3个建议,一切都如预期的那样,但萨米人也有同样的问题和解决方案,但我的值是1。不知道是怎么插进去的。你能将此标记为已接受的答案吗?我也有相同的问题和解决方案,但我的值为1。不知道是怎么插进去的。你能把这个标记为接受答案吗