我需要做哪些更改才能使Magento与PHP 5.3一起使用?

时间:2009-08-18 19:56:59

标签: php magento

我需要将我的服务器升级到PHP 5.3,但安装了Magento,我知道Magento与PHP 5.3不能很好地兼容。

我认为这些变化不会太广泛(从我读过的内容)。但是,我想我会向SO人群开放。

有没有人成功完成这项工作?如果是这样,你有没有做好记录?

8 个答案:

答案 0 :(得分:5)

为了在PHP 5.3上运行Magento 1.3.x,您需要从相应的文件中替换以下函数:

1>的index.php

error_reporting(E_ALL | E_STRICT);

 error_reporting(E_ALL & E_STRICT & ~E_DEPRECATED);


2 - ; LIB /瓦瑞恩/ Object.php

__toString 

 __invoke


3 GT; LIB /瓦瑞恩/对PEAR.php

error_reporting(E_ALL & ~E_NOTICE);

error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);


4>下载/马吉德阿卜/对PEAR.php

error_reporting(E_ALL & ~E_NOTICE);

error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);


5个应用\代码\核心\法师\目录\模型\层\筛选\ Price.php

__toString

__invoke


6个应用\代码\核心\法师\核心\控制器\请求\ Http.php

split

explode


7个应用\代码\核心\法师\目录\模型\类别\属性\后端\ Sortby.php

split

explode


8是氢。应用\代码\核心\法师\管理员\模型\ user.php的

split

explode

对于只想应用补丁的终端用户,我建议使用以下文章: http://goivvy.com/blog/magento1.3fix/

您可以从以下Magento博客获取更多信息:
http://www.blog.magepsycho.com/how-to-run-magento-1-3-x-on-php-5-3/

希望这有帮助。

答案 1 :(得分:1)

看起来他们仍在使其兼容:

http://www.magentocommerce.com/boards/viewthread/54158/

如果我是你,我会在尝试升级到PHP5.3之前等待官方发布

答案 2 :(得分:1)

2行代码,但不是升级安全....生产服务器应该永远不会运行最新版本,我永远不会在生产服务器上升级...测试或测试肯定。 __toString - > __invoke和拆分 - >爆炸

答案 3 :(得分:0)

好吧,如果你决定用PHP 5.3运行Magento,这里是如何做到的(用1.3.2.3测试):

1:在index.php中,在第35行附近,替换

error_reporting(E_ALL | E_STRICT);

error_reporting((E_ALL | E_STRICT) & !E_DEPRECATED)

(原因:Magento经常使用split函数,在PHP 5.3中已弃用)

2:在/lib/Varien/Object.php中,第484行附近改变

public function ___toString(array $arrAttributes = array(), $valueSeparator=',')

public function __invoke(array $arrAttributes = array(), $valueSeparator=',')

(原因:我真的不知道,但它有效!)

答案 4 :(得分:0)

Re nic28的解决方案:在1.3.3.0 Magento安装中,我还需要在app / code / core / Mage / Catalog / Model / Layer / Filter / Price.php第139行进行__toString到__invoke更改:< / p>

$key=.=taxReq->__toString(array(), '_');

答案 5 :(得分:0)

我找到了一长串使用split功能的文件。它需要被爆炸所取代。只需更改函数名即可。此列表增加了MagePsycho上面发布的内容。下载程序文件夹可能包含多个文件,我使用的搜索位于第一行。

