fix stack

This commit is contained in:
joyqi 2021-08-18 22:55:32 +08:00
parent 3d0b5d5f6c
commit 4b97110087
3 changed files with 11 additions and 10 deletions

View File

@ -239,12 +239,12 @@ class Typecho_Validate
* @access public
*
* @param string $key 数值键值
* @param string $rule 规则名称
* @param string|array $rule 规则名称
* @param string $message 错误字符串
*
* @return $this
*/
public function addRule(string $key, string $rule, string $message): Typecho_Validate
public function addRule(string $key, $rule, string $message): Typecho_Validate
{
if (func_num_args() <= 3) {
$this->_rules[$key][] = [$rule, $message];

View File

@ -255,10 +255,14 @@ abstract class Typecho_Widget
*/
public function next()
{
if ($this->sequence < count($this->stack)) {
$this->row = $this->stack[$this->sequence];
$key = key($this->stack);
if ($key !== null && isset($this->stack[$key])) {
$this->row = current($this->stack);
next($this->stack);
$this->sequence ++;
} else {
reset($this->stack);
$this->sequence = 0;
return false;
}

View File

@ -70,14 +70,11 @@ class Widget_Comments_Archive extends Widget_Abstract_Comments
/**
* 输出文章评论数
*
* @access public
* @param string $string 评论数格式化数据
* @return void
* @param ...$args
*/
public function num()
public function num(...$args)
{
$args = func_get_args();
if (!$args) {
if (empty($args)) {
$args[] = '%d';
}