Skip to content
Browse files

Use strict check against bool false when determining if ID is present

  • Loading branch information...
1 parent f4b3d73 commit f8eb0278cd0f0e477e928bacfb3148af34157f01 @weierophinney committed
Showing with 7 additions and 7 deletions.
  1. +7 −7 library/Zend/Mvc/Controller/AbstractRestfulController.php
View
14 library/Zend/Mvc/Controller/AbstractRestfulController.php
@@ -263,7 +263,7 @@ public function onDispatch(MvcEvent $e)
// DELETE
case 'delete':
$id = $this->getIdentifier($routeMatch, $request);
- if ($id) {
+ if ($id !== false) {
$action = 'delete';
$return = $this->delete($id);
break;
@@ -275,7 +275,7 @@ public function onDispatch(MvcEvent $e)
// GET
case 'get':
$id = $this->getIdentifier($routeMatch, $request);
- if ($id) {
+ if ($id !== false) {
$action = 'get';
$return = $this->get($id);
break;
@@ -286,7 +286,7 @@ public function onDispatch(MvcEvent $e)
// HEAD
case 'head':
$id = $this->getIdentifier($routeMatch, $request);
- if (!$id) {
+ if (!$id !== false) {
$id = null;
}
$action = 'head';
@@ -304,7 +304,7 @@ public function onDispatch(MvcEvent $e)
// PATCH
case 'patch':
$id = $this->getIdentifier($routeMatch, $request);
- if (!$id) {
+ if (!$id !== false) {
throw new Exception\DomainException('Missing identifier');
}
$data = $this->processBodyContent($request);
@@ -318,10 +318,10 @@ public function onDispatch(MvcEvent $e)
break;
// PUT
case 'put':
- $id = $this->getIdentifier($routeMatch, $request);
- $data = $this->processBodyContent($request);
+ $id = $this->getIdentifier($routeMatch, $request);
+ $data = $this->processBodyContent($request);
- if ($id) {
+ if ($id !== false) {
$action = 'update';
$return = $this->update($id, $data);
break;

0 comments on commit f8eb027

Please sign in to comment.
Something went wrong with that request. Please try again.