@@ -13,11 +13,11 @@ |
||
| 13 | 13 | |
| 14 | 14 | if(!$at || empty($at->openid)){ |
| 15 | 15 | die('授权失败'); |
| 16 | - }else{ |
|
| 16 | + } else{ |
|
| 17 | 17 | $accesstoken = $at->access_token; |
| 18 | 18 | $openid = $at->openid; |
| 19 | 19 | header('Location: '."http://{$_SERVER['HTTP_HOST']}/wechat-pay/demo/pay.php?openid=$openid"); |
| 20 | 20 | } |
| 21 | -}else{ |
|
| 21 | +} else{ |
|
| 22 | 22 | die('授权失败,请重试。'); |
| 23 | 23 | } |
| 24 | 24 | \ No newline at end of file |
@@ -3,7 +3,7 @@ |
||
| 3 | 3 | if(file_exists(__DIR__ . '/../vendor/autoload.php')){ |
| 4 | 4 | /** @var \Composer\Autoload\ClassLoader $loader */ |
| 5 | 5 | $loader = require __DIR__ . '/../vendor/autoload.php'; |
| 6 | -}else{//if the composer is not initialized, note: this is not work in phpunit, switch to composer when unit testing |
|
| 6 | +} else{//if the composer is not initialized, note: this is not work in phpunit, switch to composer when unit testing |
|
| 7 | 7 | function __autoload($class) { |
| 8 | 8 | $class = str_replace('zhangv\\wechat\\', 'src/', $class); |
| 9 | 9 | $file = __DIR__ . '/../' . $class . '.php'; |
@@ -28,8 +28,12 @@ discard block |
||
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | public function get($url,$params = array(),$headers = array(),$opts = array()) { |
| 31 | - if (!$this->instance) $this->initInstance($this->timeout); |
|
| 32 | - if($params && count($params) > 0) $url .= '?' . http_build_query($params); |
|
| 31 | + if (!$this->instance) { |
|
| 32 | + $this->initInstance($this->timeout); |
|
| 33 | + } |
|
| 34 | + if($params && count($params) > 0) { |
|
| 35 | + $url .= '?' . http_build_query($params); |
|
| 36 | + } |
|
| 33 | 37 | curl_setopt($this->instance, CURLOPT_URL, $url); |
| 34 | 38 | curl_setopt($this->instance, CURLOPT_HTTPGET, true); |
| 35 | 39 | curl_setopt($this->instance, CURLOPT_HTTPHEADER, $headers); |
@@ -41,7 +45,9 @@ discard block |
||
| 41 | 45 | } |
| 42 | 46 | |
| 43 | 47 | public function post($url, $params = array(),$headers = array(),$opts = array()) { |
| 44 | - if (!$this->instance) $this->initInstance($this->timeout); |
|
| 48 | + if (!$this->instance) { |
|
| 49 | + $this->initInstance($this->timeout); |
|
| 50 | + } |
|
| 45 | 51 | curl_setopt($this->instance, CURLOPT_URL, $url); |
| 46 | 52 | curl_setopt($this->instance, CURLOPT_POST, true); |
| 47 | 53 | curl_setopt($this->instance, CURLOPT_POSTFIELDS, $params); |
@@ -8,8 +8,11 @@ discard block |
||
| 8 | 8 | private $cacheDir = null; |
| 9 | 9 | |
| 10 | 10 | public function __construct($cacheDir = null){ |
| 11 | - if(!$cacheDir) $this->cacheDir = __DIR__; |
|
| 12 | - else $this->cacheDir = $cacheDir; |
|
| 11 | + if(!$cacheDir) { |
|
| 12 | + $this->cacheDir = __DIR__; |
|
| 13 | + } else { |
|
| 14 | + $this->cacheDir = $cacheDir; |
|
| 15 | + } |
|
| 13 | 16 | } |
| 14 | 17 | |
| 15 | 18 | public function set($key,$jsonobj,$expireAt = null){ |
@@ -18,7 +21,9 @@ discard block |
||
| 18 | 21 | $file = "{$this->cacheDir}/{$key}.json"; |
| 19 | 22 | $fp = fopen($file, "w"); |
| 20 | 23 | fwrite($fp, json_encode($data)); |
| 21 | - if ($fp) fclose($fp); |
|
| 24 | + if ($fp) { |
|
| 25 | + fclose($fp); |
|
| 26 | + } |
|
| 22 | 27 | } |
| 23 | 28 | |
| 24 | 29 | public function get($key){ |
@@ -66,7 +66,9 @@ discard block |
||
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | public function getTicket($type = WechatOAuth::TICKETTYPE_JSAPI, $accessToken = null){ |
| 69 | - if(!$accessToken) $accessToken = $this->getAccessToken(); |
|
| 69 | + if(!$accessToken) { |
|
| 70 | + $accessToken = $this->getAccessToken(); |
|
| 71 | + } |
|
| 70 | 72 | // $url = "https://qyapi.weixin.qq.com/cgi-bin/get_jsapi_ticket?access_token=$accessToken"; |
| 71 | 73 | $url = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?type={$type}&access_token=$accessToken"; |
| 72 | 74 | $this->responseJSON = $this->httpClient->get($url); |
@@ -85,7 +87,9 @@ discard block |
||
| 85 | 87 | (!empty($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == 443)) ? "https://" : "http://"; |
| 86 | 88 | $url .= "{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"; |
| 87 | 89 | } |
| 88 | - if(!$ticket) $ticket = $this->getTicket(); |
|
| 90 | + if(!$ticket) { |
|
| 91 | + $ticket = $this->getTicket(); |
|
| 92 | + } |
|
| 89 | 93 | $timestamp = time(); |
| 90 | 94 | $nonceStr = $this->getNonceStr(); |
| 91 | 95 | $rawString = "jsapi_ticket=$ticket&noncestr=$nonceStr×tamp=$timestamp&url=$url"; |
@@ -141,7 +141,9 @@ discard block |
||
| 141 | 141 | $data["spbill_create_ip"] = $spbill_create_ip?:$_SERVER["REMOTE_ADDR"]; |
| 142 | 142 | $data["notify_url"] = $this->config["notify_url"]; |
| 143 | 143 | $data["trade_type"] = WechatPay::TRADETYPE_JSAPI; |
| 144 | - if(!$openid) throw new Exception('openid is required when trade_type is JSAPI'); |
|
| 144 | + if(!$openid) { |
|
| 145 | + throw new Exception('openid is required when trade_type is JSAPI'); |
|
| 146 | + } |
|
| 145 | 147 | $data["openid"] = $openid; |
| 146 | 148 | $result = $this->unifiedOrder($data); |
| 147 | 149 | return $result["prepay_id"]; |
@@ -189,7 +191,9 @@ discard block |
||
| 189 | 191 | $data["spbill_create_ip"] = $spbill_create_ip?:$_SERVER["SERVER_ADDR"]; |
| 190 | 192 | $data["notify_url"] = $this->config["notify_url"]; |
| 191 | 193 | $data["trade_type"] = self::TRADETYPE_NATIVE; |
| 192 | - if(!$product_id) throw new Exception('product_id is required when trade_type is NATIVE'); |
|
| 194 | + if(!$product_id) { |
|
| 195 | + throw new Exception('product_id is required when trade_type is NATIVE'); |
|
| 196 | + } |
|
| 193 | 197 | $data["product_id"] = $product_id; |
| 194 | 198 | $result = $this->unifiedOrder($data); |
| 195 | 199 | return $result["code_url"]; |
@@ -213,7 +217,9 @@ discard block |
||
| 213 | 217 | $data["spbill_create_ip"] = isset($_SERVER["REMOTE_ADDR"])?$_SERVER["REMOTE_ADDR"]:''; |
| 214 | 218 | $data["notify_url"] = $this->config["notify_url"]; |
| 215 | 219 | $data["trade_type"] = self::TRADETYPE_MWEB; |
| 216 | - if(!isset($this->config['h5_scene_info'])) throw new Exception('h5_scene_info should be configured'); |
|
| 220 | + if(!isset($this->config['h5_scene_info'])) { |
|
| 221 | + throw new Exception('h5_scene_info should be configured'); |
|
| 222 | + } |
|
| 217 | 223 | $data["scene_info"] = json_encode($this->config['h5_scene_info']); |
| 218 | 224 | $result = $this->unifiedOrder($data); |
| 219 | 225 | return $result["mweb_url"]; |
@@ -243,11 +249,15 @@ discard block |
||
| 243 | 249 | $data["notify_url"] = $this->config["notify_url"]; |
| 244 | 250 | $data["trade_type"] = $params['trade_type']; |
| 245 | 251 | if($params['trade_type'] == WechatPay::TRADETYPE_NATIVE){ |
| 246 | - if(!isset($params['product_id'])) throw new Exception('product_id is required when trade_type is NATIVE'); |
|
| 252 | + if(!isset($params['product_id'])) { |
|
| 253 | + throw new Exception('product_id is required when trade_type is NATIVE'); |
|
| 254 | + } |
|
| 247 | 255 | $data["product_id"] = $params['product_id']; |
| 248 | 256 | } |
| 249 | 257 | if($params['trade_type'] == WechatPay::TRADETYPE_JSAPI){ |
| 250 | - if(!isset($params['openid'])) throw new Exception('openid is required when trade_type is JSAPI'); |
|
| 258 | + if(!isset($params['openid'])) { |
|
| 259 | + throw new Exception('openid is required when trade_type is JSAPI'); |
|
| 260 | + } |
|
| 251 | 261 | $data["openid"] = $params['openid']; |
| 252 | 262 | } |
| 253 | 263 | $result = $this->post(self::URL_UNIFIEDORDER, $data); |
@@ -490,7 +500,9 @@ discard block |
||
| 490 | 500 | $data["send_name"] = $send_name; |
| 491 | 501 | $data["re_openid"] = $re_openid; |
| 492 | 502 | $data["total_amount"] = $total_amount; |
| 493 | - if($total_amount > 20000 && trim($scene_id)=='') throw new Exception("scene_id is required when total_amount beyond 20000"); |
|
| 503 | + if($total_amount > 20000 && trim($scene_id)=='') { |
|
| 504 | + throw new Exception("scene_id is required when total_amount beyond 20000"); |
|
| 505 | + } |
|
| 494 | 506 | $data["total_num"] = $total_num; |
| 495 | 507 | $data["wishing"] = $wishing; |
| 496 | 508 | $data["act_name"] = $act_name; |
@@ -526,7 +538,9 @@ discard block |
||
| 526 | 538 | $data["send_name"] = $send_name; |
| 527 | 539 | $data["re_openid"] = $re_openid; |
| 528 | 540 | $data["total_amount"] = $total_amount; |
| 529 | - if($total_amount > 20000 && trim($scene_id)=='') throw new Exception("scene_id is required when total_amount beyond 20000(200rmb)"); |
|
| 541 | + if($total_amount > 20000 && trim($scene_id)=='') { |
|
| 542 | + throw new Exception("scene_id is required when total_amount beyond 20000(200rmb)"); |
|
| 543 | + } |
|
| 530 | 544 | $data["total_num"] = $total_num; |
| 531 | 545 | $data["amt_type"] = 'ALL_RAND'; //红包金额设置方式 ALL_RAND—全部随机 |
| 532 | 546 | $data["wishing"] = $wishing; |
@@ -634,8 +648,12 @@ discard block |
||
| 634 | 648 | * @throws Exception |
| 635 | 649 | */ |
| 636 | 650 | public function onPaidNotify($notify_data,callable $callback = null){ |
| 637 | - if(!is_array($notify_data)) $notify_data = $this->xml2array($notify_data); |
|
| 638 | - if(!$this->validateSign($notify_data)) throw new Exception('Invalid paid notify data'); |
|
| 651 | + if(!is_array($notify_data)) { |
|
| 652 | + $notify_data = $this->xml2array($notify_data); |
|
| 653 | + } |
|
| 654 | + if(!$this->validateSign($notify_data)) { |
|
| 655 | + throw new Exception('Invalid paid notify data'); |
|
| 656 | + } |
|
| 639 | 657 | if($callback && is_callable($callback)){ |
| 640 | 658 | return call_user_func_array( $callback , [$notify_data] ); |
| 641 | 659 | } |
@@ -649,8 +667,12 @@ discard block |
||
| 649 | 667 | * @throws Exception |
| 650 | 668 | */ |
| 651 | 669 | public function onRefundedNotify($notify_data,callable $callback = null){ |
| 652 | - if(!is_array($notify_data)) $notify_data = $this->xml2array($notify_data); |
|
| 653 | - if(!$this->validateSign($notify_data)) throw new Exception('Invalid refund notify data'); |
|
| 670 | + if(!is_array($notify_data)) { |
|
| 671 | + $notify_data = $this->xml2array($notify_data); |
|
| 672 | + } |
|
| 673 | + if(!$this->validateSign($notify_data)) { |
|
| 674 | + throw new Exception('Invalid refund notify data'); |
|
| 675 | + } |
|
| 654 | 676 | if($callback && is_callable($callback)){ |
| 655 | 677 | return call_user_func_array( $callback ,[$notify_data] ); |
| 656 | 678 | } |
@@ -684,8 +706,11 @@ discard block |
||
| 684 | 706 | $data["return_msg"] = $return_msg; |
| 685 | 707 | } |
| 686 | 708 | $xml = $this->array2xml($data); |
| 687 | - if($print === true) print $xml; |
|
| 688 | - else return $xml; |
|
| 709 | + if($print === true) { |
|
| 710 | + print $xml; |
|
| 711 | + } else { |
|
| 712 | + return $xml; |
|
| 713 | + } |
|
| 689 | 714 | } |
| 690 | 715 | |
| 691 | 716 | /** |
@@ -713,12 +738,24 @@ discard block |
||
| 713 | 738 | $data["return_code"] = $return_code; |
| 714 | 739 | $data["result_code"] = $result_code; |
| 715 | 740 | $data["user_ip"] = $user_ip; |
| 716 | - if($out_trade_no) $data["out_trade_no"] = $out_trade_no; |
|
| 717 | - if($time) $data["time"] = $time; |
|
| 718 | - if($device_info) $data["device_info"] = $device_info; |
|
| 719 | - if($return_msg) $data["return_msg"] = $return_msg; |
|
| 720 | - if($err_code) $data["err_code"] = $err_code; |
|
| 721 | - if($err_code_des) $data["err_code_des"] = $err_code_des; |
|
| 741 | + if($out_trade_no) { |
|
| 742 | + $data["out_trade_no"] = $out_trade_no; |
|
| 743 | + } |
|
| 744 | + if($time) { |
|
| 745 | + $data["time"] = $time; |
|
| 746 | + } |
|
| 747 | + if($device_info) { |
|
| 748 | + $data["device_info"] = $device_info; |
|
| 749 | + } |
|
| 750 | + if($return_msg) { |
|
| 751 | + $data["return_msg"] = $return_msg; |
|
| 752 | + } |
|
| 753 | + if($err_code) { |
|
| 754 | + $data["err_code"] = $err_code; |
|
| 755 | + } |
|
| 756 | + if($err_code_des) { |
|
| 757 | + $data["err_code_des"] = $err_code_des; |
|
| 758 | + } |
|
| 722 | 759 | $result = $this->post(self::URL_REPORT, $data, false); |
| 723 | 760 | return $result; |
| 724 | 761 | } |
@@ -766,7 +803,9 @@ discard block |
||
| 766 | 803 | */ |
| 767 | 804 | public function transferWallet($partner_trade_no,$openid,$amount,$desc,$spbill_create_ip = null,$re_user_name = null,$check_name = WechatPay::CHECKNAME_FORCECHECK){ |
| 768 | 805 | $data = array(); |
| 769 | - if($check_name == WechatPay::CHECKNAME_FORCECHECK && !$re_user_name) throw new Exception('Real name is required'); |
|
| 806 | + if($check_name == WechatPay::CHECKNAME_FORCECHECK && !$re_user_name) { |
|
| 807 | + throw new Exception('Real name is required'); |
|
| 808 | + } |
|
| 770 | 809 | $data["mch_appid"] = $this->config["app_id"]; |
| 771 | 810 | $data["mchid"] = $this->config["mch_id"]; |
| 772 | 811 | $data["partner_trade_no"] = $partner_trade_no; |
@@ -808,7 +847,9 @@ discard block |
||
| 808 | 847 | * @throws Exception |
| 809 | 848 | */ |
| 810 | 849 | public function transferBankCard($partner_trade_no,$bank_no,$true_name,$bank_code,$amount,$desc){ |
| 811 | - if(!in_array($bank_code,array_values(self::$BANKCODE))) throw new Exception("Unsupported bank code: $bank_code"); |
|
| 850 | + if(!in_array($bank_code,array_values(self::$BANKCODE))) { |
|
| 851 | + throw new Exception("Unsupported bank code: $bank_code"); |
|
| 852 | + } |
|
| 812 | 853 | $data = array(); |
| 813 | 854 | $data["partner_trade_no"] = $partner_trade_no; |
| 814 | 855 | $enc_bank_no = $this->rsaEncrypt($bank_no); |
@@ -904,7 +945,7 @@ discard block |
||
| 904 | 945 | if(!$this->publicKey) { |
| 905 | 946 | if (!$refresh && file_exists($this->config["rsa_pubkey_path"])) { |
| 906 | 947 | $this->publicKey = file_get_contents($this->config["rsa_pubkey_path"]); |
| 907 | - }else{ |
|
| 948 | + } else{ |
|
| 908 | 949 | $data = array(); |
| 909 | 950 | $data["mch_id"] = $this->config["mch_id"]; |
| 910 | 951 | $data["sign_type"] = $this->config["sign_type"]; |
@@ -933,13 +974,16 @@ discard block |
||
| 933 | 974 | } |
| 934 | 975 | |
| 935 | 976 | public function rsaEncrypt($data,$pubkey = null){ |
| 936 | - if(!$pubkey) $pubkey = $this->getPublicKey(); |
|
| 977 | + if(!$pubkey) { |
|
| 978 | + $pubkey = $this->getPublicKey(); |
|
| 979 | + } |
|
| 937 | 980 | $encrypted = null; |
| 938 | 981 | $pubkey = openssl_get_publickey($pubkey); |
| 939 | - if (@openssl_public_encrypt($data, $encrypted, $pubkey,OPENSSL_PKCS1_OAEP_PADDING)) |
|
| 940 | - $data = base64_encode($encrypted); |
|
| 941 | - else |
|
| 942 | - throw new Exception('Unable to encrypt data'); |
|
| 982 | + if (@openssl_public_encrypt($data, $encrypted, $pubkey,OPENSSL_PKCS1_OAEP_PADDING)) { |
|
| 983 | + $data = base64_encode($encrypted); |
|
| 984 | + } else { |
|
| 985 | + throw new Exception('Unable to encrypt data'); |
|
| 986 | + } |
|
| 943 | 987 | return $data; |
| 944 | 988 | } |
| 945 | 989 | |
@@ -962,7 +1006,9 @@ discard block |
||
| 962 | 1006 | * @return array |
| 963 | 1007 | */ |
| 964 | 1008 | public function getSignPackage($url, $ticket = null){ |
| 965 | - if(!$ticket) $ticket = $this->getTicket(); |
|
| 1009 | + if(!$ticket) { |
|
| 1010 | + $ticket = $this->getTicket(); |
|
| 1011 | + } |
|
| 966 | 1012 | $timestamp = time(); |
| 967 | 1013 | $nonceStr = $this->getNonceStr(); |
| 968 | 1014 | $rawString = "jsapi_ticket=$ticket&noncestr=$nonceStr×tamp=$timestamp&url=$url"; |
@@ -1004,9 +1050,15 @@ discard block |
||
| 1004 | 1050 | } |
| 1005 | 1051 | |
| 1006 | 1052 | private function post($url, $data,$cert = true) { |
| 1007 | - if(!isset($data['mch_id']) && !isset($data['mchid'])) $data["mch_id"] = $this->config["mch_id"]; |
|
| 1008 | - if(!isset($data['nonce_str'])) $data["nonce_str"] = $this->getNonceStr(); |
|
| 1009 | - if(!isset($data['sign'])) $data['sign'] = $this->sign($data); |
|
| 1053 | + if(!isset($data['mch_id']) && !isset($data['mchid'])) { |
|
| 1054 | + $data["mch_id"] = $this->config["mch_id"]; |
|
| 1055 | + } |
|
| 1056 | + if(!isset($data['nonce_str'])) { |
|
| 1057 | + $data["nonce_str"] = $this->getNonceStr(); |
|
| 1058 | + } |
|
| 1059 | + if(!isset($data['sign'])) { |
|
| 1060 | + $data['sign'] = $this->sign($data); |
|
| 1061 | + } |
|
| 1010 | 1062 | $this->requestXML = $this->responseXML = null; |
| 1011 | 1063 | $this->requestArray = $this->responseArray = null; |
| 1012 | 1064 | |
@@ -1034,12 +1086,16 @@ discard block |
||
| 1034 | 1086 | $url = "{$host}/sandboxnew{$url}"; |
| 1035 | 1087 | } |
| 1036 | 1088 | $content = $this->httpClient->post($url,$this->requestXML,[],$opts); |
| 1037 | - if(!$content) throw new Exception("Empty response with {$this->requestXML}"); |
|
| 1089 | + if(!$content) { |
|
| 1090 | + throw new Exception("Empty response with {$this->requestXML}"); |
|
| 1091 | + } |
|
| 1038 | 1092 | |
| 1039 | 1093 | $this->responseXML = $content; |
| 1040 | - if($processResponse) |
|
| 1041 | - return $this->processResponseXML($this->responseXML); |
|
| 1042 | - else return $this->responseXML; |
|
| 1094 | + if($processResponse) { |
|
| 1095 | + return $this->processResponseXML($this->responseXML); |
|
| 1096 | + } else { |
|
| 1097 | + return $this->responseXML; |
|
| 1098 | + } |
|
| 1043 | 1099 | |
| 1044 | 1100 | } |
| 1045 | 1101 | |
@@ -1063,7 +1119,7 @@ discard block |
||
| 1063 | 1119 | $this->errCode = $result['err_code']; |
| 1064 | 1120 | $this->errCodeDes = $result['err_code_des']; |
| 1065 | 1121 | throw new Exception("[$this->errCode]$this->errCodeDes"); |
| 1066 | - }else{ |
|
| 1122 | + } else{ |
|
| 1067 | 1123 | return $result; |
| 1068 | 1124 | } |
| 1069 | 1125 | } else if($this->returnCode == 'FAIL'){ |
@@ -1082,17 +1138,20 @@ discard block |
||
| 1082 | 1138 | $stringSignTemp = $string1 . "key=" . $this->config["api_key"]; |
| 1083 | 1139 | if($sign_type == WechatPay::SIGNTYPE_MD5){ |
| 1084 | 1140 | $sign = strtoupper(md5($stringSignTemp)); |
| 1085 | - }elseif($sign_type == WechatPay::SIGNTYPE_HMACSHA256){ |
|
| 1141 | + } elseif($sign_type == WechatPay::SIGNTYPE_HMACSHA256){ |
|
| 1086 | 1142 | $sign = strtoupper(hash_hmac('sha256',$stringSignTemp,$this->config["api_key"])); |
| 1087 | - }else throw new Exception("Not supported sign type - $sign_type"); |
|
| 1143 | + } else { |
|
| 1144 | + throw new Exception("Not supported sign type - $sign_type"); |
|
| 1145 | + } |
|
| 1088 | 1146 | return $sign; |
| 1089 | 1147 | } |
| 1090 | 1148 | |
| 1091 | 1149 | private function array2xml($array) { |
| 1092 | 1150 | $xml = "<xml>" . PHP_EOL; |
| 1093 | 1151 | foreach ($array as $k => $v) { |
| 1094 | - if($v && trim($v)!='') |
|
| 1095 | - $xml .= "<$k><![CDATA[$v]]></$k>" . PHP_EOL; |
|
| 1152 | + if($v && trim($v)!='') { |
|
| 1153 | + $xml .= "<$k><![CDATA[$v]]></$k>" . PHP_EOL; |
|
| 1154 | + } |
|
| 1096 | 1155 | } |
| 1097 | 1156 | $xml .= "</xml>"; |
| 1098 | 1157 | return $xml; |
@@ -1103,7 +1162,7 @@ discard block |
||
| 1103 | 1162 | $tmp = null; |
| 1104 | 1163 | try{ |
| 1105 | 1164 | $tmp = (array) simplexml_load_string($xml); |
| 1106 | - }catch(Exception $e){ |
|
| 1165 | + } catch(Exception $e){ |
|
| 1107 | 1166 | throw $e; |
| 1108 | 1167 | } |
| 1109 | 1168 | foreach ( $tmp as $k => $v) { |