Skip to content

impossible to assign products to category when error_reporting(0); #17

@OSdave

Description

@OSdave

I've discovered a bug in this module: when error_reporting is set to false, aka error_reporting(0);in the index.php file and Catalog URL Rewrites index set as "Update on Save", it is impossible to assign or unassign products to category.

Steps to reproduce:

  • set error reporting as false in index.php
  • set Catalog URL Rewrites index set as "Update on Save"
  • go to catalog > manage categories
  • assign or unassign a product to a category
  • click on "Save Category"

Actual result:

the "Please Wait" loading div never disappear. Firebug console indicates:

NetworkError: 500 Internal Server Error - http://magento1702.local/index.php/admin/catalog_category/save/key/2a7a1d7f31377d859e42b573383d55e1/id/22/?isAjax=true

Expected result:

the "Please Wait" loading div should disappear and the page should reload (native Magento behavior)

Why does this happen?

So far, this is what I have found out: the error is triggered in /lib/Varien/Db/Adapter/Pdo/Mysql.php, line 399:

protected function _checkDdlTransaction($sql)
{
    if (is_string($sql) && $this->getTransactionLevel() > 0) {
        $startSql = strtolower(substr(ltrim($sql), 0, 3));
        if (in_array($startSql, $this->_ddlRoutines)) {
            trigger_error(Varien_Db_Adapter_Interface::ERROR_DDL_MESSAGE, E_USER_ERROR);//line 399
        }
    }
}

the code gets there because it performs a truncate on ecomdev_urlrewrite_root_category and $this->getTransactionLevel() returns 2 at this point. This value of 2 is because Varien_Db_Adapter_Pdo_Mysql::beginTransaction is executed twice (first by Mage_Catalog_Model_Category::saveAction and then by Mage_Catalog_Model_Category::_afterSave) and Varien_Db_Adapter_Pdo_Mysql::commit (which would decrease the _transactionLevel value) is not executed

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions