Skip to content

Commit

Permalink
fix: Ws server should not send response data when returning null
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Sep 23, 2019
1 parent 2365442 commit d84d50a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion script/Command/GenVersion.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function __invoke(App $app): void
}

if ($this->updated > 0 && $app->getBoolOpt('c')) {
self::gitCommit('update: update the version to composer.json');
self::gitCommit("update: add {$this->version} for all component composer.json");
}

echo Color::render("Complete\n", 'cyan');
Expand Down
9 changes: 5 additions & 4 deletions src/bean/src/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -1048,13 +1048,14 @@ private function newProperty(
$propertyValue = $this->newPropertyArray($propertyValue, $id);
}

// Refer config or bean
if ($propertyInject->isRef()) {
$propertyValue = $this->getRefValue($propertyValue, $id);
}

// Optimize: Value not exists, skip call setter
if ($propertyValue === null) {
continue;
// Optimize: Value not exists, skip call setter
if ($propertyValue === null) {
continue;
}
}

// Parser property type
Expand Down
5 changes: 5 additions & 0 deletions src/websocket-server/src/Message/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@ public function send(Connection $conn = null): int
return 0;
}

// Fix: No response data
if ($this->content === '' && $this->data === null) {
return 0;
}

/** @noinspection CallableParameterUseCaseInTypeContextInspection */
$conn = $conn ?: Session::mustGet();
$server = $conn->getServer();
Expand Down

0 comments on commit d84d50a

Please sign in to comment.