Search "\bspliti?\(" (68 hits in 54 files)
E:\magento\shop\app\code\core\Mage\Adminhtml\controllers\System\ConfigController.php (1 hits)
  Line 155:             foreach(split("\n", $e->getMessage()) as $message) {
E:\magento\shop\app\code\core\Mage\Adminhtml\Model\Observer.php (1 hits)
  Line 63:             $value = is_array($request->getPost($key)) ? $request->getPost($key) : split(',', $request->getPost($key));
E:\magento\shop\app\code\core\Mage\Adminhtml\Model\System\Config\Backend\Currency\Abstract.php (2 hits)
  Line 47:             return split(',', Mage::getConfig()->getNode('currency/options/allow', $this->getScope(), $this->getScopeId()));
  Line 59:         return split(',', Mage::getStoreConfig('system/currency/installed'));
E:\magento\shop\app\code\core\Mage\Adminhtml\Model\System\Config\Backend\Locale.php (1 hits)
  Line 49:         $values     = split(',', $this->getValue());
E:\magento\shop\app\code\core\Mage\Bundle\sql\bundle_setup\mysql4-install-0.1.0.php (1 hits)
  Line 162:     $applyTo = split(',', $installer->getAttribute('catalog_product', $field, 'apply_to'));
E:\magento\shop\app\code\core\Mage\Catalog\Model\Category.php (1 hits)
  Line 756:             $available = split(',', $available);
E:\magento\shop\app\code\core\Mage\Catalog\Model\Convert\Adapter\Product.php (2 hits)
  Line 561:             $websiteCodes = split(',', $importData['websites']);
  Line 592:                 $value = split(self::MULTI_DELIMITER, $value);
E:\magento\shop\app\code\core\Mage\Catalog\Model\Resource\Eav\Mysql4\Url.php (2 hits)
  Line 502:             $split = split('/', $category->getPath());
  Line 710:             $product->setCategoryIds(split(',', $product->getCategoryIds()));
E:\magento\shop\app\code\core\Mage\Catalog\sql\catalog_setup\mysql4-upgrade-0.7.39-0.7.40.php (1 hits)
  Line 35:     $applyTo = split(',', $installer->getAttribute('catalog_product', $field, 'apply_to'));
E:\magento\shop\app\code\core\Mage\CatalogRule\Model\Rule\Condition\Product.php (1 hits)
  Line 361:                 $value = split(',', $value);
E:\magento\shop\app\code\core\Mage\CatalogRule\sql\catalogrule_setup\mysql4-upgrade-0.7.1-0.7.2.php (1 hits)
  Line 44:         foreach (split(',', $r['store_ids']) as $storeId) {
E:\magento\shop\app\code\core\Mage\Customer\Model\Convert\Adapter\Customer.php (1 hits)
  Line 500:                 $value = split(self::MULTI_DELIMITER, $value);
E:\magento\shop\app\code\core\Mage\Downloadable\Helper\Download.php (2 hits)
  Line 210:                 $contentType = split('; ', $this->_urlHeaders['content-type']);
  Line 225:                 $contentDisposition = split('; ', $this->_urlHeaders['content-disposition']);
E:\magento\shop\app\code\core\Mage\Downloadable\sql\downloadable_setup\mysql4-install-0.1.0.php (1 hits)
  Line 46:     $applyTo = split(',', $installer->getAttribute('catalog_product', $field, 'apply_to'));
E:\magento\shop\app\code\core\Mage\Downloadable\sql\downloadable_setup\mysql4-upgrade-0.1.0-0.1.1.php (1 hits)
  Line 32: $applyTo = split(',', $installer->getAttribute('catalog_product', 'weight', 'apply_to'));
E:\magento\shop\app\code\core\Mage\Eav\Model\Convert\Adapter\Entity.php (1 hits)
  Line 107:                         $split = split('/', $k);
E:\magento\shop\app\code\core\Mage\Sales\Model\Order\Pdf\Abstract.php (1 hits)
  Line 157:         foreach (split("\|", $address) as $str) {
E:\magento\shop\lib\PEAR\SOAP\Parser.php (1 hits)
  Line 381:                 $this->message[$pos]['arrayOffset'] = split(',', substr($value, 1, strlen($value) - 2));
E:\magento\shop\lib\PEAR\SOAP\Transport\HTTP.php (2 hits)
  Line 272:         $headers = split("\r?\n", $headers);
  Line 278:             list($name, $value) = split(':', $value);
E:\magento\shop\lib\Varien\Db\Adapter\Pdo\Mysql.php (1 hits)
  Line 585:             $keyList[$v[1]] = split(',', str_replace($this->getQuoteIdentifierSymbol(), '', $v[2]));
E:\magento\shop\lib\Zend\Cache\Frontend\Page.php (1 hits)
  Line 316:                 $tmp = split(':', $headerSent);
E:\magento\shop\lib\Zend\Gdata\YouTube\VideoEntry.php (1 hits)
  Line 839:                 return split('(, *)|,', $keywordsString);
E:\magento\shop\lib\Zend\Service\Amazon.php (1 hits)
  Line 202:             $responseGroup = split(',', $options['ResponseGroup']);

答案 6 :(得分:-1)

我不打算修改Magento以使用5.3,因为更改肯定会比源假设更复杂。 PHP 5.3带有命名空间,自动加载机制肯定会改变。这意味着很多东西会在内部发生变化。长类名称如下:

// Mage_Sales_Model_Order
Mage::getModel('sales/order');

将仅在其自己的命名空间中调用,而不是:

// maybe something like this
Mage::getModel('order');
// or like this
$order = new Order();

//这取决于Magento团队将如何实现名称空间

答案 7 :(得分:-1)

我已在blog上介绍了这种情况。它实际上解释了如何解决Magento 1.3.X和PHP 5.3.X之间的不兼容问题。我希望它有所帮助。