php-general Digest 30 Nov 2005 01:53:23 -0000 Issue 3823

Topics (messages 226583 through 226611):

preg_slipt
        226583 by: Sichta Daniel
        226584 by: David Grant
        226585 by: David Precious
        226586 by: David Grant
        226587 by: David Precious

exclude part of text
        226588 by: 021
        226589 by: David Grant
        226590 by: 021
        226591 by: David Grant

when to enter submitted in mysql?
        226592 by: afan.afan.net
        226594 by: Jim Moseby
        226595 by: David Grant
        226597 by: Todd Cary
        226598 by: afan.afan.net

Re: Two version of PHP in single server
        226593 by: Ben Litton

Re: Problem with Frames and Sessions
        226596 by: Brent Baisley

Howto search in SQL for a specific character?
        226599 by: Gustav Wiberg
        226600 by: Jay Blanchard
        226601 by: Gustav Wiberg
        226602 by: Gustav Wiberg
        226603 by: Jay Blanchard
        226604 by: tg-php.gryffyndevelopment.com
        226605 by: Stephen Johnson

Re: Howto search in SQL for a specific character? SOLVED
        226606 by: Jay Blanchard

migrating from http to https...
        226607 by: ganu

Schroedinger's Bug - may require exorcism...
        226608 by: Adam Atlas
        226609 by: Robert Cummings
        226611 by: Robert Cummings

Re: PhpMailer vs Pear:Mail
        226610 by: Max Schwanekamp

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:
        php-general@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
Hi all !!!
 
I have string like this "1234567890"
 
I need to split this into array like this
a[0] = "12"
a[1] = "34" 
a[2] = "56" 
a[3] = "78" 
a[4] = "90"
 
I know that for this is preg_split, but I don't know the string patern
for split.
Thank you in advance !!
 

Dan

 

--- End Message ---
--- Begin Message ---
Hi Dan,

Try:

$a = split("\n", chunk_split('1234567890', 2), 5);

php.net/chunk_split
php.net/split

Cheers,

David Grant

Sichta Daniel wrote:
> Hi all !!!
>  
> I have string like this "1234567890"
>  
> I need to split this into array like this
> a[0] = "12"
> a[1] = "34" 
> a[2] = "56" 
> a[3] = "78" 
> a[4] = "90"
>  
> I know that for this is preg_split, but I don't know the string patern
> for split.
> Thank you in advance !!
>  
> 
> Dan
> 
>  
> 

--- End Message ---
--- Begin Message ---
On 29/11/05, Sichta Daniel <[EMAIL PROTECTED]> wrote:
> Hi all !!!
>
> I have string like this "1234567890"
>
> I need to split this into array like this
> a[0] = "12"
> a[1] = "34"
> a[2] = "56"
> a[3] = "78"
> a[4] = "90"
>
> I know that for this is preg_split, but I don't know the string patern
> for split.
> Thank you in advance !!


No, preg_split would be overkill here, you want to take a look at str_split:

http://uk.php.net/manual/en/function.str-split.php

To achieve what you described above:

<?php
$str = '1234567890';
$a = str_split($str, 2);
?>

Simple eh?  Does exactly what it says on the tin.

:-)

Cheers

David Precious
http://www.preshweb.co.uk/

--- End Message ---
--- Begin Message ---
There is an error in this code.  It should in fact read:

$a = split("\r\n", chunk_split('1234567890', 2), 5);

OR

$a = split("\n", chunk_split('1234567890', 2, "\n"), 5);

David Grant wrote:
> Hi Dan,
> 
> Try:
> 
> $a = split("\n", chunk_split('1234567890', 2), 5);
> 
> php.net/chunk_split
> php.net/split
> 
> Cheers,
> 
> David Grant
> 
> Sichta Daniel wrote:
>> Hi all !!!
>>  
>> I have string like this "1234567890"
>>  
>> I need to split this into array like this
>> a[0] = "12"
>> a[1] = "34" 
>> a[2] = "56" 
>> a[3] = "78" 
>> a[4] = "90"
>>  
>> I know that for this is preg_split, but I don't know the string patern
>> for split.
>> Thank you in advance !!
>>  
>>
>> Dan
>>
>>  
>>
> 

--- End Message ---
--- Begin Message ---
> > No, preg_split would be overkill here, you want to take a look at
> > str_split:

> Sorry I forgott to tell that I'm not using PHP 5.x :-)

