Created
August 23, 2012 18:52
-
-
Save mshmsh5000/3440260 to your computer and use it in GitHub Desktop.
Magento fix for parse_str() bug in CategoryController
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Addresses this bug: http://www.magentocommerce.com/bug-tracking/issue/?issue=13203 | |
* | |
* See app/code/core/Mage/Adminhtml/controllers/Catalog/CategoryController.php | |
* Mage_Adminhtml_Catalog_CategoryController::saveAction(), starting around | |
* line 307 | |
*/ | |
if (isset($data['category_products']) && | |
!$category->getProductsReadonly()) { | |
$products = array(); | |
// This can be a massive request -- i.e., all product IDs in this category. | |
// So we need to step through this instead of calling parse_str(), which can | |
// run up against the max_input_vars limit. | |
// parse_str($data['category_products'], $products); | |
$cat_products_split = explode('&', $data['category_products']); | |
foreach($cat_products_split as $row) | |
{ | |
$arr = array(); | |
// This will always work. | |
parse_str($row, $arr); | |
list($k, $v) = each($arr); | |
if (!empty($k) && !empty($v)) | |
{ | |
$products[$k] = $v; | |
} | |
} | |
if (!empty($products)) | |
{ | |
$category->setPostedProducts($products); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm using Magento 1.8 and I have solved the problem with a modification in
app/code/core/Mage/Adminhtml/controllers/Catalog/CategoryController.php
changing parse_str($data['category_products'], $products);
to:
now it works fine.