在PHP运行时重命名函数 [英] Renaming Functions during runtime in PHP

查看:204
本文介绍了在PHP运行时重命名函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



在PHP 5.3中有一种方法来重命名一个函数或钩一个函数。 rename_function() APD中的code>自2004年以来已经破裂。如果你尝试在PHP 5.3上构建它,你会得到这个错误:



'struct _zend_compiler_globals'没有成员名为'extended_info' code>



这是一个非常容易的错误修复,只需更改这一行:



GC(extended_info)= 1;





CG(compiler_options)| = ZEND_COMPILE_EXTENDED_INFO;



我修改了我的php.ini,APD显示在我的phpinfo () 正如它应该。但是当我调用 rename_function() PHP页面不加载,并且我的 / var / log / apache2 /错误中出现分段错误。日志



有没有办法修复APD使用现代版本的PHP?还是有另一种重命名功能的方法? 为什么在地球上是不重要的功能不是在php!??!?!(Gotta love python:)

解决方案

最新的操作系统扩展程序可以在 http://github.com/zenovich/runkit
它支持当前发布的所有当代版本的PHP(从4.4到5.4+)。这个操作系统是官方的并且得到支持。



真诚的,
Dmitry Zenovich


In PHP 5.3 is there a way to rename a function or "hook" a function.

There is the rename_function() within "APD" which has been broken since ~2004. If you try and build it on PHP 5.3 you'll get this error:

'struct _zend_compiler_globals' has no member named 'extended_info'

This is a really easy error to fix, just change this line:

GC(extended_info) = 1;

to

CG(compiler_options) |= ZEND_COMPILE_EXTENDED_INFO;

I modified my php.ini and the APD shows up in my phpinfo() as it should. However when i call rename_function() the PHP page doesn't load and I get a segmentation fault in my /var/log/apache2/error.log.

Is there anyway to fix APD to work with a modern version of PHP? Or is there another method to rename functions? Why on earth is vital feature not in php!??!?! (Gotta love python :)

解决方案

The up-to-date runkit extension can be found on http://github.com/zenovich/runkit It supports all contemporary versions of PHP released for the time being (from 4.4 to 5.4+). This runkit is official and supported.

Sincerely, Dmitry Zenovich

这篇关于在PHP运行时重命名函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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