Skip to content

Commit ed341bf

Browse files
支付宝库包问题:PHP 7.2 Deprecated: The each() function is deprecated 修复
1 parent 8b9d331 commit ed341bf

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

lib/alipay/aop/AopClient.php

+12-7
Original file line numberDiff line numberDiff line change
@@ -410,13 +410,18 @@ public function pageExecute($request,$httpmethod = "POST") {
410410
protected function buildRequestForm($para_temp) {
411411

412412
$sHtml = "<form id='alipaysubmit' name='alipaysubmit' action='".$this->gatewayUrl."?charset=".trim($this->postCharset)."' method='POST'>";
413-
while (list ($key, $val) = each ($para_temp)) {
414-
if (false === $this->checkEmpty($val)) {
415-
//$val = $this->characet($val, $this->postCharset);
416-
$val = str_replace("'","&apos;",$val);
417-
//$val = str_replace("\"","&quot;",$val);
418-
$sHtml.= "<input type='hidden' name='".$key."' value='".$val."'/>";
419-
}
413+
// while (list ($key, $val) = each ($para_temp)) {
414+
// 更改原因:PHP 7.2 Deprecated: The each() function is deprecated
415+
// https://github.com/sebastianbergmann/phpunit/issues/2887
416+
if (is_array($para_temp) && !empty($para_temp)){
417+
foreach($para_temp as $key => $val){
418+
if (false === $this->checkEmpty($val)) {
419+
//$val = $this->characet($val, $this->postCharset);
420+
$val = str_replace("'","&apos;",$val);
421+
//$val = str_replace("\"","&quot;",$val);
422+
$sHtml.= "<input type='hidden' name='".$key."' value='".$val."'/>";
423+
}
424+
}
420425
}
421426

422427
//submit按钮控件请不要含有name属性

0 commit comments

Comments
 (0)