Skip to content

Commit e3d3c1a

Browse files
committed
Thank you Joaquín!
1 parent 1809064 commit e3d3c1a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

api.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -953,7 +953,7 @@ class PHP_CRUD_API {
953953
protected function mapMethodToAction($method,$key) {
954954
switch ($method) {
955955
case 'OPTIONS': return 'headers';
956-
case 'GET': return $key?'read':'list';
956+
case 'GET': return ($key===false)?'list':'read';
957957
case 'PUT': return 'update';
958958
case 'POST': return 'create';
959959
case 'DELETE': return 'delete';
@@ -964,7 +964,7 @@ protected function mapMethodToAction($method,$key) {
964964
}
965965

966966
protected function parseRequestParameter(&$request,$characters) {
967-
if (!$request) return false;
967+
if ($request==='') return false;
968968
$pos = strpos($request,'/');
969969
$value = $pos?substr($request,0,$pos):$request;
970970
$request = $pos?substr($request,$pos+1):'';
@@ -1131,7 +1131,7 @@ protected function findPrimaryKeys($table,$database) {
11311131
}
11321132

11331133
protected function processKeyParameter($key,$tables,$database) {
1134-
if (!$key) return false;
1134+
if ($key===false) return false;
11351135
$fields = $this->findPrimaryKeys($tables[0],$database);
11361136
if (count($fields)!=1) $this->exitWith404('1pk');
11371137
return array($key,$fields[0]);

0 commit comments

Comments
 (0)