php-general Digest 16 Mar 2011 11:44:50 -0000 Issue 7229

2011-03-16 Thread php-general-digest-help

php-general Digest 16 Mar 2011 11:44:50 - Issue 7229

Topics (messages 311881 through 311884):

Re: String eval assistance
311881 by: Simon J Welsh
311882 by: Jack
311883 by: Richard Quadling
311884 by: Alex

Administrivia:

To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
php-gene...@lists.php.net


--
---BeginMessage---
On 16/03/2011, at 10:34 AM, Jack wrote:

 Hello All,
 
 
 
 I got some help on this yesterday, but somehow it's not consistant
 
 
 
 ?
 
 
 
 $results = 3434approd34;
 
 
 
 if(strpos($results['response'], 'APPROVED') !== false) {
 
 
 
   print declined;
 
 
 
 } else {
 
 
 
   print approved;
 
 }
 
 
 
 ?
 
 
 
 
 
 The thing is I cant get a consistant response, if it has approved anywhere
 in the results string, then it should be approved and if the results is
 APPROVD without the E it shold be delined.
 
 
 
 Am I doing something wrong.
 
 
 
 
 
 Thanks!
 
 Jack

Yes, you're doing something wrong. strpos() returns false if it can't find the 
needle. You should be using if(strpos() === false) { declined; }
---
Simon Welsh
Admin of http://simon.geek.nz/

Who said Microsoft never created a bug-free program? The blue screen never, 
ever crashes!

http://www.thinkgeek.com/brain/gimme.cgi?wid=81d520e5e

---End Message---
---BeginMessage---
 Here you're trying to access it as an array, which it's not, so the
'response'
 key doesn't exist.  In addition, you're looking for UPPER-CASE, whereas
that's
 not the case in your example variable.
 Finally, you're checking to make sure that the string IS INDEED found, but
 then printing that it was declined (!== false).  Instead, you may
 want:
 
 ?php
 
 $results['response'] = '3434approd34';
 
 if (stripos($results['response'],'APPROVED') !== false) {
 // It's been found
 } else {
 // Oh, crap.
 }
 
 ?

maybe I should do this some other way because I'm getting false positives.

