Browse Source

Thank you Joaquín!

Maurits van der Schee 7 years ago
parent
commit
e3d3c1a362
1 changed files with 3 additions and 3 deletions
  1. 3
    3
      api.php

+ 3
- 3
api.php View File

@@ -953,7 +953,7 @@ class PHP_CRUD_API {
953 953
 	protected function mapMethodToAction($method,$key) {
954 954
 		switch ($method) {
955 955
 			case 'OPTIONS': return 'headers';
956
-			case 'GET': return $key?'read':'list';
956
+			case 'GET': return ($key===false)?'list':'read';
957 957
 			case 'PUT': return 'update';
958 958
 			case 'POST': return 'create';
959 959
 			case 'DELETE': return 'delete';
@@ -964,7 +964,7 @@ class PHP_CRUD_API {
964 964
 	}
965 965
 
966 966
 	protected function parseRequestParameter(&$request,$characters) {
967
-		if (!$request) return false;
967
+		if ($request==='') return false;
968 968
 		$pos = strpos($request,'/');
969 969
 		$value = $pos?substr($request,0,$pos):$request;
970 970
 		$request = $pos?substr($request,$pos+1):'';
@@ -1131,7 +1131,7 @@ class PHP_CRUD_API {
1131 1131
 	}
1132 1132
 
1133 1133
 	protected function processKeyParameter($key,$tables,$database) {
1134
-		if (!$key) return false;
1134
+		if ($key===false) return false;
1135 1135
 		$fields = $this->findPrimaryKeys($tables[0],$database);
1136 1136
 		if (count($fields)!=1) $this->exitWith404('1pk');
1137 1137
 		return array($key,$fields[0]);

Loading…
Cancel
Save