# [patch] Separating ZEND_METHOD and ZEND_FUNCTION

- Thread: https://externals.io/message/22103
- Original archive: https://news-web.php.net/php.internals/22103
- Started by Johannes Schlueter on 2006-03-03T22:30:00+00:00
- Messages: 3
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #22103 — Johannes Schlueter — 2006-03-03T22:30:00+00:00

URL: https://externals.io/message/22103#22103

Hi,

following a recent discussion on IRC I'd like to propose a little patch 
separating ZEND_FUNCTION and ZEND_METHOD.

Currently functions declared as ZEND_FUNCTION are named zif_exported_name. 
Class methods are exported as zif_class_method. If you try to create a PHP 
function called foo_bar but already have some class foo with a method bar 
this leads to a "redefinition of `zif_foo_bar`".

The attached patch solves this kind of issues by prefixing methods with zim_ 
(with m like in method) instead of zif_.

Additionally it might help a bit while debugging since you can see wether 
you're in some class/object or a function context.

As always the patch is also available at my repository on 
http://svn.schlueters.de/phpatches/HEAD/zend_separate_zend_method.diff

johannes

---

## #22104 — Andi Gutmans — 2006-03-03T22:35:56+00:00

URL: https://externals.io/message/22103#22104 · In reply to: #22103

Makes sense to me.

At 02:30 PM 3/3/2006, Johannes Schlueter wrote:
>Hi,
>
>following a recent discussion on IRC I'd like to propose a little patch
>separating ZEND_FUNCTION and ZEND_METHOD.
>
>Currently functions declared as ZEND_FUNCTION are named zif_exported_name.
>Class methods are exported as zif_class_method. If you try to create a PHP
>function called foo_bar but already have some class foo with a method bar
>this leads to a "redefinition of `zif_foo_bar`".
>
>The attached patch solves this kind of issues by prefixing methods with zim_
>(with m like in method) instead of zif_.
>
>Additionally it might help a bit while debugging since you can see wether
>you're in some class/object or a function context.
>
>As always the patch is also available at my repository on
>http://svn.schlueters.de/phpatches/HEAD/zend_separate_zend_method.diff
>
>johannes

---

## #22105 — Pierre — 2006-03-04T00:38:32+00:00

URL: https://externals.io/message/22103#22105 · In reply to: #22104

> Makes sense to me.

For me too, I was requesting that on IRC and Johannes wrote the patch,
thanks :-)

A perfect example of this need is the current zip extension, I have
both a zip_open function and a zip::open method, acting differently.
Many extensions have to (re)define themselves these macros, as I did.

--Pierre