I was using if(strpos($results['response'], 'APPROVED') !== false) {
And its found if the value of $results = 3434APPROVED34 and it also is
found if its $results = 3434APPOVED34, so this may not be the best way to
accomplish this.

---End Message---
---BeginMessage---
On 16 March 2011 00:25, Jack jacklistm...@gmail.com wrote:
     Here you're trying to access it as an array, which it's not, so the
 'response'
 key doesn't exist.  In addition, you're looking for UPPER-CASE, whereas
 that's
 not the case in your example variable.
 Finally, you're checking to make sure that the string IS INDEED found, but
 then printing that it was declined (!== false).  Instead, you may
 want:

 ?php

 $results['response'] = '3434approd34';

 if (stripos($results['response'],'APPROVED') !== false) {
     // It's been found
 } else {
     // Oh, crap.
 }

 ?

 maybe I should do this some other way because I'm getting false positives.

 I was using if(strpos($results['response'], 'APPROVED') !== false) {
 And its found if the value of $results = 3434APPROVED34 and it also is
 found if its $results = 3434APPOVED34, so this may not be the best way to
 accomplish this.


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



Can you create a small list of actual values and their results.

What version of PHP are you using?



-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY
---End Message---
---BeginMessage---
I'm not sure as to why strpos does what it does here, at least its not 
immediately obvious, but, a solution to this would be to use a regular 
expression search, it would be more exact, it has never failed me, and it will 
be faster; I recall reading that preg functions were faster at then str ones, 
though I can't recall where...
-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

Richard Quadling rquadl...@gmail.com wrote:

On 16 March 2011 00:25, Jack jacklistm...@gmail.com wrote:  Here you're 
trying to access it as an array, which it's not, so the  'response'  key 
doesn't exist.  In addition, you're looking for UPPER-CASE, whereas  that's  
not the case in your example variable.  Finally, you're checking to make sure 
that the string IS INDEED found, but  then printing that it was declined (!== 
false).  Instead, you may  want:   ?php   $results['response'] = 
'3434approd34';   if (stripos($results['response'],'APPROVED') !== false) { 
 // It's been found  } else {  // Oh, crap.  }   ?   
maybe I should do this some other way because I'm getting false positives.   
I was using if(strpos($results['response'], 'APPROVED') !== false) {  And its 
found if the value of $results = 3434APPROVED34 and it also is  found if its 
$results = 3434APPOVED34, so this may not be the best 

php-general Digest 17 Mar 2011 02:06:27 -0000 Issue 7230

2011-03-16 Thread php-general-digest-help

php-general Digest 17 Mar 2011 02:06:27 - Issue 7230

Topics (messages 311885 through 311893):

Re: Deleting elements from the middle of an array
311885 by: Tom Barrett
311886 by: Marc Guay

MySQL Unbuffered Query Behavior Change
311887 by: Nicholas Williams

Array of Error Codes: Key/Values
311888 by: Brendan_Crowley.DellTeam.com

[Semi-OT] Request for help: Squirrelmail, PHP and RTL-Languages
311889 by: Michelle Konzack
311890 by: Dotan Cohen
311891 by: Michelle Konzack
311892 by: Michelle Konzack

PHP4 vs PHP5 overrides
311893 by: Tom Robinson

Administrivia:

To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
php-gene...@lists.php.net


--
---BeginMessage---
http://en.wikipedia.org/wiki/Two_Little_Dickie_Birds
---End Message---
---BeginMessage---
I copied this thread to some co-workers with the subject line Be glad
that you're not programmers.

Is it Friday yet?

Marc
---End Message---
---BeginMessage---
I was previously on PHP 5.1.6 and was using the following code:

$dbr = mysql_unbuffered_query($query, $this-con);

while($row = mysql_fetch_array($dbr, $assoc ? MYSQL_ASSOC : MYSQL_NUM))
$this-result[] = $row;

$this-rows = mysql_num_rows($dbr);

It worked properly. The documentation at
http://www.php.net/manual/en/function.mysql-num-rows.php indicates
that mysql_num_rows won't return the correct result on unbuffered
queries until all of the rows had been fetched, but since I was
looping through and fetching all rows with mysql_fetch_array, it
worked properly and wasn't a problem.

I've upgraded to PHP 5.3.5 and now mysql_num_rows always returns 0. I
am fetching all rows before calling mysql_num_rows, just like the
documentation says to do, so mysql_num_rows should return the correct
result. Why is it not? Is the documentation wrong now (should it have
been updated to say that mysql_num_rows now NEVER works with
unbuffered queries instead of saying you have to fetch all rows
first)? Is there a bug in PHP? Or am I doing something wrong and it
just coincidentally worked before?

Thanks,

Nick
---End Message---
---BeginMessage---
Hi,

I'm new to php and i'm looking to setup an array (or what work best) of codes 
and corresponding error strings, for example (pseudo code):
ERROR_CODES = array('-1' = 'Error opening file', '-2' = 'General File IO 
Error', '-3' = 'Database connection error');

Access these string values using the key codes (negative key values) to 
formulate a SoapFault, e.g.:
throw new SoapFault('-1', ERROR_CODES[-1], 'actor', 'detail', 'name', 'header');

How best to implement this in php?

Thanks,
Brendan
---End Message---
---BeginMessage---
Hello,

I am wotking in an environent where it is required to  support  LTR  and
RTL languages at once. My own website support this but with squirrelmail
there is a problem.

Is there an Iranien, Israelian or Arabic Programmer which can  help  out
to get RTL support in the Squirrelmail interface including the New  Mail
form?

Thanks, Greetings and nice Day/Evening
Michelle Konzack

-- 
# Debian GNU/Linux Consultant ##
   Development of Intranet and Embedded Systems with Debian GNU/Linux

itsystems@tdnet France EURL   itsystems@tdnet UG (limited liability)
Owner Michelle KonzackOwner Michelle Konzack

Apt. 917 (homeoffice)
50, rue de Soultz Kinzigstraße 17
67100 Strasbourg/France   77694 Kehl/Germany
Tel: +33-6-61925193 mobil Tel: +49-177-9351947 mobil
Tel: +33-9-52705884 fix

http://www.itsystems.tamay-dogan.net/  http://www.flexray4linux.org/
http://www.debian.tamay-dogan.net/ http://www.can4linux.org/

Jabber linux4miche...@jabber.ccc.de

Linux-User #280138 with the Linux Counter, http://counter.li.org/


signature.pgp
Description: Digital signature
---End Message---
---BeginMessage---
On Wed, Mar 16, 2011 at 21:59, Michelle Konzack
linux4miche...@tamay-dogan.net wrote:
 Hello,

 I am wotking in an environent where it is required to  support  LTR  and
 RTL languages at once. My own website support this but with squirrelmail
 there is a problem.

 Is there an Iranien, Israelian or Arabic Programmer which can  help  out
 to get RTL support in the Squirrelmail interface including the New  Mail
 form?

 Thanks, Greetings and nice Day/Evening
    Michelle Konzack


What exactly is the problem? I have an associate using SquirrelMail in
Hebrew, it even has a Hebrew interface. Are you getting directional
display issues? Gibberish?


-- 
Dotan Cohen

http://gibberish.co.il
http://what-is-what.com
---End Message---
---BeginMessage---
Shalom Dotan,

thanks for your VERY fast answer.

Am 2011-03-16 22:39:43, hacktest Du folgendes herunter:
 What 

Re: [PHP] String eval assistance

2011-03-16 Thread Richard Quadling
On 16 March 2011 00:25, Jack jacklistm...@gmail.com wrote:
     Here you're trying to access it as an array, which it's not, so the
 'response'
 key doesn't exist.  In addition, you're looking for UPPER-CASE, whereas
 that's
 not the case in your example variable.
 Finally, you're checking to make sure that the string IS INDEED found, but
 then printing that it was declined (!== false).  Instead, you may
 want:

 ?php

 $results['response'] = '3434approd34';

 if (stripos($results['response'],'APPROVED') !== false) {
     // It's been found
 } else {
     // Oh, crap.
 }

 ?

 maybe I should do this some other way because I'm getting false positives.

 I was using if(strpos($results['response'], 'APPROVED') !== false) {
 And its found if the value of $results = 3434APPROVED34 and it also is
 found if its $results = 3434APPOVED34, so this may not be the best way to
 accomplish this.


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



Can you create a small list of actual values and their results.

What version of PHP are you using?



-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] String eval assistance

2011-03-16 Thread Alex
I'm not sure as to why strpos does what it does here, at least its not 
immediately obvious, but, a solution to this would be to use a regular 
expression search, it would be more exact, it has never failed me, and it will 
be faster; I recall reading that preg functions were faster at then str ones, 
though I can't recall where...
-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

Richard Quadling rquadl...@gmail.com wrote:

On 16 March 2011 00:25, Jack jacklistm...@gmail.com wrote:  Here you're 
trying to access it as an array, which it's not, so the  'response'  key 
doesn't exist.  In addition, you're looking for UPPER-CASE, whereas  that's  
not the case in your example variable.  Finally, you're checking to make sure 
that the string IS INDEED found, but  then printing that it was declined (!== 
false).  Instead, you may  want:   ?php   $results['response'] = 
'3434approd34';   if (stripos($results['response'],'APPROVED') !== false) { 
 // It's been found  } else {  // Oh, crap.  }   ?   
maybe I should do this some other way because I'm getting false positives.   
I was using if(strpos($results['response'], 'APPROVED') !== false) {  And its 
found if the value of $results = 3434APPROVED34 and it also is  found if its 
$results = 3434APPOVED34, so this may not be the best way to  accomplish 
this.--  PHP General Mailing List
(http://www.php.net/)  To unsubscribe, visit: http://www.php.net/unsub.php   
Can you create a small list of actual values and their results. What version of 
PHP are you using? -- Richard Quadling Twitter : EE : Zend @RQuadling : 
e-e.com/M_248814.html : bit.ly/9O8vFY -- PHP General Mailing List 
(http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php 



Re: [PHP] Deleting elements from the middle of an array

2011-03-16 Thread Tom Barrett
http://en.wikipedia.org/wiki/Two_Little_Dickie_Birds


Re: [PHP] Deleting elements from the middle of an array

2011-03-16 Thread Marc Guay
I copied this thread to some co-workers with the subject line Be glad
that you're not programmers.

Is it Friday yet?

Marc

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] MySQL Unbuffered Query Behavior Change

2011-03-16 Thread Nicholas Williams
I was previously on PHP 5.1.6 and was using the following code:

$dbr = mysql_unbuffered_query($query, $this-con);

while($row = mysql_fetch_array($dbr, $assoc ? MYSQL_ASSOC : MYSQL_NUM))
$this-result[] = $row;

$this-rows = mysql_num_rows($dbr);

It worked properly. The documentation at
http://www.php.net/manual/en/function.mysql-num-rows.php indicates
that mysql_num_rows won't return the correct result on unbuffered
queries until all of the rows had been fetched, but since I was
looping through and fetching all rows with mysql_fetch_array, it
worked properly and wasn't a problem.

I've upgraded to PHP 5.3.5 and now mysql_num_rows always returns 0. I
am fetching all rows before calling mysql_num_rows, just like the
documentation says to do, so mysql_num_rows should return the correct
result. Why is it not? Is the documentation wrong now (should it have
been updated to say that mysql_num_rows now NEVER works with
unbuffered queries instead of saying you have to fetch all rows
first)? Is there a bug in PHP? Or am I doing something wrong and it
just coincidentally worked before?

Thanks,

Nick

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Array of Error Codes: Key/Values

2011-03-16 Thread Brendan_Crowley
Hi,

I'm new to php and i'm looking to setup an array (or what work best) of codes 
and corresponding error strings, for example (pseudo code):
ERROR_CODES = array('-1' = 'Error opening file', '-2' = 'General File IO 
Error', '-3' = 'Database connection error');

Access these string values using the key codes (negative key values) to 
formulate a SoapFault, e.g.:
throw new SoapFault('-1', ERROR_CODES[-1], 'actor', 'detail', 'name', 'header');

How best to implement this in php?

Thanks,
Brendan


[PHP] [Semi-OT] Request for help: Squirrelmail, PHP and RTL-Languages

2011-03-16 Thread Michelle Konzack
Hello,

I am wotking in an environent where it is required to  support  LTR  and
RTL languages at once. My own website support this but with squirrelmail
there is a problem.

Is there an Iranien, Israelian or Arabic Programmer which can  help  out
to get RTL support in the Squirrelmail interface including the New  Mail
form?

Thanks, Greetings and nice Day/Evening
Michelle Konzack

-- 
# Debian GNU/Linux Consultant ##
   Development of Intranet and Embedded Systems with Debian GNU/Linux

itsystems@tdnet France EURL   itsystems@tdnet UG (limited liability)
Owner Michelle KonzackOwner Michelle Konzack

Apt. 917 (homeoffice)
50, rue de Soultz Kinzigstraße 17
67100 Strasbourg/France   77694 Kehl/Germany
Tel: +33-6-61925193 mobil Tel: +49-177-9351947 mobil
Tel: +33-9-52705884 fix

http://www.itsystems.tamay-dogan.net/  http://www.flexray4linux.org/
http://www.debian.tamay-dogan.net/ http://www.can4linux.org/

Jabber linux4miche...@jabber.ccc.de

Linux-User #280138 with the Linux Counter, http://counter.li.org/


signature.pgp
Description: Digital signature


Re: [PHP] [Semi-OT] Request for help: Squirrelmail, PHP and RTL-Languages

2011-03-16 Thread Dotan Cohen
On Wed, Mar 16, 2011 at 21:59, Michelle Konzack
linux4miche...@tamay-dogan.net wrote:
 Hello,

 I am wotking in an environent where it is required to  support  LTR  and
 RTL languages at once. My own website support this but with squirrelmail
 there is a problem.

 Is there an Iranien, Israelian or Arabic Programmer which can  help  out
 to get RTL support in the Squirrelmail interface including the New  Mail
 form?

 Thanks, Greetings and nice Day/Evening
    Michelle Konzack


What exactly is the problem? I have an associate using SquirrelMail in
Hebrew, it even has a Hebrew interface. Are you getting directional
display issues? Gibberish?


-- 
Dotan Cohen

http://gibberish.co.il
http://what-is-what.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] [Semi-OT] Request for help: Squirrelmail, PHP and RTL-Languages

2011-03-16 Thread Michelle Konzack
Shalom Dotan,

thanks for your VERY fast answer.

Am 2011-03-16 22:39:43, hacktest Du folgendes herunter:
 What exactly is the problem? I have an associate using SquirrelMail in
 Hebrew, it even has a Hebrew interface. Are you getting directional
 display issues? Gibberish?

The locale on my workstation  is  set  to  de_DE.UTF8  and  the  default
charset in squirrelmail utf-8.

I can set the interface of squirrelmail to hebrew, farsi or  arabic  and
it is working RTL.

But if I have E-Mails from Al-Djasira, Jerusalem Post or Kaleme (I am on
there news lists), all text is aligned LEFT and not right.

Also it is not possibel to write E-Mails (Subject + Body) in RTL.

So what is needed, is to  get  the  Mail-View  corrected  and  then  the
New Mail input form.

And then, I need a solution if text is a mix of RTL and LTR.

Currently I am using the Squirelmail Version 1.4.21 from Debian/Squeeze
but I can update to any higher versions (1.5) since it s my own server

Thanks, Greetings and nice Day/Evening
Michelle Konzack

-- 
# Debian GNU/Linux Consultant ##
   Development of Intranet and Embedded Systems with Debian GNU/Linux

itsystems@tdnet France EURL   itsystems@tdnet UG (limited liability)
Owner Michelle KonzackOwner Michelle Konzack

Apt. 917 (homeoffice)
50, rue de Soultz Kinzigstraße 17
67100 Strasbourg/France   77694 Kehl/Germany
Tel: +33-6-61925193 mobil Tel: +49-177-9351947 mobil
Tel: +33-9-52705884 fix

http://www.itsystems.tamay-dogan.net/  http://www.flexray4linux.org/
http://www.debian.tamay-dogan.net/ http://www.can4linux.org/

Jabber linux4miche...@jabber.ccc.de
ICQ#328449886

Linux-User #280138 with the Linux Counter, http://counter.li.org/


signature.pgp
Description: Digital signature


[PHP] Re: [Semi-OT] Request for help: Squirrelmail, PHP and RTL-Languages

2011-03-16 Thread Michelle Konzack
Again...

Here is a screenshoot (squirrelmail 1.4.21 from Debian/Squeeze): 

http://vserver04.tamay-dogan.net/squirrelmail/20110316221617_squirrelmail_prersian_error.jpg

which is set to Persian interface and even Firefox is  set  to  prefered
Language fa_IR and it does not work here (in 1.5.x persia is shown)

Also there are problems in the From: and latin text should  not  aligned
right, exspecialy if the entired mail is in latin characters

Thanks, Greetings and nice Day/Evening
Michelle Konzack

-- 
# Debian GNU/Linux Consultant ##
   Development of Intranet and Embedded Systems with Debian GNU/Linux

itsystems@tdnet France EURL   itsystems@tdnet UG (limited liability)
Owner Michelle KonzackOwner Michelle Konzack

Apt. 917 (homeoffice)
50, rue de Soultz Kinzigstraße 17
67100 Strasbourg/France   77694 Kehl/Germany
Tel: +33-6-61925193 mobil Tel: +49-177-9351947 mobil
Tel: +33-9-52705884 fix

http://www.itsystems.tamay-dogan.net/  http://www.flexray4linux.org/
http://www.debian.tamay-dogan.net/ http://www.can4linux.org/

Jabber linux4miche...@jabber.ccc.de
ICQ#328449886

Linux-User #280138 with the Linux Counter, http://counter.li.org/


signature.pgp
Description: Digital signature


[PHP] PHP4 vs PHP5 overrides

2011-03-16 Thread Tom Robinson
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


Re: [PHP] PHP4 vs PHP5 overrides

2011-03-16 Thread Tom Robinson
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


Re: [PHP] PHP4 vs PHP5 overrides

2011-03-16 Thread Tom Robinson
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


[PHP] PHP session replication

2011-03-16 Thread Alessandro Ferrucci
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