Skip to content

Commit

Permalink
3.7.3-Release
Browse files Browse the repository at this point in the history
  • Loading branch information
ikkez committed Dec 13, 2020
1 parent b51905e commit 62f40d8
Show file tree
Hide file tree
Showing 16 changed files with 176 additions and 118 deletions.
33 changes: 24 additions & 9 deletions lib/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,34 @@
CHANGELOG

3.7.3
* NEW: added auto_increment detection, [bcosca/fatfree#1192](https://github.com/bcosca/fatfree/issues/1192), [bcosca/fatfree#1093](https://github.com/bcosca/fatfree/issues/1093), [bcosca/fatfree#1175](https://github.com/bcosca/fatfree/issues/1175), [#290](https://github.com/bcosca/fatfree-core/issues/290)
* added SMTP dialog error handling, [#317](https://github.com/bcosca/fatfree-core/issues/317)
* Fix: Check active transaction before rollback/commit (PHP8 issue)
* refactored increment/decrement operator to preceed variables
* added error output in CLI mode, [bcosca/fatfree#1185](https://github.com/bcosca/fatfree/issues/1185)
* Set PORT to 80 when SERVER_PORT is an empty string
* Fix: unescape dbname when extracting from dsn, [#316](https://github.com/bcosca/fatfree-core/issues/316)
* Fix: handling of PDO prepare() errors
* Fix: edge case in DB\SQL->schema(): PK not detected in PgSQL when the column is also a FK [bcosca/fatfree#1207](https://github.com/bcosca/fatfree/issues/1207)
* Fix: Escape literal hyphens in regex character classes, [bcosca/fatfree#1206](https://github.com/bcosca/fatfree/issues/1206)
* Fix: error highlighting
* Fix: pagination with order by on virtual fields
* Fixed a couple PHPDOC issues

3.7.2 (28 May 2020)
* CHANGED, View->sandbox: disable escaping when rendering as text/plain, bcosca/fatfree#654
* update HTTP protocol checks, #bcosca/fatfree#1190
* Base->clear: close vulnerability on variable compilation, bcosca/fatfree#1191
* DB\SQL\Mapper: fix empty ID after insert, bcosca/fatfree#1175
* CHANGED, View->sandbox: disable escaping when rendering as text/plain, [bcosca/fatfree#654](https://github.com/bcosca/fatfree/issues/654)
* update HTTP protocol checks, [bcosca/fatfree#1190](https://github.com/bcosca/fatfree/issues/1190)
* Base->clear: close vulnerability on variable compilation, [bcosca/fatfree#1191](https://github.com/bcosca/fatfree/issues/1191)
* DB\SQL\Mapper: fix empty ID after insert, [bcosca/fatfree#1175](https://github.com/bcosca/fatfree/issues/1175)
* DB\SQL\Mapper: fix using correct key variable for grouped sql pagination sets
* Fix return type of 'count' in Cursor->paginate() (bcosca/fatfree#1187)
* Bug fix, Web->minify: fix minification of ES6 template literals, bcosca/fatfree#1178
* Bug fix, config: refactoring custom section parser regex, bcosca/fatfree#1149
* Bug fix: token resolve on non-alias reroute paths, ref. 221f0c930f8664565c9825faeb9ed9af0f7a01c8
* Fix return type of 'count' in Cursor->paginate(), [bcosca/fatfree#1187](https://github.com/bcosca/fatfree/issues/1187)
* Bug fix, Web->minify: fix minification of ES6 template literals, [bcosca/fatfree#1178](https://github.com/bcosca/fatfree/issues/1178)
* Bug fix, config: refactoring custom section parser regex, [bcosca/fatfree#1149](https://github.com/bcosca/fatfree/issues/1149)
* Bug fix: token resolve on non-alias reroute paths, [ref. 221f0c9](https://github.com/bcosca/fatfree-core/commit/221f0c930f8664565c9825faeb9ed9af0f7a01c8)
* Websocket: Improved event handler usage
* optimized internal get calls
* only use cached lexicon when a $ttl was given
* only use money_format up until php7.4, fixes bcosca/fatfree#1174
* only use money_format up until php7.4, [bcosca/fatfree#1174](https://github.com/bcosca/fatfree/issues/1174)

3.7.1 (30. December 2019)
* Base->build: Add support for brace-enclosed route tokens
Expand Down
2 changes: 1 addition & 1 deletion lib/audit.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ function mod10($id) {
return FALSE;
$id=strrev($id);
$sum=0;
for ($i=0,$l=strlen($id);$i<$l;$i++)
for ($i=0,$l=strlen($id);$i<$l;++$i)
$sum+=$id[$i]+$i%2*(($id[$i]>4)*-4+$id[$i]%5);
return !($sum%10);
}
Expand Down
85 changes: 45 additions & 40 deletions lib/base.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ final class Base extends Prefab implements ArrayAccess {
//@{ Framework details
const
PACKAGE='Fat-Free Framework',
VERSION='3.7.2-Release';
VERSION='3.7.3-Release';
//@}

//@{ HTTP status codes (RFC 2616)
Expand Down Expand Up @@ -186,7 +186,7 @@ function($match) use(&$i,$args) {
array_key_exists($match[3],$args)) {
if (!is_array($args[$match[3]]))
return $args[$match[3]];
$i++;
++$i;
return $args[$match[3]][$i-1];
}
return $match[0];
Expand Down Expand Up @@ -1293,10 +1293,10 @@ function trace(array $trace=NULL,$format=TRUE) {
function($frame) use($debug) {
return isset($frame['file']) &&
($debug>1 ||
($frame['file']!=__FILE__ || $debug) &&
(($frame['file']!=__FILE__ || $debug) &&
(empty($frame['function']) ||
!preg_match('/^(?:(?:trigger|user)_error|'.
'__call|call_user_func)/',$frame['function'])));
'__call|call_user_func)/',$frame['function']))));
}
);
if (!$format)
Expand Down Expand Up @@ -1349,8 +1349,8 @@ function error($code,$text='',array $trace=NULL,$level=0) {
error_log($nexus);
break;
}
if ($highlight=!$this->hive['CLI'] && !$this->hive['AJAX'] &&
$this->hive['HIGHLIGHT'] && is_file($css=__DIR__.'/'.self::CSS))
if ($highlight=(!$this->hive['CLI'] && !$this->hive['AJAX'] &&
$this->hive['HIGHLIGHT'] && is_file($css=__DIR__.'/'.self::CSS)))
$trace=$this->highlight($trace);
$this->hive['ERROR']=[
'status'=>$header,
Expand All @@ -1366,29 +1366,34 @@ function error($code,$text='',array $trace=NULL,$level=0) {
if ((!$handler ||
$this->call($handler,[$this,$this->hive['PARAMS']],
'beforeroute,afterroute')===FALSE) &&
!$prior && !$this->hive['CLI'] && !$this->hive['QUIET'])
echo $this->hive['AJAX']?
json_encode(
array_diff_key(
$this->hive['ERROR'],
$this->hive['DEBUG']?
[]:
['trace'=>1]
)
):
('<!DOCTYPE html>'.$eol.
'<html>'.$eol.
'<head>'.
'<title>'.$code.' '.$header.'</title>'.
($highlight?
('<style>'.$this->read($css).'</style>'):'').
'</head>'.$eol.
'<body>'.$eol.
'<h1>'.$header.'</h1>'.$eol.
'<p>'.$this->encode($text?:$req).'</p>'.$eol.
($this->hive['DEBUG']?('<pre>'.$trace.'</pre>'.$eol):'').
'</body>'.$eol.
'</html>');
!$prior && !$this->hive['QUIET']) {
$error=array_diff_key(
$this->hive['ERROR'],
$this->hive['DEBUG']?
[]:
['trace'=>1]
);
if ($this->hive['CLI'])
echo PHP_EOL.'==================================='.PHP_EOL.
'ERROR '.$error['code'].' - '.$error['status'].PHP_EOL.
$error['text'].PHP_EOL.PHP_EOL.$error['trace'];
else
echo $this->hive['AJAX']?
json_encode($error):
('<!DOCTYPE html>'.$eol.
'<html>'.$eol.
'<head>'.
'<title>'.$code.' '.$header.'</title>'.
($highlight?
('<style>'.$this->read($css).'</style>'):'').
'</head>'.$eol.
'<body>'.$eol.
'<h1>'.$header.'</h1>'.$eol.
'<p>'.$this->encode($text?:$req).'</p>'.$eol.
($this->hive['DEBUG']?('<pre>'.$trace.'</pre>'.$eol):'').
'</body>'.$eol.
'</html>');
}
if ($this->hive['HALT'])
die(1);
}
Expand Down Expand Up @@ -1615,7 +1620,7 @@ function mask($pattern,$url=NULL) {
$i=0;
while (is_int($pos=strpos($wild,'\*'))) {
$wild=substr_replace($wild,'(?P<_'.$i.'>[^\?]*)',$pos,2);
$i++;
++$i;
}
preg_match('/^'.
preg_replace(
Expand Down Expand Up @@ -1767,7 +1772,7 @@ function($id) use($args) {
$ctr=0;
foreach (str_split($body,1024) as $part) {
// Throttle output
$ctr++;
++$ctr;
if ($ctr/$kbps>($elapsed=microtime(TRUE)-$now) &&
!connection_aborted())
usleep(1e6*($ctr/$kbps-$elapsed));
Expand Down Expand Up @@ -2197,7 +2202,7 @@ protected function autoload($class) {
isset($path[1]) && is_callable($path[1]))
list($path,$func)=$path;
foreach ($this->split($this->hive['PLUGINS'].';'.$path) as $auto)
if ($func && is_file($file=$func($auto.$class).'.php') ||
if (($func && is_file($file=$func($auto.$class).'.php')) ||
is_file($file=$auto.$class.'.php') ||
is_file($file=$auto.strtolower($class).'.php') ||
is_file($file=strtolower($auto.$class).'.php'))
Expand Down Expand Up @@ -2345,11 +2350,11 @@ function($level,$text,$file,$line) {
if (!isset($_SERVER['SERVER_NAME']) || $_SERVER['SERVER_NAME']==='')
$_SERVER['SERVER_NAME']=gethostname();
$headers=[];
if ($cli=PHP_SAPI=='cli') {
if ($cli=(PHP_SAPI=='cli')) {
// Emulate HTTP request
$_SERVER['REQUEST_METHOD']='GET';
if (!isset($_SERVER['argv'][1])) {
$_SERVER['argc']++;
++$_SERVER['argc'];
$_SERVER['argv'][1]='/';
}
$req=$query='';
Expand Down Expand Up @@ -2433,9 +2438,9 @@ function($level,$text,$file,$line) {
'samesite'=>'Lax',
];
$port=80;
if (isset($headers['X-Forwarded-Port']))
if (!empty($headers['X-Forwarded-Port']))
$port=$headers['X-Forwarded-Port'];
elseif (isset($_SERVER['SERVER_PORT']))
elseif (!empty($_SERVER['SERVER_PORT']))
$port=$_SERVER['SERVER_PORT'];
// Default configuration
$this->hive+=[
Expand Down Expand Up @@ -2496,7 +2501,7 @@ function($level,$text,$file,$line) {
'QUIET'=>FALSE,
'RAW'=>FALSE,
'REALM'=>$scheme.'://'.$_SERVER['SERVER_NAME'].
($port && !in_array($port,[80,443])?(':'.$port):'').
(!in_array($port,[80,443])?(':'.$port):'').
$_SERVER['REQUEST_URI'],
'RESPONSE'=>'',
'ROOT'=>$_SERVER['DOCUMENT_ROOT'],
Expand Down Expand Up @@ -2740,7 +2745,7 @@ function reset($suffix=NULL) {
case 'xcache':
if ($suffix && !ini_get('xcache.admin.enable_auth')) {
$cnt=xcache_count(XC_TYPE_VAR);
for ($i=0;$i<$cnt;$i++) {
for ($i=0;$i<$cnt;++$i) {
$list=xcache_list(XC_TYPE_VAR,$i);
foreach ($list['cache_list'] as $item)
if (preg_match($regex,$item['name']))
Expand Down Expand Up @@ -2898,10 +2903,10 @@ protected function sandbox(array $hive=NULL,$mime=NULL) {
unset($fw,$hive,$implicit,$mime);
extract($this->temp);
$this->temp=NULL;
$this->level++;
++$this->level;
ob_start();
require($this->file);
$this->level--;
--$this->level;
return ob_get_clean();
}

Expand Down
4 changes: 2 additions & 2 deletions lib/bcrypt.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function hash($pw,$salt=NULL,$cost=self::COST) {
if (!$iv && extension_loaded('openssl'))
$iv=openssl_random_pseudo_bytes($raw);
if (!$iv)
for ($i=0;$i<$raw;$i++)
for ($i=0;$i<$raw;++$i)
$iv.=chr(mt_rand(0,255));
$salt=str_replace('+','.',base64_encode($iv));
}
Expand Down Expand Up @@ -88,7 +88,7 @@ function verify($pw,$hash) {
if ($len!=strlen($hash) || $len<14)
return FALSE;
$out=0;
for ($i=0;$i<$len;$i++)
for ($i=0;$i<$len;++$i)
$out|=(ord($val[$i])^ord($hash[$i]));
return $out===0;
}
Expand Down
6 changes: 3 additions & 3 deletions lib/cli/ws.php
Original file line number Diff line number Diff line change
Expand Up @@ -424,16 +424,16 @@ function fetch() {
}
else
if ($len==0x7f) {
for ($i=0,$len=0;$i<8;$i++)
for ($i=0,$len=0;$i<8;++$i)
$len=$len*256+ord($buf[$i+2]);
$pos+=8;
}
for ($i=0,$mask=[];$i<4;$i++)
for ($i=0,$mask=[];$i<4;++$i)
$mask[$i]=ord($buf[$pos+$i]);
$pos+=4;
if (strlen($buf)<$len+$pos)
return FALSE;
for ($i=0,$data='';$i<$len;$i++)
for ($i=0,$data='';$i<$len;++$i)
$data.=chr(ord($buf[$pos+$i])^$mask[$i%4]);
// Dispatch
switch ($op & WS::OpCode) {
Expand Down
2 changes: 1 addition & 1 deletion lib/db/jig/mapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ function($_row) use($fw,$args,$tokens) {
if (is_string($token))
if ($token=='?') {
// Positional
$ctr++;
++$ctr;
$key=$ctr;
}
else {
Expand Down
Loading

0 comments on commit 62f40d8

Please sign in to comment.