|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2000-07-02 00:43 UTC] sterling at cvs dot php dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 01:00:01 2025 UTC |
dbase_create has two problems: 1) it segfaults if dbh has been created but no feilds are added and then needs to bail due to an error. The following code needs to be added to line 622 (in the release code base) or just above the field loop: /* make sure that the db_format entries for all fields are set to NULL to ensure we don't seg fault if there's an error and we need to call free_dbf_head() before all fields have been defined */ for (i = 0, cur_f = dbf; i < num_fields; i++, cur_f++) { cur_f->db_format = NULL; } 2) it does not recognize the array of array's correctly in the second parameter. Here is my test code: --code-- $dbdef = array( array( "id", "N", 5 , 0 ), array( "owner", "C", 20 ), array( "groupname", "C", 100 ), array( "type", "C", 20 ) ); dbase_create( "/tmp/test.dbf", $dbdef ); --code-- which generates the following error message: <b>Warning</b>: second parameter must be array of arrays in <b>dbase-test.php</b> on line <b>9</b><br> zend_hash_index_find() on line 626 claims success, however then field->type is set to 0 which is a null value, not an array. I've tried the above with both a 'production' 4.0.0 server with lots of modules compiled in and a fresh cgi version with only --with-dbase enabled and get the same result. The above code works fine in php 3.0.x and the dbase_create functions between 3 and 4 really don't seem to have changed, I'm wondering if there is a problem in passing array's or array's as a parameter?