# PHP5 extensions: using existing functionnames as method names

- Thread: https://externals.io/message/25661
- Original archive: https://news-web.php.net/php.internals/25661
- Started by danhen@email.de on 2006-09-13T12:44:27+00:00
- Messages: 3
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #25661 — danhen@email.de — 2006-09-13T12:44:27+00:00

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

>It is possible to name a method like an existing function, I'm not sure
>what you are doing exactly but it works here.

I've tried: STRING_METHOD(String, trim) {...} (Yes, I'm trying to build a string class)
that means that I also redefinied the Macros. Then I've changed the Macros from PHP_METHOD
and PHP_ME to ZEND_NAMED_FUNCTION and ZEND_FENTRY.

Still on startup "PHP Warning:  Function registration failed - duplicate name - trim"
appears.

>When your class is called zip and you have a function called zip_open,
>it will conflict with the function name when you build against php <
>5.2.0. It is fixed in 5.2 and a work around exists, see ext/zip for an
>example.

I haven't found any real differences (but now I know that there is more than one
way to create a class).

So I will have to wait for 5.2 to get a trim-method?

Daniel

---

## #25663 — Pierre — 2006-09-13T15:06:17+00:00

URL: https://externals.io/message/25661#25663 · In reply to: #25661

Hello,


> > […]
>
> I've tried: STRING_METHOD(String, trim) {...} (Yes, I'm trying to build a string class)
> that means that I also redefinied the Macros. Then I've changed the Macros from PHP_METHOD
> and PHP_ME to ZEND_NAMED_FUNCTION and ZEND_FENTRY.
>
> Still on startup "PHP Warning:  Function registration failed - duplicate name - trim"
> appears.
>
> > […]
>
> I haven't found any real differences (but now I know that there is more than one
> way to create a class).
>
> So I will have to wait for 5.2 to get a trim-method?

No, as I said it works well before 5.2 except for zip_* function name
and a uip class. Can you show some code? It will help to figure out
what's wrong.

--Pierre

--Pierre

---

## #25664 — Pierre — 2006-09-13T15:07:01+00:00

URL: https://externals.io/message/25661#25664 · In reply to: #25663

> No, as I said it works well before 5.2 except for zip_* function name
> and a uip class.

I mean for zip_* function names and a zip class :)
