Skip to content

Commit db15a07

Browse files
committed
Removed the exit statements from the "Server" class
1 parent 45ecc76 commit db15a07

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
66
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
77

8+
## [5.0.6] - 2020-03-03
9+
### Changed
10+
- Removed the exit statements from the "Server" class, so you can control the
11+
termination of your own scripts
12+
813
## [5.0.5] - 2020-02-28
914
### Changed
1015
- Updated the internal "datto/json-rpc" dependency

src/Server.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,14 @@ public function reply()
5555

5656
if (strncmp($contentType, self::$CONTENT_TYPE, strlen(self::$CONTENT_TYPE)) !== 0) {
5757
self::errorInvalidContentType();
58+
return;
5859
}
5960

6061
$message = @file_get_contents('php://input');
6162

6263
if ($message === false) {
6364
self::errorInvalidBody();
65+
return;
6466
}
6567

6668
$server = new JsonRpc\Server($this->evaluator);
@@ -69,6 +71,7 @@ public function reply()
6971

7072
if ($reply === null) {
7173
self::successNoContent();
74+
return;
7275
}
7376

7477
self::successContent($reply);
@@ -87,7 +90,6 @@ private static function errorInvalidBody()
8790
private static function successNoContent()
8891
{
8992
header('HTTP/1.1 204 No Content');
90-
exit();
9193
}
9294

9395
/**
@@ -101,8 +103,8 @@ private static function successContent($content)
101103
header('HTTP/1.1 200 OK');
102104
header('Content-Type: ' . self::$CONTENT_TYPE);
103105
header('Content-Length: ' . strlen($content));
106+
104107
echo $content;
105-
exit();
106108
}
107109

108110
/**
@@ -169,7 +171,5 @@ private static function error($code, $title, $description)
169171
170172
</html>
171173
EOS;
172-
173-
exit();
174174
}
175175
}

0 commit comments

Comments
 (0)