douwei7501 2012-06-24 19:24
浏览 45
已采纳

使用php在FILTER_VALIDATE_EMAIL上“重置连接”

I do not find anything on the web and I don't know why: Calling

filter_var($address, FILTER_VALIDATE_EMAIL)

leads to the connection being reset (at least that's what Firefox tells me). The server has PHP version 5.3.13 with Suhosin-Patch on FreeBSD. Testing this on my own server which runs Debian and PHP version 5.3.3 also with Suhosin works fine, though I seem to remember it did show the same behaviour before.

PHP manual indicates this was introduced on PHP 5.2.0 so it should work, shouldn't it?

Edit: To better show what fails, I show you two examples, one with reset, the other with a proper die("message");

This example outputs Before validate on the browser Window:

if (function_exists('filter_var')) { //Introduced in PHP 5.2

    die("Before validate");
  if(filter_var($address, FILTER_VALIDATE_EMAIL) === FALSE) {
    return false;
  } else {
    return true;
  }
} else {
return preg_match('/^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9_](?:[a-zA-Z0-9_\-](?!\.)){0,61}[a-zA-Z0-9_-]?\.)+[a-zA-Z0-9_](?:[a-zA-Z0-9_\-](?!$)){0,61}[a-zA-Z0-9_]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/', $address);
}

The example leads to the aforementioned "connection was reset...":

if (function_exists('filter_var')) { //Introduced in PHP 5.2


  if(filter_var($address, FILTER_VALIDATE_EMAIL) === FALSE) {

  die("After validate");
    return false;
  } else {

  die("After validate");
    return true;
  }
} else {
  return preg_match('/^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9_](?:[a-zA-Z0-9_\-](?!\.)){0,61}[a-zA-Z0-9_-]?\.)+[a-zA-Z0-9_](?:[a-zA-Z0-9_\-](?!$)){0,61}[a-zA-Z0-9_]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/', $address);
}

I do not get an output like "After validate" here. Also the address is a very easy "no-reply@domain.com" address, so its even valid.

Okay another edit: I made a oneliner running only this function and executed it on the console. This is the output:

/libexec/ld-elf.so.1: /usr/local/lib/php/20090626/filter.so: Undefined symbol "php_pcre_exec"

I handed this over to the server admin. From what I found on google, a simple update could solve it, but I will have to wait for his answer. If the issue is solved, I will note this here. Until then this will have to rest, as I cannot fix such a system-deep error.

  • 写回答

1条回答 默认 最新

  • doukun8670 2012-06-24 19:46
    关注

    in this suhosin summary they talk about a fix to a segfault when using that flag, it's an opensuse report but it might be that your install is susceptible to it. You'll probably need to make sure that your suhosin patch is up to at least what corresponds to opensuse's version 0.17.1. Problem is I can't find anything about it on suhosin's official changelog. Where does freebsd get their port source from in this case?

    • Tue Oct 26 2010 pgajdos@novell.com
      • fix "Segfault in filter_var with FILTER_VALIDATE_EMAIL with large amount of data" [bnc#649210]
      • CVE-2010-3710.patch
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 CATIA有些零件打开直接单机确定终止
  • ¥15 请问有会的吗,用MATLAB做
  • ¥15 phython如何实现以下功能?查找同一用户名的消费金额合并—
  • ¥15 ARIMA模型时间序列预测用pathon解决
  • ¥15 孟德尔随机化怎样画共定位分析图
  • ¥18 模拟电路问题解答有偿速度
  • ¥15 CST仿真别人的模型结果仿真结果S参数完全不对
  • ¥15 误删注册表文件致win10无法开启
  • ¥15 请问在阿里云服务器中怎么利用数据库制作网站
  • ¥60 ESP32怎么烧录自启动程序,怎么查看客户esp32板子上程序及烧录地址