问题描述
我有一个方法
I have a method
function appendChildNode(AST $ aNewChild){
...
}
<<<
其中AST是一个类。如果我传递null,PHP会呈现以下消息:
function appendChildNode( AST $aNewChild ) {
...
}
<<<
where AST is a class. If I pass null, PHP renders this message:
可捕获的致命错误:参数1传递给AST :: appendChildNode()
必须是一个实例AST,null给出,调用/ Applications / MAMP /
htdocs / compile / includes / CParser.inc.php(517):eval()'代码在第1行
并在/Applications/MAMP/htdocs/compile/includes/AST.inc.php中定义
第43行
<<<
任何想法,为什么我都不能传递空值?
[appendChildNode()是在类AST中声明的方法] br />
Catchable fatal error: Argument 1 passed to AST::appendChildNode()
must be an instance of AST, null given, called in /Applications/MAMP/
htdocs/compile/includes/CParser.inc.php(517) : eval()''d code on line 1
and defined in /Applications/MAMP/htdocs/compile/includes/AST.inc.php
on line 43
<<<
Any ideas, why I can''t pass a null value?
[appendChildNode() is a method declared inside the class AST]
推荐答案
可捕获的致命错误:参数1传递给AST :: appendChildNode()
必须是一个实例AST,null给出,调用/ Applications / MAMP /
htdocs / compile / includes / CParser.inc.php(517):eval()'代码在第1行
并在/Applications/MAMP/htdocs/compile/includes/AST.inc.php中定义
第43行
<<<
任何想法,为什么我都不能传递空值?
[appendChildNode()是在类AST中声明的方法] php中的
Catchable fatal error: Argument 1 passed to AST::appendChildNode()
must be an instance of AST, null given, called in /Applications/MAMP/
htdocs/compile/includes/CParser.inc.php(517) : eval()''d code on line 1
and defined in /Applications/MAMP/htdocs/compile/includes/AST.inc.php
on line 43
<<<
Any ideas, why I can''t pass a null value?
[appendChildNode() is a method declared inside the class AST]
好的,thx。如何将空指针作为对象传递?
OK, thx. How do I have to pass a null ''pointer'' as an object?
这篇关于为类类型参数传递null会导致捕获错误?!?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!