Skip to content

Commit

Permalink
Found bugs in code
Browse files Browse the repository at this point in the history
  • Loading branch information
TheRolfFR committed Nov 21, 2023
1 parent f8d278c commit 56113be
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/php/classes/JSONDatabase.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ public function write_raw($content) {
// content must be objects
foreach ($content as $key => $item) {
// item must not be primitive
echo $item;

// we don't accept primitive keys as value
$item_type = gettype($item);
Expand Down Expand Up @@ -479,6 +478,9 @@ public function editField($editObj) {
// MANDATORY REFERENCE to edit directly: PHP 5+
private function __edit(&$obj, $editObj) {

if(!is_object($editObj))
return false;

// id required
if(!check($editObj['id']))
return false;
Expand Down
2 changes: 1 addition & 1 deletion tests/js-test.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1264,7 +1264,7 @@ describe("PUT operations", () => {
const incorrect_values = [undefined, null, false, 16, 0.5, "", "gg", [], {}];

incorrect_values.forEach((unco) => {
it(`${JSON.stringify(unco)} value rejects`, (done) => {
it(`'${JSON.stringify(unco)}' value rejects`, (done) => {
base
.editField(unco)
.then((res) => {
Expand Down

0 comments on commit 56113be

Please sign in to comment.