Skip to content
This repository has been archived by the owner on May 4, 2019. It is now read-only.

Commit

Permalink
Merge pull request #7 from marmelab/fix_missing_params
Browse files Browse the repository at this point in the history
[RFR] Fix missing params check
  • Loading branch information
RobinBressan committed Oct 6, 2014
2 parents ecc33a0 + c85d64c commit 860b1c3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/PHPCRAPI/Silex/Controller/NodeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ public function addNodePropertyAction(SessionManager $repository, $workspace, $p
$name = $request->request->get('name');
$value = $request->request->get('value');

if (!$name || !$value) {
if ($name === null || $value === null) {
$this->app->abort(400, 'Missing parameters');
}

$type = $request->request->get('type',null);
$type = $request->request->get('type', null);
$properties = $currentNode->getPropertiesAsArray();

if (array_key_exists($name, $properties) && is_array($properties[$name]['value'])) {
Expand Down Expand Up @@ -77,7 +77,7 @@ public function updateNodeAction(SessionManager $repository, $workspace, $path,

$currentNode = $repository->getNode($path);

if (!$method = $request->request->get('method')) {
if (($method = $request->request->get('method')) === null) {
$this->app->abort(400, 'Missing parameters');
}

Expand Down Expand Up @@ -131,7 +131,7 @@ public function addNodeAction(SessionManager $repository, $workspace, $path, Req

$currentNode = $repository->getNode($path);

if (!$relPath = $request->request->get('relPath')) {
if (($relPath = $request->request->get('relPath')) === null) {
$this->app->abort(400, 'Missing parameters');
}

Expand Down
2 changes: 1 addition & 1 deletion src/PHPCRAPI/Silex/Controller/WorkspaceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function getWorkspaceAction(SessionManager $repository, $workspace)

public function createWorkspaceAction(SessionManager $repository, Request $request)
{
if (!$name = $request->request->get('name')) {
if (($name = $request->request->get('name')) === null) {
$this->app->abort(400, 'Missing parameters');
}

Expand Down

0 comments on commit 860b1c3

Please sign in to comment.