奇怪的 PHP 方法行为不存在,但存在于代码中
有人对此有线索吗? PHP 5.2.13。结果不完全一致,即可能一次在某个页面上获得良好结果,然后在另一页面上出现错误。
该错误是致命的 - 类没有方法。
但以下情况是正确的:
该类仅在一处定义,并且在代码中具有相关方法。 在失败发生的地方:反射表明该方法存在。 发生故障时:method_exists 表示该方法不存在。 代码早期的调用(它们都是静态的 - 不是我的选择)有效。
Does anyone have a clue about this? PHP 5.2.13. Results not wholly consistent i.e. could get a good result with a page at one time, then get an error at another.
The error is fatal - class does not have method.
But the following are true:
The class is defined in only one place and has the relevant method in the code.
At the point where failure occurs: reflection shows that the method exists.
At the point where failure occurs: method_exists says the method does not exist.
Previous calls (they're all static - not my choice) earlier in the code worked.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
可能是相关的: http://bugs.php.net/bug.php?id= 51425
但我认为这里我们有一些与缓存相关的问题。您是否启用了某些缓存?像 APC 或任何其他加速器一样?
May be it's related: http://bugs.php.net/bug.php?id=51425
But I think here we have some cache-related problem. Do you have some cache enabled? Like APC or any other accelerators?
确保包含包含该方法的文件。如果该方法位于类中,请确保创建类实例并通过该类调用该方法。
也许您缺少类实例?
Be sure that the file containing the method is included. If the method is in a class, make sure the class instance is created and the method is called through the class.
Maybe you are missing the class instance?