Skip to content

Commit

Permalink
Merge pull request #960 from siteorigin/legacy-widgets-lessc-php-erro…
Browse files Browse the repository at this point in the history
…r-fix

Legacy Widgets: Resolve lessc.inc.php error
  • Loading branch information
Misplon authored Jan 3, 2022
2 parents ba6601c + 65caebb commit f0a80ec
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion widgets/lib/lessc.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -1646,6 +1646,9 @@ public function __construct($fname = null) {
public function compile($string, $name = null) {
$locale = setlocale(LC_NUMERIC, 0);
setlocale(LC_NUMERIC, "C");

// Account for import increasing the buffer length.
$this->count = strlen( $this->buffer );

$this->parser = $this->makeParser($name);
$root = $this->parser->parse($string);
Expand Down Expand Up @@ -3060,9 +3063,13 @@ protected function keyword(&$word) {

// consume an end of statement delimiter
protected function end() {
$adjustedEndCount = $this->count++;
if ($this->literal(';')) {
return true;
} elseif ($this->count == strlen($this->buffer) || $this->buffer($this->count) == '}') {
} elseif (
$this->count == strlen( $this->buffer ) ||
substr( $this->buffer, $adjustedEndCount, 1 ) == '}'
) {
// if there is end of file or a closing block next then we don't need a ;
return true;
}
Expand Down

0 comments on commit f0a80ec

Please sign in to comment.