@@ -1136,9 +1136,9 @@ protected function parseGetParameterArray($get,$name,$characters) {
1136
1136
1137
1137
protected function applyBeforeHandler (&$ action ,&$ database ,&$ table ,&$ ids ,&$ callback ,&$ inputs ) {
1138
1138
if (is_callable ($ callback ,true )) {
1139
- $ max = max ( count ($ ids ), count ($ inputs) );
1139
+ $ max = count ($ ids )?: count ($ inputs );
1140
1140
for ($ i =0 ;$ i <$ max ;$ i ++) {
1141
- $ id = isset ($ ids [$ i ])? $ ids [$ i ]: false ;
1141
+ if (! isset ($ ids [$ i ])) $ ids [$ i ] = false ;
1142
1142
if (!isset ($ inputs [$ i ])) $ inputs [$ i ] = false ;
1143
1143
$ callback ($ action ,$ database ,$ table ,$ id ,$ inputs [$ i ]);
1144
1144
}
@@ -1518,7 +1518,7 @@ protected function createObjects($inputs,$tables) {
1518
1518
}
1519
1519
1520
1520
protected function updateObject ($ key ,$ input ,$ filters ,$ tables ) {
1521
- if (!$ input ) return false ;
1521
+ if (!$ input ) return null ;
1522
1522
$ input = (array )$ input ;
1523
1523
$ table = $ tables [0 ];
1524
1524
$ sql = 'UPDATE ! SET ' ;
@@ -1538,10 +1538,10 @@ protected function updateObject($key,$input,$filters,$tables) {
1538
1538
}
1539
1539
1540
1540
protected function updateObjects ($ key ,$ inputs ,$ filters ,$ tables ) {
1541
- if (!$ inputs ) return false ;
1541
+ if (!$ inputs ) return null ;
1542
1542
$ keyField = $ key [1 ];
1543
1543
$ keys = $ key [0 ];
1544
- if (count ($ inputs )!=count ($ keys )) {
1544
+ if (count (array_filter ( $ inputs )) !=count (array_filter ( $ keys) )) {
1545
1545
$ this ->exitWith404 ('subject ' );
1546
1546
}
1547
1547
$ rows = array ();
@@ -1587,7 +1587,7 @@ protected function deleteObjects($key,$filters,$tables) {
1587
1587
}
1588
1588
1589
1589
protected function incrementObject ($ key ,$ input ,$ filters ,$ tables ,$ fields ) {
1590
- if (!$ input ) return false ;
1590
+ if (!$ input ) return null ;
1591
1591
$ input = (array )$ input ;
1592
1592
$ table = $ tables [0 ];
1593
1593
$ sql = 'UPDATE ! SET ' ;
@@ -1614,10 +1614,10 @@ protected function incrementObject($key,$input,$filters,$tables,$fields) {
1614
1614
}
1615
1615
1616
1616
protected function incrementObjects ($ key ,$ inputs ,$ filters ,$ tables ,$ fields ) {
1617
- if (!$ inputs ) return false ;
1617
+ if (!$ inputs ) return null ;
1618
1618
$ keyField = $ key [1 ];
1619
1619
$ keys = $ key [0 ];
1620
- if (count ($ inputs )!=count ($ keys )) {
1620
+ if (count (array_filter ( $ inputs )) !=count (array_filter ( $ keys) )) {
1621
1621
$ this ->exitWith404 ('subject ' );
1622
1622
}
1623
1623
$ rows = array ();
0 commit comments