Ahhh, right - my answer won't be of much use to you then :-)

In that case, David Grant's suggestion of using chunk_split() in
combination with split() is probably your best option then!

Cheers

Dave P

--- End Message ---
--- Begin Message ---
Hi,
need some help with this one

i made a page which is reading the last line from a log file. the log is formatted like this:

text1 > MAIN TEXT *text2

i need to get only the MAIN TEXT part, i don't need the text1 > and *text2

i'm using this code

<?php
$lines = file('sometext.txt');
for ($i = 0, $j = count($lines); $i <=1; $i++) {
print $lines[$j - $i];
}
?>

thanx

--- End Message ---
--- Begin Message ---
Hi,

021 wrote:
> <?php
> $lines = file('sometext.txt');
> for ($i = 0, $j = count($lines); $i <=1; $i++) {
> print $lines[$j - $i];
> }
> ?>

For a start, try this instead:

$lines = file('sometext.ext');
$last  = end($lines);

Secondly, do you have an example of the real log file?

Cheers,

David Grant
-- 
David Grant
http://www.grant.org.uk/

--- End Message ---
--- Begin Message ---
the log file is from a radio playlist:

TIME > ARTIST - TITLE *SONG_CATEGORY

for example

17:12:26 > THE CURE - ALT.END *NEW

the values before > and after * are changing, hope there's a simple solution for this

thanx

--- End Message ---
--- Begin Message ---
Please try:

preg_match('/^[^\>]*\>(.*)\*.*$/', $line, $matches);

021 wrote:
> the log file is from a radio playlist:
> 
> TIME > ARTIST - TITLE *SONG_CATEGORY
> 
> for example
> 
> 17:12:26 > THE CURE - ALT.END *NEW
> 
> the values before > and after * are changing, hope there's a simple
> solution for this
> 
> thanx
> 


-- 
David Grant
http://www.grant.org.uk/

--- End Message ---
--- Begin Message ---
Hi to all!
I have form made on 4 pages (by groups of questions). Right now my code works this way: once somebody submit the first page of the form his/her submitted info is entered in database with status=temp. I store the ID (insert_id()) in session and then every time visitor submit the next page I do update of the current record using ID. But, I heard once that "the best" solution is store all entered info in session (array) and insert all info at once.
Or, instead in sessions, move submitted info with serialized array.

Opinions?

Thanks for help.

-afan

--- End Message ---
--- Begin Message ---
> Hi to all!
> I have form made on 4 pages (by groups of questions). Right 
> now my code 
> works this way: once somebody submit the first page of the 
> form his/her 
> submitted info is entered in database with status=temp. I 
> store the ID 
> (insert_id()) in session and then every time visitor submit the next 
> page I do update of the current record using ID.
> But, I heard once that "the best" solution is store all 
> entered info in 
> session (array) and insert all info at once.
> Or, instead in sessions, move submitted info with serialized array.
> 
> Opinions?
> 

The upside to storing the data in session variables is that you make only ne
DB call at the end, saving processor, bandwidth, etc.  The downside is, that
if your user cannot complete the form, his data is lost and he has to start
all over again.  

Which one is best depends greatly on your environment and situation.  For
instance, if you have 1000 users onlin simultaneously filling out forms, and
the forms are simple, you would probably opt to use session variables and
make one DB call.  If you only have one or two online and the forms are 1000
questions long, your would want to write each page as it is completed.

JM

--- End Message ---
--- Begin Message ---
Personally, I'd keep it all in the session and write at the end, but
this approach has at least two drawbacks:

1. The user cannot complete the process at a later point.
2. You cannot conduct analysis of part-completed data.

Cheers,

David Grant

[EMAIL PROTECTED] wrote:
> Hi to all!
> I have form made on 4 pages (by groups of questions). Right now my code
> works this way: once somebody submit the first page of the form his/her
> submitted info is entered in database with status=temp. I store the ID
> (insert_id()) in session and then every time visitor submit the next
> page I do update of the current record using ID.
> But, I heard once that "the best" solution is store all entered info in
> session (array) and insert all info at once.
> Or, instead in sessions, move submitted info with serialized array.
> 
> Opinions?
> 
> Thanks for help.
> 
> -afan
> 


-- 
David Grant
http://www.grant.org.uk/

--- End Message ---
--- Begin Message --- I track my sessions in the MySQL database in the session table. There is a field, ExpireTime, so the table is self purging.

