简体   繁体   English

使用PHP在FILTER_VALIDATE_EMAIL上的“连接已重置”

[英]“The connection was reset” on FILTER_VALIDATE_EMAIL with php

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). 导致连接被重置(至少Firefox告诉了我)。 The server has PHP version 5.3.13 with Suhosin-Patch on FreeBSD. 该服务器的PHP版本为5.3.13 with Suhosin-Patch在FreeBSD上5.3.13 with Suhosin-Patch 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. 使用Suhosin在运行Debian和PHP 5.3.3版本的我自己的服务器上对其进行测试也可以正常工作,尽管我似乎记得它之前确实显示了相同的行为。

PHP manual indicates this was introduced on PHP 5.2.0 so it should work, shouldn't it? PHP手册指出这是在PHP 5.2.0上引入的,因此应该可以,不是吗?

Edit: To better show what fails, I show you two examples, one with reset, the other with a proper die("message"); 编辑:为了更好地说明失败的原因,我向您展示了两个示例,一个示例带有重置,另一个示例具有适当的die("message");

This example outputs Before validate on the browser Window: 本示例Before validate浏览器窗口上输出Before validate

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. 我在这里没有得到类似“ After validate”的输出。 Also the address is a very easy "no-reply@domain.com" address, so its even valid. 该地址也是一个非常简单的“ no-reply@domain.com”地址,因此它甚至有效。

Okay another edit: I made a oneliner running only this function and executed it on the console. 好的,再进行一次编辑:我制作了只运行此功能的oneliner并在控制台上执行了它。 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. 根据我在google上找到的信息,可以通过简单的更新来解决它,但是我将不得不等待他的回答。 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. 在此之前,这将必须解决,因为我无法修复此类系统深度错误。

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. 在此suhosin摘要中,他们讨论使用该标志时的段错误修复,这是一个openuse报告,但可能是您的安装容易受到此漏洞的影响。 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. 您可能需要确保您的suhosin补丁程序至少与opensuse的0.17.1版本对应。 Problem is I can't find anything about it on suhosin's official changelog . 问题是我在suhosin的官方变更日志上找不到任何有关它的信息。 Where does freebsd get their port source from in this case? 在这种情况下,freebsd从何处获取其端口源?

  • Tue Oct 26 2010 pgajdos@novell.com 2010年10月26日,星期二pgajdos@novell.com
    • fix "Segfault in filter_var with FILTER_VALIDATE_EMAIL with large amount of data" [bnc#649210] 修复“带有FILTER_VALIDATE_EMAIL的filter_var中的Segfault具有大量数据” [bnc#649210]
    • CVE-2010-3710.patch CVE-2010-3710。补丁

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM