ID: 7301 Updated by: zeev Reported By: [EMAIL PROTECTED] Old Status: Duplicate Status: Closed Bug Type: mSQL related Operating System: RedHat Linux 6.1 PHP Version: 4.0.3pl1 New Comment: Fixed in the CVS Previous Comments: ------------------------------------------------------------------------ [2000-12-12 18:28:49] [EMAIL PROTECTED] This is duplicate of #6827. --Jani ------------------------------------------------------------------------ [2000-10-20 13:22:25] [EMAIL PROTECTED] I pared down the code and the data to the minium while still getting the crash. Below is the code and the msqldump. I think it is the NULL that is causing the problem and not a blank entry. Code: --------------------------- <pre> <? $database = "foobar"; $sql ="SELECT * FROM events WHERE ev_day='18-Oct-2000' ORDER BY typ, srttm"; $result = msql($database,$sql); $num_rows = msql_numrows($result); $i = 0; while ($i < $num_rows) { $aff = msql_result($result,$i,"aff"); $sql_info = "SELECT show_provider_info,provider_serial_id FROM Providers where user_name = '$aff' LIMIT 1"; echo "DEBUG: $sql_info: $num_rows<br>"; $result_info = msql($database,$sql_info); echo "DEBUG_result: $result_info<br>"; $show_info = msql_result($result_info,0,"show_provider_info") ; $this_provider = msql_result($result_info,0,"provider_serial_id") ; echo msql_error(); echo "DEBUG: '$show_info', '$this_provider', '$aff'<br>\n"; if ($i == 1) { //In this demo there are 3 entries exit; //If it gets to the third($i=2) the } //program crashes w/out fail. if ($show_info == 1) { //CRASHES HERE echo "HI"; } $i++; } ?> </pre> ------ ------------------------------------------- Data in database: ---- # # mSQL Dump # Host: localhost Database: foobar #-------------------------------------------------------- # # Table structure for table 'events' # DROP TABLE events \g CREATE TABLE events ( id CHAR(31), ev_day DATE, srttm CHAR(8), endtm CHAR(8), group_id INT, typ CHAR(25), aff CHAR(30), title CHAR(30), descr CHAR(200) ) \g # # Dumping data for table 'events' # INSERT INTO events VALUES ('940868200264760','18-Oct-2000','12:00 pm','1:00 pm',2,'Lunch','Slovak','Learn At Lunch','learn blah blah')\g INSERT INTO events VALUES ('96463942510743346','18-Oct-2000','','',2,'Other Event','Celebration Belle','Big Band Cruises','blah blah')\g INSERT INTO events VALUES ('965228863119070','18-Oct-2000','','',2,'Other Event','Celebration Belle','Daylong Cruise','blah blah')\g # # Table structure for table 'Providers' # DROP TABLE Providers \g CREATE TABLE Providers ( provider_serial_id INT, user_name CHAR(30), provider_password CHAR(14), provider_group_id INT, provider_email CHAR(35), permissions INT, provider_address1 CHAR(30), provider_address2 CHAR(30), provider_city CHAR(20), provider_state CHAR(2), provider_zip CHAR(10), provider_phone CHAR(12), provider_url CHAR(33), provider_info CHAR(200), show_provider_info INT ) \g CREATE UNIQUE INDEX idx_provider_id ON Providers ( provider_serial_id, user_name ) \g CREATE SEQUENCE ON Providers STEP 1 VALUE 208 \g # # Dumping data for table 'Providers' # INSERT INTO Providers VALUES (53,'Slovak','erased3',2,'',NULL,'','','','','','','','',0)\g INSERT INTO Providers VALUES (172,'Celebration Belle','erased4',2,'xxx',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)\g ------- ------------------------------------------------------------------------ [2000-10-17 23:25:45] [EMAIL PROTECTED] A piece of code worked perfectly with PHP3/Apache1.3.9/msql-2..11 I tried it with PHP4/Apache_1.3.14/msql-2.0.11 and got sporadic crashes - I found out that: IF a) You have an msql database with a value in a row blank, e.g. ('asdf',1,'',,...) AND b) you have a SELECT * statement $sql="SELECT * from table where ... ORDER BY ..." $result = msql($DB,$sql) while ($row = msql_fetch_row($result) ) { .... } AND c) the FIRST row returned contains a value that is blank THEN when php hits the msql_fetch_row($result) line, PHP returns nothing and gives an error in the log file like: child pid 9346 exit signal Segmentation Fault HOWEVER, if the first row returned does not have a blank element in the row, then it seems to work ok. ---- I tried variations with msql_result(), msql_connect, and msql_pconnect as well but all gave me the same problem. ----- Relevent facts?: In running "make" I get gcc .... -I/usr/local/Hughes/include .... -c php_msql.c -fPIC -DPIC -o php_msql.lo php_msql.c:189 warning: int format, long int (arg 4) php_msql.c:191 warning: int format, long int (arg 4) php_msql.c:196 warning: int format, long int (arg 4) php_msql.c:198 warning: int format, long int (arg 4) I used the stock php.ini.dist file Thanks in advance - PHP is great! Afan Ottenheimer ------------------------------------------------------------------------ Edit this bug report at http://bugs.php.net/?id=7301&edit=1 -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]