* Check compatibility.

This commit is contained in:
zhujinyong
2021-11-11 05:10:38 +08:00
parent 326a9f4ce1
commit f77b0e6d2d
3 changed files with 174 additions and 151 deletions
+28 -13
View File
@@ -495,7 +495,7 @@ class Snoopy
$frameurls = $this->_frameurls;
$this->_frameurls = array();
while(list(,$frameurl) = each($frameurls))
foreach($frameurls as $frameurl)
{
if($this->_framedepth < $this->maxframes)
{
@@ -503,7 +503,9 @@ class Snoopy
$this->_framedepth++;
}
else
{
break;
}
}
}
return true;
@@ -593,7 +595,7 @@ class Snoopy
$frameurls = $this->_frameurls;
$this->_frameurls = array();
while(list(,$frameurl) = each($frameurls))
foreach($frameurls as $frameurl)
{
if($this->_framedepth < $this->maxframes)
{
@@ -660,7 +662,7 @@ class Snoopy
$frameurls = $this->_frameurls;
$this->_frameurls = array();
while(list(,$frameurl) = each($frameurls))
foreach($frameurls as $frameurl)
{
if($this->_framedepth < $this->maxframes)
{
@@ -881,13 +883,13 @@ class Snoopy
// catenate the non-empty matches from the conditional subpattern
while(list($key,$val) = each($links[2]))
foreach($links[2] as $key => $val)
{
if(!empty($val))
$match[] = $val;
}
while(list($key,$val) = each($links[3]))
foreach($links[3] as $key => $val)
{
if(!empty($val))
$match[] = $val;
@@ -1072,9 +1074,13 @@ class Snoopy
if(!empty($this->rawheaders))
{
if(!is_array($this->rawheaders))
{
$this->rawheaders = (array)$this->rawheaders;
while(list($headerKey,$headerVal) = each($this->rawheaders))
}
foreach($this->rawheaders as $headerKey => $headerVal)
{
$headers .= $headerKey.": ".$headerVal."\r\n";
}
}
if(!empty($content_type)) {
$headers .= "Content-type: $content_type";
@@ -1236,9 +1242,13 @@ class Snoopy
if(!empty($this->rawheaders))
{
if(!is_array($this->rawheaders))
{
$this->rawheaders = (array)$this->rawheaders;
while(list($headerKey,$headerVal) = each($this->rawheaders))
}
foreach($this->rawheaders as $headerKey => $headerVal)
{
$headers[] = $headerKey.": ".$headerVal;
}
}
if(!empty($content_type)) {
if ($content_type == "multipart/form-data")
@@ -1453,13 +1463,17 @@ class Snoopy
switch ($this->_submit_type) {
case "application/x-www-form-urlencoded":
reset($formvars);
while(list($key,$val) = each($formvars)) {
foreach($formvars as $key => $val)
{
if (is_array($val) || is_object($val)) {
while (list($cur_key, $cur_val) = each($val)) {
foreach($val as $cur_key => $cur_val)
{
$postdata .= urlencode($key)."[]=".urlencode($cur_val)."&";
}
} else
{
$postdata .= urlencode($key)."=".urlencode($val)."&";
}
}
break;
@@ -1467,9 +1481,10 @@ class Snoopy
$this->_mime_boundary = "Snoopy".md5(uniqid(microtime()));
reset($formvars);
while(list($key,$val) = each($formvars)) {
foreach($formvars as $key => $val)
{
if (is_array($val) || is_object($val)) {
while (list($cur_key, $cur_val) = each($val)) {
foreach($val as $cur_key => $cur_val) {
$postdata .= "--".$this->_mime_boundary."\r\n";
$postdata .= "Content-Disposition: form-data; name=\"$key\[\]\"\r\n\r\n";
$postdata .= "$cur_val\r\n";
@@ -1482,9 +1497,9 @@ class Snoopy
}
reset($formfiles);
while (list($field_name, $file_names) = each($formfiles)) {
foreach($formfiles as $field_name => $file_names) {
settype($file_names, "array");
while (list(, $file_name) = each($file_names)) {
foreach($file_names as $file_name) {
if (!is_readable($file_name)) continue;
$fp = fopen($file_name, "r");