Skip to content

Commit

Permalink
Don't normalize negative numbers. Fixed #68.
Browse files Browse the repository at this point in the history
  • Loading branch information
Amir Tocker committed Mar 12, 2017
1 parent 95a1e1d commit cb1164a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Cloudinary.php
Expand Up @@ -494,7 +494,7 @@ private static function normalize_expression($exp) {
return $exp;
} else {
if (empty(self::$IF_REPLACE_RE)) {
self::$IF_REPLACE_RE = '/(\|\||>=|<=|&&|!=|>|=|<|\/|\-|\+|\*|' . implode('|', array_keys(self::$PREDEFINED_VARS)) . ')/';
self::$IF_REPLACE_RE = '/((\|\||>=|<=|&&|!=|>|=|<|\/|\-|\+|\*)(?=[ _])|' . implode('|', array_keys(self::$PREDEFINED_VARS)) . ')/';
}
if (isset($exp)) {
$exp = preg_replace('/[ _]+/', '_', $exp);
Expand Down
4 changes: 2 additions & 2 deletions tests/CloudinaryTest.php
Expand Up @@ -281,8 +281,8 @@ public function test_effect() {

public function test_effect_with_array() {
// should support effect with array
$options = array("effect" => array("sepia", 10));
$this->cloudinary_url_assertion("test", $options, CloudinaryTest::DEFAULT_UPLOAD_PATH . "e_sepia:10/test");
$options = array("effect" => array("sepia", -10));
$this->cloudinary_url_assertion("test", $options, CloudinaryTest::DEFAULT_UPLOAD_PATH . "e_sepia:-10/test");
}

public function test_density() {
Expand Down

0 comments on commit cb1164a

Please sign in to comment.