0

I keep seeing the following lines in var/log/system.log after each transaction email is sent:

2015-10-12T00:11:12+00:00 ERR (3): Warning: DOMXPath::query(): Invalid expression in /html/lib/Pelago/Emogrifier.php on line 326
2015-10-12T00:11:12+00:00 ERR (3): Warning: DOMXPath::query(): Invalid expression in /html/lib/Pelago/Emogrifier.php on line 326
2015-10-12T00:11:12+00:00 ERR (3): Warning: Invalid argument supplied for foreach() in /html/lib/Pelago/Emogrifier.php on line 329
2015-10-12T00:11:12+00:00 ERR (3): Warning: DOMXPath::query(): Invalid expression in /html/lib/Pelago/Emogrifier.php on line 326
2015-10-12T00:11:12+00:00 ERR (3): Warning: DOMXPath::query(): Invalid expression in /html/lib/Pelago/Emogrifier.php on line 326
2015-10-12T00:11:12+00:00 ERR (3): Warning: Invalid argument supplied for foreach() in /html/lib/Pelago/Emogrifier.php on line 329

Someone knows what could cause this?

Thanks for your help!

0

As the comment in the class definition states - This class provides functions for converting CSS styles into inline style attributes in your HTML code.

Looking at the calls of emogrify() method we discover that it is called by _applyInlineCss() method which is in turn called by getPreparedTemplateText() method defined in Mage_Core_Model_Email_Template_Abstract.

The issue occurs when an invalid expression is passed to $xpath->query() also making $nodesMatchingCssSelectors invalid thus triggering the second error.

In my case, I had this issue in the new-account.phtml template that was using {{inlinecss file="email-inline.css"}} and in which at some point I had something like:

@-webkit-keyframes fa-spin {
  0% {
    -webkit-transform: rotate(0deg);
            transform: rotate(0deg);
  }
  100% {
    -webkit-transform: rotate(359deg);
            transform: rotate(359deg);
  }
}

The issue was occurring when Emogriphier library tried translate 100% into path: $nodesMatchingCssSelectors = $xpath->query(100%). Because 100% is not a valid selector the error is triggered.

/**
 * Right now, we support all CSS 1 selectors and most CSS2/3 selectors.
 *
 * @see http://plasmasturm.org/log/444/
 *
 * @param string $paramCssSelector
 *
 * @return string
 */
private function translateCssToXpath($paramCssSelector) {

A little bit late but hope this helps. :)

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.