ID:               24175
 Updated by:       [EMAIL PROTECTED]
 Reported By:      justinlong at strategicnetwork dot org
-Status:           Feedback
+Status:           No Feedback
 Bug Type:         Reproducible crash
 Operating System: KRUD/RedHat
 PHP Version:      4.3.2
 New Comment:

No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.




Previous Comments:
------------------------------------------------------------------------

[2003-06-18 13:20:36] [EMAIL PROTECTED]

Please provide a short, self-contained script that we can
copy'n'paste and run ourselves. Anything that uses external resources,
such as databases, is useless.


------------------------------------------------------------------------

[2003-06-13 09:28:34] justinlong at strategicnetwork dot org

On the basis of your snippy reply I presume I have not communicated
clearly the error that I am encountering. This is the only script which
causes this problem. The point where it occurs is toward the end at the
line

if (strlen($story)>512) { echo $rec->headline,"\n"; }
pg_exec($db,"UPDATE story_headline SET
story_preprocessed=$todaySystem, story='".addslashes($story)."' WHERE
storyid=".$rec->storyid);

But obviously it's not these two lines which cause the problem since
the crash does not occur on one specific entry in the database but
rather at different points in the run each time. This the only script
which crashes; I don't encounter this problem anywhere else.

------------------------------------------------------------------------

[2003-06-13 09:16:48] [EMAIL PROTECTED]

What in the 'short and _complete_ stand-alone script did you 
not understand? You must give us the exact piece of code that 
causes the crash, NOT the whole script.


------------------------------------------------------------------------

[2003-06-13 09:09:47] justinlong at strategicnetwork dot org

#!/usr/local/bin/php -q
<?

/*
        This program will take the text in "article" and identify the story to
be indexed, placing it in the "story" field
*/

$todaySystem    = mktime();
$todayJulian    = getdate($todaySystem);
$thismorning    =
mktime(0,0,0,$todayJulian[mon],$todayJulian[mday],$todayJulian[year]);
$thisweek               = mktime()-(24*60*60*intval($todayJulian['wday']));
$lastyear               = mktime(0,0,0,1,1,$todayJulian[year]-1);
$thisyear               = mktime(0,0,0,1,1,$todayJulian[year]);
$thismonth      = mktime(0,0,0,$todayJulian[mon],1,$todayJulian[year]);
$lastmonth      = mktime(0,0,0,$todayJulian[mon]-1,1,$todayJulian[year]);

$db = pg_connect ("dbname=nsm user=nobody") or die("The Network for
Strategic Missions is presently down for software upgrades. Please try
again a little later.");

$rs = pg_exec($db,"UPDATE story_progress SET preprocessing=NULL");
$rs = pg_exec($db,"SELECT preprocessing FROM story_progress");
$rec = pg_fetch_object($rs,0);
if ($rec->preprocessing > 0) {
        die();
} else {
        $rs = pg_exec($db,"UPDATE story_progress SET
preprocessing=".$todaySystem);
}
set_time_limit(0);

$rs = pg_exec($db,"SELECT count(storyid) from story_headline WHERE
article IS NOT NULL and story_preprocessed IS NULL");
$rec = pg_fetch_object($rs,0);
echo $rec->count,' records unprocessed',"\n";

//$rs = pg_exec($db,"SELECT storyid,headline,article from
story_headline WHERE storyid=80493 limit 1000");
$rs = pg_exec($db,"SELECT storyid,headline,article from story_headline
WHERE article IS NOT NULL and story_preprocessed IS NULL order by
storyid desc limit 100");
if ($rs && pg_numrows($rs)>0) {
        for ($x=0;$x<pg_numrows($rs);$x++) {
                $article = "";
                $textlines = "";
                $story = "";
                $rec = pg_fetch_object($rs,$x);
//              echo $rec->storyid,' ',$rec->headline," ";
                $article = trim(stripslashes($rec->article));
                if (strlen($article)>512) {
                        $article = str_replace("<TD"," <td",$article);
                        $article = str_replace("</TD"," </td",$article);
                        $article = eregi_replace("[[:cntrl:]]"," ",$article);          
 // get rid of
control characters
                        $article = eregi_replace("<P[^>]+>","\n\n\n",$article);
                        $article = eregi_replace("<BR[^>]+>","\n\n",$article);
                        $article = html_entity_decode($article);                       
                 // get rid of HTML
entities
                        $article = eregi_replace("&[^;]+;"," ",$article);              
 // get rid of
control characters
                        if (!empty($article)) {
                                $article = strtr($article,
"ŠŒŽšœžŸ¥µÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýÿ",
"SOZsozYYuAAAAAAACEEEEIIIIDNOOOOOOUUUUYsaaaaaaaceeeeiiiionoooooouuuuyy");

                        }
                        if (!empty($article)) {
                                $article = strip_tags($article,'<td>');
                                $article = " <td>".$article;
                                $textlines = split("<td",$article);
                                foreach ($textlines as $nextstory) {
                                        if (strpos($nextstory,">")>0) { $nextstory =
substr($nextstory,strpos($nextstory,">")+1); }
                                        $checklines = split("\n",$nextstory);
                                        if (count($checklines)>0) {
                                                $totallength=1;
                                                $totallines=1;
                                                $totalsingletones=1;
                                                for ($y=0;$y<count($checklines);$y++) {
                                                        if (strlen($checklines[$y])>0) 
{ 
                                                                $totallines++; 
                                                                $totallength = 
$totallength + strlen($checklines[$y]); 
                                                                if ($checklines[$y] == 
"") { $totalsingletones++; }
                                                        }
                                                }
                                                if ($totallength/$totallines>15 &&
$totalsingletons/$totallines<.5 && strlen($nextstory)>512) { $nextstory
= $story .= trim(strip_tags($nextstory))." \n\n"; }
                                        }
                                }
                        }
                }
                if (strlen($story)>512) { echo $rec->headline,"\n"; }
                pg_exec($db,"UPDATE story_headline SET
story_preprocessed=$todaySystem, story='".addslashes($story)."' WHERE
storyid=".$rec->storyid);
        }
}

$rs = pg_exec($db,"UPDATE story_progress SET preprocessing=NULL");

pg_exec($db,"ANALYZE story_headline");
pg_exec($db,"ANALYZE story_site");

?>

------------------------------------------------------------------------

[2003-06-13 09:07:32] [EMAIL PROTECTED]

Please provide a short but _complete_ stand-alone script.


------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/24175

-- 
Edit this bug report at http://bugs.php.net/?id=24175&edit=1

Reply via email to