Skip to content

Commit

Permalink
Update AbstractModel.php
Browse files Browse the repository at this point in the history
PHP's function `in_array` returns `TRUE` when evaluating a needle `0` against a list of strings, which is a known issue. In my case I got an exception because a small integer was used to construct a new `DateTime` object. Calling the function in strict mode fixes this. See also http://stackoverflow.com/questions/13846769/php-in-array-0-value.
  • Loading branch information
redelschaap authored Mar 23, 2017
1 parent 2002ef2 commit c951fed
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/code/Magento/Rule/Model/AbstractModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ protected function _convertFlatToRecursive(array $data)
/**
* Convert dates into \DateTime
*/
if (in_array($key, ['from_date', 'to_date']) && $value) {
if (in_array($key, ['from_date', 'to_date'], true) && $value) {
$value = new \DateTime($value);
}
$this->setData($key, $value);
Expand Down

0 comments on commit c951fed

Please sign in to comment.