tony2001                Sun Feb 25 23:16:32 2007 UTC

  Modified files:              
    /php-src/ext/dbase  dbase.c 
    /php-src/ext/dbase/tests    001.phpt 002.phpt 
  Log:
  do not allow db without fields
  fix test
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/dbase/dbase.c?r1=1.87&r2=1.88&diff_format=u
Index: php-src/ext/dbase/dbase.c
diff -u php-src/ext/dbase/dbase.c:1.87 php-src/ext/dbase/dbase.c:1.88
--- php-src/ext/dbase/dbase.c:1.87      Mon Jan  1 09:29:23 2007
+++ php-src/ext/dbase/dbase.c   Sun Feb 25 23:16:32 2007
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: dbase.c,v 1.87 2007/01/01 09:29:23 sebastian Exp $ */
+/* $Id: dbase.c,v 1.88 2007/02/25 23:16:32 tony2001 Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -604,6 +604,11 @@
 
        num_fields = zend_hash_num_elements(Z_ARRVAL_PP(fields));
 
+       if (num_fields <= 0) {
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to create 
database without fields");
+               RETURN_FALSE;
+       }
+
        /* have to use regular malloc() because this gets free()d by
           code in the dbase library */
        dbh = (dbhead_t *)malloc(sizeof(dbhead_t));
http://cvs.php.net/viewvc.cgi/php-src/ext/dbase/tests/001.phpt?r1=1.2&r2=1.3&diff_format=u
Index: php-src/ext/dbase/tests/001.phpt
diff -u php-src/ext/dbase/tests/001.phpt:1.2 
php-src/ext/dbase/tests/001.phpt:1.3
--- php-src/ext/dbase/tests/001.phpt:1.2        Wed Jul 12 13:17:25 2006
+++ php-src/ext/dbase/tests/001.phpt    Sun Feb 25 23:16:32 2007
@@ -54,7 +54,8 @@
 int(%d)
 string(71) "dbase_create(): expected field name as first element of list in 
field 0"
 bool(false)
-int(%d)
+string(56) "dbase_create(): Unable to create database without fields"
+bool(false)
 string(67) "Argument 2 passed to dbase_create() must be an array, integer 
given"
 string(50) "dbase_create(): Expected array as second parameter"
 bool(false)
http://cvs.php.net/viewvc.cgi/php-src/ext/dbase/tests/002.phpt?r1=1.4&r2=1.5&diff_format=u
Index: php-src/ext/dbase/tests/002.phpt
diff -u php-src/ext/dbase/tests/002.phpt:1.4 
php-src/ext/dbase/tests/002.phpt:1.5
--- php-src/ext/dbase/tests/002.phpt:1.4        Fri Dec  1 19:10:59 2006
+++ php-src/ext/dbase/tests/002.phpt    Sun Feb 25 23:16:32 2007
@@ -35,7 +35,7 @@
 echo "Done\n";
 ?>
 --EXPECTF--    
-Warning: dbase_open(): Invalid access mode -1 %s in %s on line %d
+Warning: dbase_open(): Invalid access mode -1 in %s on line %d
 bool(false)
 
 Warning: dbase_open(): Invalid access mode 1000 in %s on line %d

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to