fix: guard match live validator scalars
This commit is contained in:
@@ -129,6 +129,9 @@ $validate = file_get_contents($validatePath);
|
|||||||
foreach ([
|
foreach ([
|
||||||
'checkTrimmedTitle',
|
'checkTrimmedTitle',
|
||||||
'checkTrimmedSourceUrl',
|
'checkTrimmedSourceUrl',
|
||||||
|
"!is_scalar(\$value)",
|
||||||
|
"return '直播标题格式错误';",
|
||||||
|
"return '源地址格式错误';",
|
||||||
'$value = trim((string) $value);',
|
'$value = trim((string) $value);',
|
||||||
] as $needle) {
|
] as $needle) {
|
||||||
if (strpos($validate, $needle) === false) {
|
if (strpos($validate, $needle) === false) {
|
||||||
|
|||||||
@@ -69,6 +69,9 @@ class MatchLiveValidate extends BaseValidate
|
|||||||
|
|
||||||
public function checkTrimmedTitle($value)
|
public function checkTrimmedTitle($value)
|
||||||
{
|
{
|
||||||
|
if (!is_scalar($value)) {
|
||||||
|
return '直播标题格式错误';
|
||||||
|
}
|
||||||
$value = trim((string) $value);
|
$value = trim((string) $value);
|
||||||
if ($value === '') {
|
if ($value === '') {
|
||||||
return '直播标题不能为空';
|
return '直播标题不能为空';
|
||||||
@@ -81,6 +84,9 @@ class MatchLiveValidate extends BaseValidate
|
|||||||
|
|
||||||
public function checkTrimmedSourceUrl($value)
|
public function checkTrimmedSourceUrl($value)
|
||||||
{
|
{
|
||||||
|
if (!is_scalar($value)) {
|
||||||
|
return '源地址格式错误';
|
||||||
|
}
|
||||||
$value = trim((string) $value);
|
$value = trim((string) $value);
|
||||||
if ($value === '') {
|
if ($value === '') {
|
||||||
return '源地址不能为空';
|
return '源地址不能为空';
|
||||||
|
|||||||
Reference in New Issue
Block a user