与 PHP 反射 API 不一致的结果 [英] Inconsistent results with PHP Reflection API

查看:33
本文介绍了与 PHP 反射 API 不一致的结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个在 Windows 和 Windows 上都能完美运行的应用程序使用 PHP5 反射 API 的 Mac.

I have an application that works perfectly on both Windows & Mac that uses the PHP5 Reflection API.

我尝试将应用程序部署到 Linux 机器(运行 PHP 5.3.6 -生产服务器的 CentOS 机器),结果发现 ReflectionMethod::getDocComment() 函数没有返回任何内容.我调查了一会儿,发现行尾是一个潜在的罪魁祸首.

I attempted to deploy the application to a Linux machine (CentOS box running PHP 5.3.6 -production server), only to find that the ReflectionMethod::getDocComment() function does not return anything. I investigated for a little while, and discovered that the line-endings were a potential culprit.

我在我的服务器上使用了 dos2unix 实用程序将行尾全部更改为 Unix 样式,并且脚本可以正常工作.现在是奇怪的部分:它只能一次.我的意思是,从 ReflectionMethod::getDocComment() 返回数据的脚本工作一次,然后(不对磁盘上的文件或代码进行任何修改)它恢复为不工作.

I used the dos2unix utility on my server to change the line-endings all to Unix-style, and the script works. Now here's the strange part: it only works once. By this, I mean that the script which returns the data from ReflectionMethod::getDocComment() works once, and then (without any modification to the files on disk or the code) it reverts back to not working.

任何帮助或建议将不胜感激.

Any help or advice would be greatly appreciated.

推荐答案

您可以像这样在 .htaccess 中使用 php_flag ,而不是在全球范围内推出它:

Instead of turning it out globally you may use php_flag in your .htaccess like so :

php_flag eaccelerator.enable 0
php_flag eaccelerator.optimizer 0

我遇到了同样的问题,我花了一些时间才弄明白(3 小时),因为我没有生产服务器.

I had the same issue and it took me some time to figuring out (3 hours) because I didn't own the production server.

这篇关于与 PHP 反射 API 不一致的结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