Zend Framework

Zend_Rest_Server::returnResponse() null == $flag should be null === $flag

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Blocker Blocker
  • Resolution: Fixed
  • Affects Version/s: 1.8.2
  • Fix Version/s: 1.9.0
  • Component/s: Zend_Rest_Server
  • Labels:
    None

Description

since
null == null and null == false and null == 0
but
null === null and null !== false and null !== 0

the Zend_Rest_Server::returnResponse() function should be changed form

Zend/Rest/Server.php
public function returnResponse($flag = null)
    {
        if (null == $flag) { //<-- 2 equal signs
            return $this->_returnResponse;
        }

        $this->_returnResponse = ($flag) ? true : false;
        return $this;
    }

to

Zend/Rest/Server.php
public function returnResponse($flag = null)
    {
        if (null === $flag) { //<-- 3 equal signs or use is_null()
            return $this->_returnResponse;
        }

        $this->_returnResponse = ($flag) ? true : false;
        return $this;
    }

The way it is now, if you try to set it to false, it thinks it's null and returns $this->_returnResponse instead of setting it.

Activity

Hide
Satoru Yoshida added a comment -

Solved in SVN r16347

Show
Satoru Yoshida added a comment - Solved in SVN r16347

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: