Re: DateTime call_user_function_ex

From: Date: Thu, 12 Jul 2007 09:48:35 +0000
Subject: Re: DateTime call_user_function_ex
References: 1 2  Groups: php.pecl.dev 
Request: Send a blank email to pecl-dev+get-4799@lists.php.net to get a copy of this message
Johannes Schlüter <johannes@php.net> wrote: > Hi Piotr, Hi, > First of all: In most cases it's better to use zend_call_method instead > of calol_user_function, in this case there's even a macro > zend_call_method_with_1_params in Zend/zent_interfaces.h which makes > this a tiny bit simpler in your case (just pass NULL for fn_proxy if you > call the method just once on that object) Great tip! It saves a lot of time and a lot of code which should be written :) > Here you're setting the string "DateTime::ISO8601" as parameter for the > function you're going to call later, this would mean you're doing > $dt->format("DateTime::ISO8601"); > instead of using the constant, as in > $dt->format(DateTime::ISO8601); Ah, this indeed solved problem. I was confused as method requires string. > > /* Copy function arguments */ > > zval ***args = __copy_args(dt_params); > > > > /* TSRMSLS_FETCH(); */ /* Should be called here (required for CG macro ) */ > > Some compilers need variable declaratiosn to be on the beginning of the > block, TSRMLS_FETCH declares a variable so it should be moved to the top > (just like f_format and args) if oyu want it to work on any compiler. I doubt gcc >= 4 has this limitation. I just commented it because this macro doesn't seem to exist in headers. And I blindly copied TSRMSLS_FETCH from doc's example. > Btw. the documentation there is currently a bit outdated (it's from PHP > 4.0 times, I think, and was never updated) I know , but first I want to refer to *any* docs before I can be punished for not RTFM'ing. Thank you very much for the tips! Piotras

« previous php.pecl.dev (#4799) next »