在xhr响应中无法解释的var_dump()s


Unexplained var_dump()s in xhr response

我使用XmlHTTPRequest对象异步调用PHP脚本,但我在输出中获得var_dump的返回值。

以下是回复文本(我已经编辑掉了我的电子邮件):

array(5) {
["UID"]=>
string(1) "3"
["NAME"]=>
string(15) "Henry Kissenger"
["EMAIL"]=>
string(25) "******@*******.com"
["PASS"]=>
string(34) "$1$.nDZEZgZ$QKuE.mhlBPDZ3WdhwkiPC1"
["TITLE"]=>
string(9) "Exchequer"
}
3 | Exchequer | Henry Kissenger | ******@*******.com | 

PHP脚本和类中没有任何地方被调用,甚至做了查找/替换以确保它没有被调用。相关代码如下,在这批代码中找不到var_dump

getSingleUser.php,被xhr obj调用

<?php
session_start();
$pathUser = __DIR__."/../user/uClass_v2.php";
require $pathUser;
$user = User::withID($_SESSION["UID"]);
echo "$user->ID | $user->title | $user->name | $user->email | ";
?>

uClass_v2.php,相关功能。

//queries db for user with ID, then returns the instance.
public static function withID($ID)
{
    $instance = new self();
    $instance->loadByID($ID);
    return $instance;
}
//queries the user table using the queryByUID() funct, then fill()s
public function loadByID($ID)
{
    $result = $this->queryByUID($ID);
    $this->fill($result);
}

//queries user table, returns the assoc array.
public function queryByUID($ID)
{
    $this->CON = new mysqli("domain.name","kevin","******","tbd");
    $query = "SELECT * FROM User WHERE UID =".$ID;
    $results = $this->CON->query($query);
    if($results->num_rows > 0)
    {
        return $results->fetch_assoc();
    }
}
#accepts array, performs checks to ensure not empty or not meeting assoc array format required, then sets object properties. 
public function fill(array $row)
{
    //counts number of array elements, to decide if existing user or creating new user.
    $noElements = count($row);
    if($noElements <= 0 || $noElements > 5)
    {
        //return "incorrect # elements";
    }else if($noElements == 4)
    {
        //registering new user, leave UID unset.
        //not sure if isset checks are required. 
        if(isset($row["name"])   && 
             isset($row["title"])&& 
             isset($row["email"])&& 
             isset($row["pass"]))
        {
            $this->name = $row["name"];
            $this->title = $row["title"];
            $this->email = $row["email"];
            // @ below = shut up about salts php7
            $this->pass = @crypt($row["pass"]);
        }
        else
        {
            //return "not all element set.";
        }   
    }else if($noElements == 5)
    {   //existing user, from db row.
        $this->name  = $row["NAME"];
        $this->title = $row["TITLE"];
        $this->email = $row["EMAIL"];
        $this->ID   = $row["UID"];
        $this->pass  = $row["PASS"];
    }else
    {
        //echo "I don't think you should ever see this";
    }
}

这只发生在我从廉价的主机服务转移到我自己的服务器之后。这是我的Apache/php.ini中的错误配置吗?

如果这看起来很熟悉,请告诉我,我对此感到非常沮丧!

它不再这样做了,这是我所做的更改。

  • 在start_session上抑制警告,没有修复@session_start();

  • 注释掉每个echo,然后取消注释。这似乎解决了这个问题,但是我找不到一个原因。//echo "someString"; -> echo "someString";

  • 多次重新启动httpd,没有更改httpd.conf或php.ini

如果有人能解释一下,我将永远感激不尽。