1

I'm Having 2 issues in my magento 1.9.1 app.

When I'm trying to proceed one page checkout my page redirects me to cart (but I can see in magento admin that order is placed with success)

Second issue is , when I'm tring to create invoice with comment and send it to customer i got blank page and invoice is not created. I can create invoice without sending e-mail without any error.

My system log shows: 1 Checkout issue

    2015-06-21T10:43:49+00:00 ERR (3): Warning: preg_replace_callback(): Requires argument 2, '', to be a valid callback  in /lib/Pelago/Emogrifier.php on line 269
2015-06-21T10:43:49+00:00 ERR (3): Warning: preg_replace_callback(): Requires argument 2, '', to be a valid callback  in /lib/Pelago/Emogrifier.php on line 269
  1. Invoice Issue - error is the same , so I suspect that problem is with Emogrifier.php file. I found that problem could be not enabled mbstring extension is php. In my Php mbstring is enabled.

I'm having magento 1.9.1 installation with PHP Version 5.4.23

emogifier function

public function emogrify() {
    if ($this->html === '') {
        throw new \BadMethodCallException('Please set some HTML first before calling emogrify.', 1390393096);
    }

    $xmlDocument = $this->createXmlDocument();
    $xpath = new \DOMXPath($xmlDocument);
    $this->clearAllCaches();

    // before be begin processing the CSS file, parse the document and normalize all existing CSS attributes (changes 'DISPLAY: none' to 'display: none');
    // we wouldn't have to do this if DOMXPath supported XPath 2.0.
    // also store a reference of nodes with existing inline styles so we don't overwrite them
    $this->purgeVisitedNodes();

    $nodesWithStyleAttributes = $xpath->query('//*[@style]');
    if ($nodesWithStyleAttributes !== FALSE) {
        /** @var $nodeWithStyleAttribute \DOMNode */
        foreach ($nodesWithStyleAttributes as $node) {
            $normalizedOriginalStyle = preg_replace_callback(
                '/[A-z\\-]+(?=\\:)/S',
                function (array $m) {
                    return strtolower($m[0]);
                },
                //269 line below
                $node->getAttribute('style')
            );

            // in order to not overwrite existing style attributes in the HTML, we have to save the original HTML styles
            $nodePath = $node->getNodePath();
            if (!isset($this->styleAttributesForNodes[$nodePath])) {
                $this->styleAttributesForNodes[$nodePath] = $this->parseCssDeclarationBlock($normalizedOriginalStyle);
                $this->visitedNodes[$nodePath] = $node;
            }

            $node->setAttribute('style', $normalizedOriginalStyle);
        }
    }
1
  • Blank page is php error issue, check 'exception.log' or HTTP server logs for errors
    – Nokors
    Jun 21 '15 at 19:26
0

Comment the following out:

$normalizedOriginalStyle = preg_replace_callback(
    '/[A-z\\-]+(?=\\:)/S',
    function (array $m) {
        return strtolower($m[0]);
    },
    //269 line below
    $node->getAttribute('style')
);

Place under the following:

$normalizedOriginalStyle = strtolower($node->getAttribute('style'));

This will accomplish most of what the function should be doing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.