For the pages, I place them into a table, tmp_data, that has a sessionID field and ExpireTime. When all pages are completed, the data is inserted into the data table.

If the user has cookies turned off, s/he cannot pickup where s/he left off since the sessionID was not stored. Other than that it works well where my client is processing many thousands of Class Action lawsuit claims.

Actually, I use Interbase (Firebird) for this type of application.

Todd

[EMAIL PROTECTED] wrote:
Hi to all!
I have form made on 4 pages (by groups of questions). Right now my code works this way: once somebody submit the first page of the form his/her submitted info is entered in database with status=temp. I store the ID (insert_id()) in session and then every time visitor submit the next page I do update of the current record using ID. But, I heard once that "the best" solution is store all entered info in session (array) and insert all info at once.
Or, instead in sessions, move submitted info with serialized array.

Opinions?

Thanks for help.

-afan

--- End Message ---
--- Begin Message ---
Ok. I got a picture. :)

Thanks to everybody!

-afan



Todd Cary wrote:

I track my sessions in the MySQL database in the session table. There is a field, ExpireTime, so the table is self purging.

For the pages, I place them into a table, tmp_data, that has a sessionID field and ExpireTime. When all pages are completed, the data is inserted into the data table.

If the user has cookies turned off, s/he cannot pickup where s/he left off since the sessionID was not stored. Other than that it works well where my client is processing many thousands of Class Action lawsuit claims.

Actually, I use Interbase (Firebird) for this type of application.

Todd

[EMAIL PROTECTED] wrote:

Hi to all!
I have form made on 4 pages (by groups of questions). Right now my code works this way: once somebody submit the first page of the form his/her submitted info is entered in database with status=temp. I store the ID (insert_id()) in session and then every time visitor submit the next page I do update of the current record using ID. But, I heard once that "the best" solution is store all entered info in session (array) and insert all info at once.
Or, instead in sessions, move submitted info with serialized array.

Opinions?

Thanks for help.

-afan



