修复Warning: array_merge() [function.array-merge]: Argument #1 is not an array in 错误


最近,在调试一个php程序,传上去后却出现了如下的错误:


Warning: array_merge() [function.array-merge]: Argument #1 is not an array in /home/public_html/checkpostandget.php on line 28

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /home/public_html/checkpostandget.php on line 28

Warning: Invalid argument supplied for foreach() in /home/public_html/checkpostandget.php on line 37


找到第28行后,发现是这个样子的,这是个防止PHP注入的语句~~

$ArrPostAndGet=array_merge($HTTP_POST_VARS,$HTTP_GET_VARS);

改成如下样子:

$ArrPostAndGet=array_merge((array)$HTTP_POST_VARS,(array)$HTTP_GET_VARS);
后问题解决


 

Relate Posts:

Leave a Reply