Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/285.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP串联删除一些字符,真是疯狂!PHP内部错误?_Php - Fatal编程技术网

PHP串联删除一些字符,真是疯狂!PHP内部错误?

PHP串联删除一些字符,真是疯狂!PHP内部错误?,php,Php,几年以来,我一直在使用PHP进行开发 但今天我遇到了一个我无法解释的问题,这是一个非常简单的连接,但结果是结果字符串末尾缺少字符 代码如下: $select = $this -> phpSqlCreator -> processSELECT2($this -> phpSqlParser -> parsed); $from = $this -> phpSqlCreator -> processFROM2($this -> phpSqlParser ->

几年以来,我一直在使用PHP进行开发

但今天我遇到了一个我无法解释的问题,这是一个非常简单的连接,但结果是结果字符串末尾缺少字符

代码如下:

$select = $this -> phpSqlCreator -> processSELECT2($this -> phpSqlParser -> parsed);
$from = $this -> phpSqlCreator -> processFROM2($this -> phpSqlParser -> parsed['FROM']);
$where = $this -> whereString;

$sql = $select . ' ' . $from . ' ' . $where;
当我调试这段代码时,这里就是我看到的

$select变量包含以下字符串:

SELECT DISTINCT t.id as "t.id",t.creation_date as "t.creation_date",t.default_language_code as 
 "t.default_language_code",t.name as "t.name",t.description as "t.description",t.document_store_path as 
 "t.document_store_path",t.type as "t.type",t.left_value as "t.left_value",t.right_value as "t.right_value",t.event_id as 
 "t.event_id",t.parent_id as "t.parent_id",t2.id as "t2.id",t2.creation_date as 
 "t2.creation_date",t2.default_language_code as "t2.default_language_code",t2.name as "t2.name",t2.description 
 as "t2.description",t2.document_store_path as "t2.document_store_path",t2.type as "t2.type",t2.left_value as 
 "t2.left_value",t2.right_value as "t2.right_value",t2.event_id as "t2.event_id",t2.parent_id as "t2.parent_id"
FROM team t , (SELECT t.* FROM team t LEFT JOIN team_role tr ON (t.id = tr.team_id) WHERE 
 tr.participant_id = ? UNION SELECT t.* FROM team t LEFT JOIN team_role tr ON (t.id = tr.team_id) LEFT JOIN 
 unit_role ur ON (tr.unit_id = ur.unit_id) WHERE ur.participant_id = ?) as dt LEFT JOIN team t2 ON ("t.parent_id" = t2.id)
然后,$from变量包含以下字符串:

SELECT DISTINCT t.id as "t.id",t.creation_date as "t.creation_date",t.default_language_code as 
 "t.default_language_code",t.name as "t.name",t.description as "t.description",t.document_store_path as 
 "t.document_store_path",t.type as "t.type",t.left_value as "t.left_value",t.right_value as "t.right_value",t.event_id as 
 "t.event_id",t.parent_id as "t.parent_id",t2.id as "t2.id",t2.creation_date as 
 "t2.creation_date",t2.default_language_code as "t2.default_language_code",t2.name as "t2.name",t2.description 
 as "t2.description",t2.document_store_path as "t2.document_store_path",t2.type as "t2.type",t2.left_value as 
 "t2.left_value",t2.right_value as "t2.right_value",t2.event_id as "t2.event_id",t2.parent_id as "t2.parent_id"
FROM team t , (SELECT t.* FROM team t LEFT JOIN team_role tr ON (t.id = tr.team_id) WHERE 
 tr.participant_id = ? UNION SELECT t.* FROM team t LEFT JOIN team_role tr ON (t.id = tr.team_id) LEFT JOIN 
 unit_role ur ON (tr.unit_id = ur.unit_id) WHERE ur.participant_id = ?) as dt LEFT JOIN team t2 ON ("t.parent_id" = t2.id)
$where变量包含:

WHERE t.left_value < dt.left_value and t.right_value > dt.right_value and t.event_id = dt.event_id
SELECT DISTINCT t.id as "t.id",t.creation_date as "t.creation_date",t.default_language_code as 
 "t.default_language_code",t.name as "t.name",t.description as "t.description",t.document_store_path as 
 "t.document_store_path",t.type as "t.type",t.left_value as "t.left_value",t.right_value as "t.right_value",t.event_id as 
 "t.event_id",t.parent_id as "t.parent_id",t2.id as "t2.id",t2.creation_date as 
 "t2.creation_date",t2.default_language_code as "t2.default_language_code",t2.name as "t2.name",t2.description 
 as "t2.description",t2.document_store_path as "t2.document_store_path",t2.type as "t2.type",t2.left_value as 
 "t2.left_value",t2.right_value as "t2.right_value",t2.event_id as "t2.event_id",t2.parent_id as "t2.parent_id" FROM 
 team t , (SELECT t.* FROM team t LEFT JOIN team_role tr ON (t.id = tr.team_id) WHERE tr.participant_id = ? 
 UNION SELECT t.* FROM team t LEFT JOIN team_role tr ON (t.id = tr.team_id) LEFT JOIN unit_role ur ON 
 (tr.unit_id = ur.unit_id) WHERE ur.participant_id = ?) as dt LEFT JOIN team t2 ON (
连接非常简单,但不起作用,$from字符串变量的结尾缺失,$where字符串变量的完整内容也缺失。我不明白,因为代码很简单

此外,这种代码的和平是由一组自动单元测试彻底执行的。这是非常奇怪的,因为当代码使用PHPUnit执行时,PHP Cli的连接结果很好,我们所有的测试都成功了

只有在Windows 8机器上的Web应用程序标准Apache 2.2.22+PHP 5.3.13设置中执行代码时,才会遇到这种连接问题


你知道是什么导致了这个奇怪的问题吗?PHP设置?5.3.13版本的PHP出现了一个PHP错误?调试时字符串中看不到的奇怪字符?很明显,我今晚太累了,所以没有看到什么?

很明显,$sql的操作限制为1024个字符。要么某个程序在下一个地址错误地存储了某些内容,要么$sql变量在某处设置了大小限制


据我所见,在php中,字符串可以大到2GB。php.ini配置文件中有一个memory_limit指令,但我无法想象您将其设置为1024字节1K,谢谢您的回复

我最终发现连接很好,是我的IDEEclipse没有将所有字符显示到字符串中

更多信息可在此处找到:

所以我的问题不是问题

非常感谢


巴普蒂斯特

除了这个问题,典型的堆栈溢出用户还喜欢Waldo在哪里,在干草堆中寻找针不,没有磁铁,你们这些业余爱好者!你怎么知道它不起作用。。也许连接是可以的,但是组件SQL语句有一些问题?您是否遇到了错误,或者只是查询中出现了意外的结果?@Carsten+1和looool:DI无法重现问题:如果我们去掉了那些开玩笑或没有建设性的评论,我们会发现连接问题无法重现。巴普蒂斯特,有没有可能做一个实验来证明这个问题?