From eeb3fa5e1a49d0d76ba74b356c2cffd2402a6b4c Mon Sep 17 00:00:00 2001 From: Timm Friebe Date: Sat, 10 Jun 2017 18:12:14 +0200 Subject: [PATCH] Work around bug with anonymous classes and static methods in HHVM See facebook/hhvm#7878 --- src/main/php/io/streams/Streams.class.php | 2 +- src/main/php/lang/CommandLine.class.php | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/php/io/streams/Streams.class.php b/src/main/php/io/streams/Streams.class.php index 18eb641776..89524eeb9d 100755 --- a/src/main/php/io/streams/Streams.class.php +++ b/src/main/php/io/streams/Streams.class.php @@ -61,7 +61,7 @@ public function stream_read($count) { } public function stream_flush() { - return self::$streams[$this->id]->flush(); + return parent::$streams[$this->id]->flush(); } public function stream_eof() { diff --git a/src/main/php/lang/CommandLine.class.php b/src/main/php/lang/CommandLine.class.php index c6e5c56943..c2cceeba8e 100755 --- a/src/main/php/lang/CommandLine.class.php +++ b/src/main/php/lang/CommandLine.class.php @@ -65,16 +65,16 @@ public function parse($cmd) { return $parts; } - protected static function quote($arg) { + protected function quote($arg) { $l= strlen($arg); if ($l && strcspn($arg, '" ') >= $l) return $arg; return '"'.str_replace('"', '"""', $arg).'"'; } public function compose($command, $arguments= []) { - $cmd= self::quote($command); + $cmd= $this->quote($command); foreach ($arguments as $arg) { - $cmd.= " ".self::quote($arg); + $cmd.= ' '.$this->quote($arg); } return $cmd; } @@ -107,16 +107,16 @@ public function parse($cmd) { return $parts; } - protected static function quote($arg) { + protected function quote($arg) { $l= strlen($arg); if ($l && strcspn($arg, "&;`\'\"|*?~<>^()[]{}\$ ") >= $l) return $arg; return "'".str_replace("'", "'\\''", $arg)."'"; } public function compose($command, $arguments= []) { - $cmd= self::quote($command); + $cmd= $this->quote($command); foreach ($arguments as $arg) { - $cmd.= ' '.self::quote($arg); + $cmd.= ' '.$this->quote($arg); } return $cmd; }