@@ -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 @@ protected function mapMethodToAction($method,$key) {
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 @@ protected function findPrimaryKeys($table,$database) {
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 ]);
0 commit comments