danslo / Magento-HHVM-Module-Compatibility

Magento installation with a bunch of modules that I test on HHVM.
Open Software License 3.0
35 stars 6 forks source link

Magento 1.8.1 backend not working properly after 20140514 builds #4

Open fcorriga opened 10 years ago

fcorriga commented 10 years ago

As per title, after 20140514 nighlty magento backend doesnt work properly.

To reproduce: 1 - Go to Catalog->Products and try to filter by status or by visibility. No filtering happens. 2 - Enter a product and try to save it. It sais there are some mandatory fields even if they're selected.

Cause: Some

More details are following in the next post (testing).

elachino commented 10 years ago

The problems are getOptionArray functions, with this hhvm version, not load options correctly like in this case:

Mage_Adminhtml_Block_Catalog_Product_Grid:

$this->addColumn('status',
        array(
            'header'=> Mage::helper('catalog')->__('Status'),
            'width' => '70px',
            'index' => 'status',
            'type'  => 'options',
            'options' => Mage::getSingleton('catalog/product_status')->getOptionArray(),
    ));

Mage_Catalog_Model_Product_Status:

const STATUS_ENABLED    = 1;
const STATUS_DISABLED   = 2;

/**
 * Retrieve option array
 *
 * @return array
 */
static public function getOptionArray()
{
    return array(
        self::STATUS_ENABLED    => Mage::helper('catalog')->__('Enabled'),
        self::STATUS_DISABLED   => Mage::helper('catalog')->__('Disabled')
    );
}

but we have this form select:

<select id="productGrid_product_filter_status" class="no-changes" name="status">
<option value=""></option> 
<option value="">Enabled</option>
<option value="">Disabled</option>
</select>
fcorriga commented 10 years ago

the issue seems to be fixed with the latest 20140519 build

fcorriga commented 10 years ago

The bug is again happening in another part of the backend: Configuration -> System Can't save since the Storage configuration for media "Filesystem" value is not populated (should be "0" instead of ""). This time even the 20140514 build doesn't work. Screenshot of the problem: http://www.webalice.it/f.corriga/temp/bug.jpeg

elachino commented 10 years ago

To fix this bug we had to rewrite function _optionToHtml in lib/Varien/Data/Form/Element/Select.php, changed line 91, from

$html = '<option value="'.$this->_escape($option['value']).'"'; 

to

$html = '<option value="'.htmlspecialchars($option['value'],ENT_COMPAT).'"';

it is the same thing but the second works fine, like if it is a timing problem.

danslo commented 10 years ago

Still not able to reproduce the bug, sorry :-(

You'll have to narrow it down to a smaller example before I can look at fixing it in HHVM.

elachino commented 10 years ago

Hi Danslo, Sorry, we didn't see your post before. I've seen that in new hhvm version there is a "Fix substitution of invalid UTF8 sequences in htmlspecialchars", that thinks resolve it. We try and test it today.