gpt4 book ai didi

php - 如果我在 SimpleTest 测试用例中使用函数的返回值,Apache 会崩溃

转载 作者:可可西里 更新时间:2023-10-31 23:31:48 24 4
gpt4 key购买 nike

当我在 simpletest 中运行以下测试用例时,如果我使用行 B,Apache 会崩溃,但如果我使用行 A,似乎一切正常。

class TestPredicateRequest extends UnitTestCase
{
function testConstructWithPredicate()
{
Mock::generate("IQueryRequest");
$oRequest = new MockIQueryRequest();

$oPrototype = new QueryPrototype("TEST_COMMAND_STRING",
array(1 => QueryTypeConstants::CHARACTER_ID,
2 => QueryTypeConstants::CHARACTER_ID),
QueryTypeConstants::BOOLEAN);


$oRequest->returns("GetArguments", array(2 => 102)); //only argument 2 is set.
$oRequest->returns("GetPrototype", $oPrototype);
$oRequest->returns("GetUnsetArguments", array(1)); //only argument 1 is unset

$oToTest = new CharacterPredicateRequest($oRequest);

$this->Here(101); //LINE A
//$oItem = $this->Here(101); //LINE B
}

function Here($CharacterID)
{
return $CharacterID;
}
}

有什么可能的原因,是否存储函数的返回值是控制是否发生错误的原因?


附加信息:

如果我在 A 行或 B 行之后抛出异常,异常会冒泡到顶部,并且我会根据需要获得错误结果页面。这向我暗示,出于某种原因,SimpleTest 框架不喜欢 B 行的情况。是因为其中没有任何断言吗?


更新 x2:

Apache 的错误日志文件似乎毫无用处:

[Wed Aug 07 19:57:28.123436 2013] [mpm_winnt:notice] [pid 6908:tid 392] AH00455: Apache/2.4.4 (Win64) PHP/5.4.12 configured -- resuming normal operations
[Wed Aug 07 19:57:28.123436 2013] [mpm_winnt:notice] [pid 6908:tid 392] AH00456: Server built: Feb 22 2013 22:08:37
[Wed Aug 07 19:57:28.123436 2013] [core:notice] [pid 6908:tid 392] AH00094: Command line: 'c:\\wamp\\bin\\apache\\apache2.4.4\\bin\\httpd.exe -d C:/wamp/bin/apache/Apache2.4.4'
[Wed Aug 07 19:57:28.124436 2013] [mpm_winnt:notice] [pid 6908:tid 392] AH00418: Parent: Created child process 2444
[Wed Aug 07 19:57:28.863478 2013] [mpm_winnt:notice] [pid 2444:tid 284] AH00354: Child: Starting 150 worker threads.

(Crash would be here)

[Wed Aug 07 19:59:23.551038 2013] [mpm_winnt:notice] [pid 6908:tid 392] AH00428: Parent: child process 2444 exited with status 255 -- Restarting.
[Wed Aug 07 19:59:23.751049 2013] [mpm_winnt:notice] [pid 6908:tid 392] AH00455: Apache/2.4.4 (Win64) PHP/5.4.12 configured -- resuming normal operations
[Wed Aug 07 19:59:23.751049 2013] [mpm_winnt:notice] [pid 6908:tid 392] AH00456: Server built: Feb 22 2013 22:08:37
[Wed Aug 07 19:59:23.751049 2013] [core:notice] [pid 6908:tid 392] AH00094: Command line: 'c:\\wamp\\bin\\apache\\apache2.4.4\\bin\\httpd.exe -d C:/wamp/bin/apache/Apache2.4.4'
[Wed Aug 07 19:59:23.755050 2013] [mpm_winnt:notice] [pid 6908:tid 392] AH00418: Parent: Created child process 7288
[Wed Aug 07 19:59:24.608098 2013] [mpm_winnt:notice] [pid 7288:tid 284] AH00354: Child: Starting 150 worker threads.

最佳答案

这可能是因为您对 B 的内存访问权限有限。在页面开头使用 set_ini() 到 -1 以使用无限资源。

关于php - 如果我在 SimpleTest 测试用例中使用函数的返回值,Apache 会崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18094339/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com