--- End Message ---
--- Begin Message --- You can do this if you register a different add-type. Say php5 for the php 5.1 pages and just php for the regular ones. You may (I can't recall) have to install one as mod_php and the other as a cgi. There are surely guides on the internet to help you get both running simultaneously.

On Mon, 28 Nov 2005 01:37:02 -0500, "J.F.Kishor" <[EMAIL PROTECTED]> wrote:

Hi,

        I have  a query, can we run  two versions of PHP  in linux 7.2
        server.

        I want  to use PHP 4.x  for one application and  PHP 5.1.0 for
        another application in the same server.

        Do  I need to  do some  configuration changes  to set  the php
        path. To  look up different  versions based on the  request of
        the application.

        
        
Regards,
                                                        - JFK
kishor
Nilgiri Networks



--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

--- End Message ---
--- Begin Message --- Frames are just nested windows, the server can't tell the difference between a page requested from a frame or a separate window and you should treat them as such. So if your frame was created before a session was created, it's not part of the session.


On Nov 28, 2005, at 6:52 PM, Shaun wrote:

Hi,

I have a frameset with a left column and a main column. I have a login
script with a form in the left column. When I log in I get a menu in the left column which targets to the main column. My problem is that when I click on links in the left column nothing appears in the main frame, however if I refresh the browser then the links work. I am sure this must be a PHP session problem but I don't have any experience using frames, does anyone
have suggestions as to what the problem might be?

Thanks for your advice.

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




--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search & Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577

--- End Message ---
--- Begin Message ---
Hi there!

in PHP i Write..


$v1 = chr(39); //39 is apostrofe


$sql = "SELECT nameOfPedigree FROM tbpedigrees WHERE SUBSTR(nameOfPedigree,0,1) = $v1";

Why doesn't this work?

I want the sql to select all nameOfPedigree - fields where the first character is apostrofe (')

/G
http://www.varupiraten.se/

--- End Message ---
--- Begin Message ---
[snip]
$v1 = chr(39); //39 is apostrofe

$sql = "SELECT nameOfPedigree FROM tbpedigrees WHERE 
SUBSTR(nameOfPedigree,0,1) = $v1";

Why doesn't this work?
[/snip]

Probably because the character set is misinterpreted. What happens when you
echo $v1? Try

$sql = "SELECT nameOfPedigree FROM tbpedigrees WHERE 
SUBSTR(nameOfPedigree,0,1) = ''' ";

--- End Message ---
--- Begin Message ---
Hi

I'm sorry but this didn't work either? If I replaced the ' with for example an a it worked

/G

----- Original Message ----- From: "Stephen Johnson" <[EMAIL PROTECTED]> To: "Gustav Wiberg" <[EMAIL PROTECTED]>; "PHP General" <php-general@lists.php.net>
Sent: Tuesday, November 29, 2005 10:00 PM
Subject: Re: [PHP] Howto search in SQL for a specific character?


Try this :

$sql = "SELECT nameOfPedigree FROM tbpedigrees WHERE  nameOfPedigree like
"'%";

The % is a wildcard and will give you the results you want.


<?php
/*

Stephen Johnson c | eh
The Lone Coder

http://www.ouradoptionblog.com
Join our journey of adoption

http://www.thelonecoder.com
[EMAIL PROTECTED]

continuing the struggle against bad code

*/
?>


From: Gustav Wiberg <[EMAIL PROTECTED]>
Organization: Gustav Wiberg
Reply-To: Gustav Wiberg <[EMAIL PROTECTED]>
Date: Tue, 29 Nov 2005 21:55:27 +0100
To: PHP General <php-general@lists.php.net>
Subject: [PHP] Howto search in SQL for a specific character?

Hi there!

in PHP i Write..


$v1 = chr(39); //39 is apostrofe


$sql = "SELECT nameOfPedigree FROM tbpedigrees WHERE
SUBSTR(nameOfPedigree,0,1) = $v1";

Why doesn't this work?

I want the sql to select all nameOfPedigree - fields where the first
character is apostrofe (')

/G
http://www.varupiraten.se/

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





--- End Message ---
--- Begin Message ---
Hi there!

This didn't work. Ok, mysql 4.x don't have support for the command. Exuse my.. didn't realize that before... I have to do this another way around... :-)

/G

----- Original Message ----- From: "Jay Blanchard" <[EMAIL PROTECTED]> To: "'Gustav Wiberg'" <[EMAIL PROTECTED]>; "PHP General" <php-general@lists.php.net>
Sent: Tuesday, November 29, 2005 9:59 PM
Subject: RE: [PHP] Howto search in SQL for a specific character?


[snip]
$v1 = chr(39); //39 is apostrofe

$sql = "SELECT nameOfPedigree FROM tbpedigrees WHERE
SUBSTR(nameOfPedigree,0,1) = $v1";

Why doesn't this work?
[/snip]

Probably because the character set is misinterpreted. What happens when you
echo $v1? Try

$sql = "SELECT nameOfPedigree FROM tbpedigrees WHERE
SUBSTR(nameOfPedigree,0,1) = ''' ";

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



--- End Message ---
--- Begin Message ---
[snip]
This didn't work. Ok, mysql 4.x don't have support for the command. Exuse 
my.. didn't realize that before... I have to do this another way around... 
[/snip]

Doesn;t have support for what command?

--- End Message ---
--- Begin Message ---
Probably because the apostrophe aka single quote is used the same way it and 
the double quotes (") are used in PHP, as a string delimiter.

What you're ending up with is:

SELECT nameOfPedigree FROM tbpedigrees WHERE SUBSTR(nameOfPedigree,0,1) = '

What you'd want is something more like:

SELECT nameOfPedigree FROM tbpedigrees WHERE SUBSTR(nameOfPedigree,0,1) = "'"

So maybe try this:

$sql = "SELECT nameOfPedigree FROM tbpedigrees WHERE SUBSTR(nameOfPedigree,0,1) 
= \"$v1\"";

See if that works any better.

-TG





= = = Original message = = =

Hi there!

in PHP i Write..


$v1 = chr(39); //39 is apostrofe


$sql = "SELECT nameOfPedigree FROM tbpedigrees WHERE 
SUBSTR(nameOfPedigree,0,1) = $v1";

Why doesn't this work?

I want the sql to select all nameOfPedigree - fields where the first 
character is apostrofe (')

/G
http://www.varupiraten.se/


___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

--- End Message ---
--- Begin Message ---
Try this : 

$sql = "SELECT nameOfPedigree FROM tbpedigrees WHERE  nameOfPedigree like
"'%";

The % is a wildcard and will give you the results you want.


<?php
/*

Stephen Johnson c | eh
The Lone Coder

http://www.ouradoptionblog.com
Join our journey of adoption

http://www.thelonecoder.com
[EMAIL PROTECTED]

continuing the struggle against bad code

*/ 
?>


> From: Gustav Wiberg <[EMAIL PROTECTED]>
> Organization: Gustav Wiberg
> Reply-To: Gustav Wiberg <[EMAIL PROTECTED]>
> Date: Tue, 29 Nov 2005 21:55:27 +0100
> To: PHP General <php-general@lists.php.net>
> Subject: [PHP] Howto search in SQL for a specific character?
> 
> Hi there!
> 
> in PHP i Write..
> 
> 
> $v1 = chr(39); //39 is apostrofe
> 
> 
> $sql = "SELECT nameOfPedigree FROM tbpedigrees WHERE
> SUBSTR(nameOfPedigree,0,1) = $v1";
> 
> Why doesn't this work?
> 
> I want the sql to select all nameOfPedigree - fields where the first
> character is apostrofe (')
> 
> /G
> http://www.varupiraten.se/
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

--- End Message ---
--- Begin Message ---
FW to the list....even if it is top posting

-----Original Message-----
From: Gustav Wiberg [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 29, 2005 3:49 PM
To: Jay Blanchard
Subject: Re: [PHP] Howto search in SQL for a specific character?


aha... ok.. that was the fault! Thanx! :-)

/G

----- Original Message ----- 
From: "Jay Blanchard" <[EMAIL PROTECTED]>
To: "'Gustav Wiberg'" <[EMAIL PROTECTED]>; "Jay Blanchard" 
<[EMAIL PROTECTED]>
Sent: Tuesday, November 29, 2005 10:24 PM
Subject: RE: [PHP] Howto search in SQL for a specific character?


> substring is the function in MySQL
>
> http://dev.mysql.com/doc/refman/5.0/en/string-functions.html
>
> -----Original Message-----
> From: Gustav Wiberg [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, November 29, 2005 3:19 PM
> To: Jay Blanchard
> Subject: Re: [PHP] Howto search in SQL for a specific character?
>
>
> substr() ?
>
> /G
>
> ----- Original Message ----- 
> From: "Jay Blanchard" <[EMAIL PROTECTED]>
> To: "'Gustav Wiberg'" <[EMAIL PROTECTED]>; "Jay Blanchard"
> <[EMAIL PROTECTED]>; "PHP General" <php-general@lists.php.net>
> Sent: Tuesday, November 29, 2005 10:13 PM
> Subject: RE: [PHP] Howto search in SQL for a specific character?
>
>
>> [snip]
>> This didn't work. Ok, mysql 4.x don't have support for the command. Exuse
>> my.. didn't realize that before... I have to do this another way 
>> around...
>> [/snip]
>>
>> Doesn;t have support for what command?
>>
>
> 

--- End Message ---
--- Begin Message ---
Hi all ,

I have a problem , when I am migrating my data from http://www.abc.com <http://www.abc.com/> to https://www.abc.com <https://www.abc.com/> for secure login purpose. I will loose all my data which I store in my session.

if suppose I am able to do it from http to https then from https to http I am getting the problem.

any idea to do this . Else i have the option that after http to https I will close the connection and the user will again start a new session with the login/password.

any  ideas please...

--- End Message ---
--- Begin Message --- So... I have this script (being called in a perfectly typical way by PHP 4.4.1 through mod_php in Apache 2.0.55) which sometimes runs perfectly, and sometimes chooses, totally haphazardly, to seemingly run itself twice, which of course causes it to die with a fatal error after it tries to redefine some functions.

As mysterious as that is, it turns out it must be something altogether more sinister. I tried putting die() at the end of the script, on the assumption that it was for some reason executing twice, yet behold: the problem is still present, and the PHP error log still complains about constants and functions being redefined! The problem, I therefore thought, cannot be that the script is being run twice. (In retrospect, this was the most likely possibility, because the page doesn't actually output anything if it dies with this error.) So for debugging, I added a bit that logs one message to a file immediately before the die() at the end of the file, and a different message after the die(). The die() seems to be working normally, in that it only logs the first message...

But wait a second! WTF? If the PHP error log is to be believed, then the script should be dying with a fatal error before it even *gets* to that point in the script, isn't it?

And the greater WTF is the fact that, as I mentioned above, every time the page is requested, it unpredictably either does this or works flawlessly. Oh my. How do I even *begin* to debug something like this?

Thanks for any help.
-- Adam Atlas

--- End Message ---
--- Begin Message ---
On Tue, 2005-11-29 at 19:22, Adam Atlas wrote:
> So... I have this script (being called in a perfectly typical way by  
> PHP 4.4.1 through mod_php in Apache 2.0.55) which sometimes runs  
> perfectly, and sometimes chooses, totally haphazardly, to seemingly  
> run itself twice, which of course causes it to die with a fatal error  
> after it tries to redefine some functions.
> 
> As mysterious as that is, it turns out it must be something  
> altogether more sinister. I tried putting die() at the end of the  
> script, on the assumption that it was for some reason executing  
> twice, yet behold: the problem is still present, and the PHP error  
> log still complains about constants and functions being redefined!  
> The problem, I therefore thought, cannot be that the script is being  
> run twice. (In retrospect, this was the most likely possibility,  
> because the page doesn't actually output anything if it dies with  
> this error.) So for debugging, I added a bit that logs one message to  
> a file immediately before the die() at the end of the file, and a  
> different message after the die(). The die() seems to be working  
> normally, in that it only logs the first message...
> 
> But wait a second! WTF? If the PHP error log is to be believed, then  
> the script should be dying with a fatal error before it even *gets*  
> to that point in the script, isn't it?
> 
> And the greater WTF is the fact that, as I mentioned above, every  
> time the page is requested, it unpredictably either does this or  
> works flawlessly. Oh my. How do I even *begin* to debug something  
> like this?

I think you mean heisenbug...

    http://en.wikipedia.org/wiki/Heisenbug
    http://en.wikipedia.org/wiki/Schr%C3%B6dinger%27s_cat

Do a grep for dynamic includes of the file script in question.
Alternatively do a grep for files that dynamically include the script in
question. Work your way to the root.

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

--- End Message ---
--- Begin Message ---
On Tue, 2005-11-29 at 19:42, Robert Cummings wrote:
> On Tue, 2005-11-29 at 19:22, Adam Atlas wrote:
> > So... I have this script (being called in a perfectly typical way by  
> > PHP 4.4.1 through mod_php in Apache 2.0.55) which sometimes runs  
> > perfectly, and sometimes chooses, totally haphazardly, to seemingly  
> > run itself twice, which of course causes it to die with a fatal error  
> > after it tries to redefine some functions.
> > 
> > As mysterious as that is, it turns out it must be something  
> > altogether more sinister. I tried putting die() at the end of the  
> > script, on the assumption that it was for some reason executing  
> > twice, yet behold: the problem is still present, and the PHP error  
> > log still complains about constants and functions being redefined!  
> > The problem, I therefore thought, cannot be that the script is being  
> > run twice. (In retrospect, this was the most likely possibility,  
> > because the page doesn't actually output anything if it dies with  
> > this error.) So for debugging, I added a bit that logs one message to  
> > a file immediately before the die() at the end of the file, and a  
> > different message after the die(). The die() seems to be working  
> > normally, in that it only logs the first message...
> > 
> > But wait a second! WTF? If the PHP error log is to be believed, then  
> > the script should be dying with a fatal error before it even *gets*  
> > to that point in the script, isn't it?
> > 
> > And the greater WTF is the fact that, as I mentioned above, every  
> > time the page is requested, it unpredictably either does this or  
> > works flawlessly. Oh my. How do I even *begin* to debug something  
> > like this?
> 
> I think you mean heisenbug...
> 
>     http://en.wikipedia.org/wiki/Heisenbug
>     http://en.wikipedia.org/wiki/Schr%C3%B6dinger%27s_cat

Hmmm, you learn something new every day:

    http://en.wikipedia.org/wiki/Schroedinbug

But the problem you're having seems better represented as a heisenbug :)

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

--- End Message ---
--- Begin Message ---
Richard Heyes wrote:
Petr Smith wrote:
I tried all and ended with http://www.phpguru.org/static/htmlMimeMail5.html
fast, stable, usable.
A very good choice. ;-)

But but but, what *is* the advantage of one over the other? I've been a PhpMailer devotee for some time. PEAR::Mail is too spare, PhpMailer is reasonably quick and has proven quite stable (I've built a couple newsletter apps using it). What's the advantage of Richard's package vs. the Pear one (on which he is a lead dev) vs. PhpMailer?

--
Max Schwanekamp
http://www.neptunewebworks.com/

--- End Message ---

Reply via email to