php-general Digest 17 Mar 2011 14:44:59 -0000 Issue 7231
Topics (messages 311894 through 311897):
Re: PHP4 vs PHP5 overrides
311894 by: Tom Robinson
311895 by: Tom Robinson
PHP session replication
311896 by: Alessandro Ferrucci
311897 by: Dan Joseph
Administrivia:
To subscribe to the digest, e-mail:
[email protected]
To unsubscribe from the digest, e-mail:
[email protected]
To post to the list, e-mail:
[email protected]
----------------------------------------------------------------------
--- Begin Message ---
My apologies. I've not seen something I should have earlier. Also the
instance that is behind all of this is and instance of
ActiveRecordFormClass.
So, in PHP4, the correct overridden method is called:
ActiveRecordFormClass::_dispatchSave().
In PHP5, the FormClass::_dispatchSave() is called...???
BTW I'm tracing this though with xdebug.
Regards,
Tom
Tom Robinson
System Administrator
On 17/03/11 13:06, Tom Robinson wrote:
> Hi,
>
> I'm trying to decipher inherited code (I did not write this) and I'm
> having great difficulty understanding the override of a method in PHP4
> vs PHP5
>
> Here's the code:
>
> form.php
> 22 class FormClass
> 23 {
> ...
> /* some method calls to _dispatchSave() */
> 572 if($this->_dispatchSave($key) === FALSE)
> 573 {
> 574 return FALSE;
> 575 }
> ...
> /* _dispatchSave is defined */
> 692 function _dispatchSave($key)
> 693 {
>
> arform.php
> 17 class ActiveRecordFormClass extends FormClass
> 18 {
> ...
> /* _dispatchSave is defined */
> 84 function _dispatchSave(&$key)
> 85 {
>
> In PHP 4.3.9:
>
> The arform.php implementation of _dispatchSave is called
> (i.e.ActiveRecordFormClass::_dispatchSave())in preference to the one
> defined in it's own class. This is the desired call BTW but why does
> this happening? I would expect the parent implementation to be called,
> not a child implementation???
>
> In PHP 5.1.6:
>
> I get the warning:
>
> "PHP Strict Standards: Declaration of
> ActiveRecordFormClass::_dispatchSave() should be compatible with that of
> FormClass::_dispatchSave() in ..."
>
> which is expected since the parameters are defined differently. As I
> expected, the FormClass::_dispatchSave() implementation is called in
> PHP5. This implementation does not have the desired effect (the
> application crashes).
>
> What is happening? Maybe I'm not seeing something simple. I look forward
> to any responses.
>
> Regards,
>
> Tom
>
>
>
>
signature.asc
Description: OpenPGP digital signature
--- End Message ---
--- Begin Message ---
It's funny how talking or writing about something uncovers things you
didn't see before.
In an effort to tidy up the code I heeded the original implementors
comments and made the methods private (they were previously undeclared).
Making them public seems to have fixed the problem.
On 17/03/11 13:20, Tom Robinson wrote:
> My apologies. I've not seen something I should have earlier. Also the
> instance that is behind all of this is and instance of
> ActiveRecordFormClass.
>
> So, in PHP4, the correct overridden method is called:
> ActiveRecordFormClass::_dispatchSave().
> In PHP5, the FormClass::_dispatchSave() is called...???
>
> BTW I'm tracing this though with xdebug.
>
> Regards,
>
> Tom
>
> Tom Robinson
> System Administrator
> On 17/03/11 13:06, Tom Robinson wrote:
>> Hi,
>>
>> I'm trying to decipher inherited code (I did not write this) and I'm
>> having great difficulty understanding the override of a method in PHP4
>> vs PHP5
>>
>> Here's the code:
>>
>> form.php
>> 22 class FormClass
>> 23 {
>> ...
>> /* some method calls to _dispatchSave() */
>> 572 if($this->_dispatchSave($key) === FALSE)
>> 573 {
>> 574 return FALSE;
>> 575 }
>> ...
>> /* _dispatchSave is defined */
>> 692 function _dispatchSave($key)
>> 693 {
>>
>> arform.php
>> 17 class ActiveRecordFormClass extends FormClass
>> 18 {
>> ...
>> /* _dispatchSave is defined */
>> 84 function _dispatchSave(&$key)
>> 85 {
>>
>> In PHP 4.3.9:
>>
>> The arform.php implementation of _dispatchSave is called
>> (i.e.ActiveRecordFormClass::_dispatchSave())in preference to the one
>> defined in it's own class. This is the desired call BTW but why does
>> this happening? I would expect the parent implementation to be called,
>> not a child implementation???
>>
>> In PHP 5.1.6:
>>
>> I get the warning:
>>
>> "PHP Strict Standards: Declaration of
>> ActiveRecordFormClass::_dispatchSave() should be compatible with that of
>> FormClass::_dispatchSave() in ..."
>>
>> which is expected since the parameters are defined differently. As I
>> expected, the FormClass::_dispatchSave() implementation is called in
>> PHP5. This implementation does not have the desired effect (the
>> application crashes).
>>
>> What is happening? Maybe I'm not seeing something simple. I look forward
>> to any responses.
>>
>> Regards,
>>
>> Tom
>>
>>
>>
>>
signature.asc
Description: OpenPGP digital signature
--- End Message ---
--- Begin Message ---
Hello,
I'm curious, what are the most popular methods to perform session
replication across http servers in PHP?
I've read about repcache(memcached module) and Mysql.
anything else? is there some mod_php_session_replication httpd module?
thanks
--
Signed,
Alessandro Ferrucci
--- End Message ---
--- Begin Message ---
On Thu, Mar 17, 2011 at 12:06 AM, Alessandro Ferrucci <
[email protected]> wrote:
> I'm curious, what are the most popular methods to perform session
> replication across http servers in PHP?
>
I personally just use MySQL and the session_set_save_handler() stuff
attached to a class. Many of the frameworks, such as Zend, also support
Database Sessions.
--
-Dan Joseph
--- End Message ---