Re: PHP5 extensions: using existing functionnames as method

php.internals

Unnamed Person

19 years ago
>Solution: Change "string_functions" to "NULL" in zend_module_entry.
Thanks! You rescued my extension. Now I can finish and test the class.
>> #define STRING_METHOD(function_name) \ >> ZEND_NAMED_FUNCTION(c_stringclass_##function_name) >> #define STRING_ME(name, arg_info, flags) \ >> ZEND_FENTRY(name, c_stringclass_ ##name, arg_info, flags) >> >There's nothing special about these macros except for the specific >function prefix you assign them. Any particular reason you're using them?
As I wrote, I've looked around existing extensions which redefine function names (SPL and zip) and there I found those Macro-Definitions and thought this could be the solution.
>> #ifdef ZTS >> #define string_G(v) TSRMG(string_globals_id, zend_string_globals *, v) >> #else >> #define string_G(v) (string_globals.v) >> #endif >It's common practice to use all uppercase for TSRM macros. Not really >an issue, but worth a mentiCONFORM!!!!! YOU MUST CONFORM!!!! :)
Actually I don't know where this come from and why it's in. I don't have any globals. ext.skel? Copied from somewhere? Don't know. If there is any interest in OO-Representation of primitive types let me know, So I could release them as PECL-extension. Daniel BTW Can anyone explain, why the mailservice I'm using is producing such a crap in the subject and what could be done to prevent this for future posts?

Sara Golemon

19 years ago
> As I wrote, I've looked around existing extensions which redefine function > names > (SPL and zip) and there I found those Macro-Definitions and thought this > could be > the solution. >
Fair enough....I must not have read that in my review of the thread...
>>> #define string_G(v) (string_globals.v) > Actually I don't know where this come from and why it's in. > I don't have any globals. ext.skel? Copied from somewhere? Don't know. >
ext_skel would have upper-cased it for you when you ran the script... but yeah, no big since you're not using extension globals anyway... Just some cruft to clean out....
> If there is any interest in OO-Representation of primitive types let me > know, > So I could release them as PECL-extension. >
Ah yes, that was one thing I was also going to mention. Using primitive/common names is discouraged for non-core extensions (at least the ones we release on pecl.php.net and can exercise some amount of control over). For an answer to why: Refer to Steph's summary of the Date Wars (pear in that case, but the same concept applies). -Sara