From:             wilhelm dot hagg at web dot de
Operating system: Linux, Kernel 2.4.25
PHP version:      4.3.4
PHP Bug Type:     Mail related
Bug description:  php scipt crashes

Description:
------------
While sending emails with the mail() function in a loop, php  stops
immediately (crashes ??). Unfortuately, this happens not every time, only
some times. There is no message in the log files, it just stops.

Reproduce code:
---------------
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">

<html> <head> <body>

<?php

$db_connection = mysql_pconnect("localhost","wwwrun","abc");

mysql_select_db("cdzirkel",$db_connection);



  $offer_text="CD's   (http://cd.cdzirkel.de)\n \n deaf dumb blind\n
clawfinger\n \n live aus Rödelheim\n Rödelheim Hartreim Projekt\n \n 4
gewinnt\n Die fantastischen Vier\n \n soundtrack\n blade 2\n \n Betty\n
Helmet\n \n ready an' willing\n whitesnake\n \n use your brain\n
clawfinger\n \n wie Mutter und Tochter\n Badesalz\n \n Under the pink\n
Tori Amos\n \n dark side of the moon\n Pink Floyd\n \n Talk On Corners\n
The Corrs\n \n Nowhere...fast\n Fury in the slaughterhouse\n \n Jahmekya\n
Ziggy Marley\n \n smash\n offspring\n \n Greatest hits\n Whitesnake\n \n
Das ist nicht die ganze Wahrheit\n Die Ärzte\n \n Herzeleid\n Rammstein\n
\n digimortal\n fear factory\n \n in concert with the London symphony
orchestra\n deep purple\n \n time to move\n h-blockx\n \n america's least
wanted\n ugly kid joe\n \n without you I'm nothing\n placebo\n \n Maxi's
(http://maxi.cdzirkel.de) \n \n DVD's  (http://dvd.cdzirkel.de) \n \n
daredevil\n \n \n blade2 ungekürzt\n \n \n blade\n \n \n the cell (mit
J.Lo)\n \n \n matrix 1\n \n \n im Bann des Psychopathen\n \n \n Bücher
(http://buch.cdzirkel.de) \n \n Werner - Oder Was?\n Brösel\n \n";        
                                                                          
                                                           $uqid =
mysqlquery("SELECT * FROM user");                                      
while( $ures = mysql_fetch_array($uqid) ) {                               
       $iid = $ures[id];                                                  
            $email = $ures[email];                                        
                 $name = $ures[name];                                     
                      $familyname = $ures[familyname];                    
                                                                          
                                mail($email, "Neue Angebote bei CdZirkel",
"Hallo $name $familyname ! \n\nBrandneu: Hier sind die neuesten Angebote
bei CdZirkel.de. \n\n$offer_text \n\nDein CdZirkel Team \n\nHier kannst Du
diesen Service abbestellen:\n 
http://cdzirkel.de/index.php?Update=1&iid=$iid \n(Oder in Deinen
Einstellungen unter Profil)","From: [EMAIL PROTECTED]");                  
                                                                          
                                           echo "$email <br>";            
                                              }                           
                                                   echo "DONE";           
                                                      ?>                  
                                                           </body> </html>

Expected result:
----------------
Should send an email to each user in db-table user and print a line with
the email address on the result http-page.



The code requires a mysqldatabase cdzirkel (passw. abc) that holds a table
with all users:



CREATE TABLE user (

  id int(1) unsigned NOT NULL auto_increment,

  email varchar(100) NOT NULL default '',

  password varchar(100) default '',

  name varchar(100) default '',

  familyname varchar(100) default '',

  PRIMARY KEY  (id)

) TYPE=MyISAM;



Currently there are roughly 300 users in the database.

Actual result:
--------------
It stops (sometimes) in between.



I also checked the return code of the mail function. Whenever it returned
the code was o.k. So i think it hangs or it crashes.

-- 
Edit bug report at http://bugs.php.net/?id=27371&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=27371&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=27371&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=27371&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=27371&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=27371&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=27371&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=27371&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=27371&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=27371&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=27371&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=27371&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=27371&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27371&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=27371&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=27371&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=27371&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=27371&r=float

Reply via email to