Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Zend\Db\Sql\Predicate\Between fails with min and max values of 0 #3001

Closed
kirkmadera opened this Issue · 3 comments

4 participants

@kirkmadera

Zend\Db\Sql\Predicate\Between has an invalid empty check rather than !is_null() for $minValue and $maxValue. This means that if either value is 0 it will not get set.

    /**
     * Constructor
     *
     * @param  string $identifier
     * @param  int|float|string $minValue
     * @param  int|float|string $maxValue
     */
    public function __construct($identifier = null, $minValue = null, $maxValue = null)
    {
        if ($identifier) {
            $this->setIdentifier($identifier);
        }
        if ($minValue) {
            $this->setMinValue($minValue);
        }
        if ($maxValue) {
            $this->setMaxValue($maxValue);
        }
    }

Should be

    /**
     * Constructor
     *
     * @param  string $identifier
     * @param  int|float|string $minValue
     * @param  int|float|string $maxValue
     */
    public function __construct($identifier = null, $minValue = null, $maxValue = null)
    {
        if ($identifier) {
            $this->setIdentifier($identifier);
        }
        if (!is_null($minValue)) {
            $this->setMinValue($minValue);
        }
        if (!is_null($maxValue)) {
            $this->setMaxValue($maxValue);
        }
    }
@Maks3w
Collaborator

Can you send us a patch with the fix and a test case?

@stormwild

Sent pull request #3007

@prolic

Can be closed now.

@Maks3w Maks3w closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.