git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@758526
13f79535-47bb-0310-9956-
ffa450edef68
public function open() {
if ($this->read_) {
- $this->inStream_ = @fopen('php://input', 'r');
+ $this->inStream_ = @fopen(self::inStreamName(), 'r');
if (!is_resource($this->inStream_)) {
throw new TException('TPhpStream: Could not open php://input');
}
@fflush($this->outStream_);
}
+ private static function inStreamName() {
+ if (php_sapi_name() == 'cli') {
+ return 'php://stdin';
+ }
+ return 'php://input';
+ }
+
}
?>