CodeIgniter:编译失败:(?<偏移5处)后无法识别的字符

时间:2016-10-07 15:48:20

标签: php forms codeigniter post preg-replace-callback

我一直在使用CodeIgniter-2.2.6创建一个网站,并在我的本地计算机上成功创建了一个可用的网站。

问题1

但是当我将其上传到000webhost免费托管时,我收到此错误:

  

遇到PHP错误

     

严重性:警告

     

消息:preg_replace_callback()[function.preg-replace-callback]:   编译失败:(?< at offset 5

后无法识别的字符      

文件名:core / Security.php

     

行号:432

core/Security.php代码(第404至435行):

    /*
     * Sanitize naughty HTML elements
     *
     * If a tag containing any of the words in the list
     * below is found, the tag gets converted to entities.
     *
     * So this: <blink>
     * Becomes: &lt;blink&gt;
     */
    $pattern = '#'
        .'<((?<slash>/*\s*)(?<tagName>[a-z0-9]+)(?=[^a-z0-9]|$)' // tag start and name, followed by a non-tag character
        .'[^\s\042\047a-z0-9>/=]*' // a valid attribute character immediately after the tag would count as a separator
        // optional attributes
        .'(?<attributes>(?:[\s\042\047/=]*' // non-attribute characters, excluding > (tag close) for obvious reasons
        .'[^\s\042\047>/=]+' // attribute characters
        // optional attribute-value
            .'(?:\s*=' // attribute-value separator
                .'(?:[^\s\042\047=><`]+|\s*\042[^\042]*\042|\s*\047[^\047]*\047|\s*(?U:[^\s\042\047=><`]*))' // single, double or non-quoted value
            .')?' // end optional attribute-value group
        .')*)' // end optional attributes group
        .'[^>]*)(?<closeTag>\>)?#isS';

    // Note: It would be nice to optimize this for speed, BUT
    //       only matching the naughty elements here results in
    //       false positives and in turn - vulnerabilities!
    do
    {
        $old_str = $str;
        $str = preg_replace_callback($pattern, array($this, '_sanitize_naughty_html'), $str); // This is line no 432
    }
    while ($old_str !== $str);
    unset($old_str);

这仅在我发布form的脚本中给出。

问题2

接下来的问题是我在发布form时会得到空白字段。这是我得到的

print_r($_POST);
  

数组([fname] =&gt; [email] =&gt; [密码] =&gt; [repassword] =&gt; [用户名]   =&GT; )

详情

PHP版(我的电脑版):7.0.9

PHP版本(000webhost):5.2。*

0 个答案:

没有答案