#23731 [Opn->Fbk]: PHP Segfault
| From: | moriyoshi@php.net | Date: | Wed, 21 May 2003 09:18:51 +0000 |
| Subject: | #23731 [Opn->Fbk]: PHP Segfault | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-40121@lists.php.net to get a copy of this message | ||
ID: 23731
Updated by: moriyoshi@php.net
Reported By: Borax at nerim dot net
-Status: Open
+Status: Feedback
Bug Type: Reproducible crash
Operating System: FreeBSD 5.0
PHP Version: 4.3.1
New Comment:
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php
Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2003-05-21 04:11:26] Borax at nerim dot net
Hi.
Before I say something, I scuse me for my poor english :)
I had a problem with a code which I made in order to filter a Cisco
PIX's Syslog.
PHP segfault when I try to execute my script. I give you my script, and
more informations about my system:
#! /bin/php
<?
/* D\xe9claration des variables */
$file = (isset($file))? $file : "/var/log/test";
$i = 0;
$j = 0;
function tri($file){
/* On ouvre le fichier et on met son contenu dans un tableau
*/
$fd = file($file);
/* R\xe9cup\xe9ration des lignes qui concernent le PIX */
foreach($fd as $id => $texte){
if(ereg("PIX", $texte)){
$tableau[$i] = $texte;
$i++;
}
}
/* Puis on traite chaque ligne valide */
foreach($tableau as $ident => $contenu){
/* On casse la chaine a chaque espace */
unset($buff);
$buff = explode(" ", $contenu);
/* On d\xe9finit les variables qui vont correspondre :
*/
$buff[0] = $mois;
$buff[1] = $jour;
$buff[2] = $heure;
$buff[3] = $syslog_serv;
$buff[4] = $syslog_hdr;
$buff[5] = $deny;
$buff[6] = $inbound;
$buff[7] = $xlate1;$buff[8] = $xlate2;
$xlate = $xlate1.$xlate2;
$buff[9] = $protocole;
$buff[11] = $src;
$source = explode("/", $src);
$src_ip = $source[0];
$src_port = $source[1];
$buff[13] = $dst;
$dest = explode("/", $dst);
$dst_port = $dest[1];
$dst_ip = $dest[0];
/* On place tout ca dans une structure pour renvoyer le
resultat */
$structure[$j] = array( "src_ip" => $src_ip,
"src_port" => $src_port,
"dst_ip" => $dst_ip,
"dst_port" => $dst_port,
"proto" => $protocole,
"mois" => $mois,
"jour" => $jour,
"heure" => $heure,
"serv" => $syslog_serv,
"hdr" => $syslog_hdr
);
$j++;
}
return($structure);
}
$array = tri($file);
for($k = 0; $buff[$k]; $k++){
echo $buff[$k]["src_ip"];
}
?>
When I execute that, PHP return to me:
neron# ./firewall.php
Content-type: text/html
X-Powered-By: PHP/4.3.1
Segmentation fault (core dumped)
neron# php -v
PHP 4.3.1 (cgi), Copyright (c) 1997-2002 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2002 Zend Technologies
neron# uname -sr
FreeBSD 5.0-RELEASE
neron#
I think it's suffisant to expose the problem.
If you want something else, you can mail me at Borax@nerim.net
Thanx for PHP, and goodbye.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=23731&edit=1