Skip to content

Commit

Permalink
Work around bug with anonymous classes and static methods in HHVM
Browse files Browse the repository at this point in the history
  • Loading branch information
thekid committed Jun 10, 2017
1 parent 1d06387 commit eeb3fa5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/main/php/io/streams/Streams.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
12 changes: 6 additions & 6 deletions src/main/php/lang/CommandLine.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit eeb3fa5

Please sign in to comment.