[PHP-CVS] cvs: php-src /ext/dom TODO attr.c cdatasection.c comment.c document.c documentfragment.c dom_fe.h element.c entityreference.c php_dom.c processinginstruction.c text.c xpath.c
rrichards Sun May 16 06:30:18 2004 EDT Modified files: /php-src/ext/domTODO attr.c cdatasection.c comment.c document.c documentfragment.c dom_fe.h element.c entityreference.c php_dom.c processinginstruction.c text.c xpath.c Log: constructors throw DOMException add DOM_PHP_ERR DomException code validate tagnames in constructors use C style comments update TODO http://cvs.php.net/diff.php/php-src/ext/dom/TODO?r1=1.1r2=1.2ty=u Index: php-src/ext/dom/TODO diff -u php-src/ext/dom/TODO:1.1 php-src/ext/dom/TODO:1.2 --- php-src/ext/dom/TODO:1.1Thu Jun 5 13:06:52 2003 +++ php-src/ext/dom/TODOSun May 16 06:30:16 2004 @@ -1,12 +1,4 @@ -1) Change _node_list_pointer to something faster than just a linked list. - Currently there to test that unlinked node tracking works -2) Possible create new object type for documents as these are the only types which need to track nodes - - Would also require its own dtor functionality -3) Define correct behavior. When certain types of nodes are destroyed, - do we unlink children (if referenced) or just destroy them. (Element/Attribute nodes) -4) Find out where XPath goes (this extension or its own) -5) What DOM object types are really needed (i.e. not currently using DOMString) -6) Determine how to handle non speced functionality. - i.e validation (add method or implement as property for processing) - - +For 5.1 +1) enhance XPath functionality +2) look at auto encoding support for in/output +3) What DOM object types are really needed (i.e. not currently using DOMString) http://cvs.php.net/diff.php/php-src/ext/dom/attr.c?r1=1.13r2=1.14ty=u Index: php-src/ext/dom/attr.c diff -u php-src/ext/dom/attr.c:1.13 php-src/ext/dom/attr.c:1.14 --- php-src/ext/dom/attr.c:1.13 Wed Mar 31 12:18:59 2004 +++ php-src/ext/dom/attr.c Sun May 16 06:30:16 2004 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: attr.c,v 1.13 2004/03/31 17:18:59 rrichards Exp $ */ +/* $Id: attr.c,v 1.14 2004/05/16 10:30:16 rrichards Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -52,23 +52,29 @@ xmlNodePtr oldnode = NULL; dom_object *intern; char *name, *value = NULL; - int name_len, value_len; + int name_len, value_len, name_valid; + php_set_error_handling(EH_THROW, dom_domexception_class_entry TSRMLS_CC); if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), Os|s, id, dom_attr_class_entry, name, name_len, value, value_len) == FAILURE) { + php_std_error_handling(); return; } + php_std_error_handling(); intern = (dom_object *)zend_object_store_get_object(id TSRMLS_CC); - if (name_len == 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, Attribute name is required); + name_valid = xmlValidateName((xmlChar *) name, 0); + if (name_valid != 0) { + php_dom_throw_error(INVALID_CHARACTER_ERR, 1 TSRMLS_CC); RETURN_FALSE; } nodep = xmlNewProp(NULL, (xmlChar *) name, value); - if (!nodep) + if (!nodep) { + php_dom_throw_error(INVALID_STATE_ERR, 1 TSRMLS_CC); RETURN_FALSE; + } if (intern != NULL) { oldnode = (xmlNodePtr)intern-ptr; http://cvs.php.net/diff.php/php-src/ext/dom/cdatasection.c?r1=1.8r2=1.9ty=u Index: php-src/ext/dom/cdatasection.c diff -u php-src/ext/dom/cdatasection.c:1.8 php-src/ext/dom/cdatasection.c:1.9 --- php-src/ext/dom/cdatasection.c:1.8 Wed Mar 31 12:18:59 2004 +++ php-src/ext/dom/cdatasection.c Sun May 16 06:30:16 2004 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: cdatasection.c,v 1.8 2004/03/31 17:18:59 rrichards Exp $ */ +/* $Id: cdatasection.c,v 1.9 2004/05/16 10:30:16 rrichards Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -50,14 +50,19 @@ char *value = NULL; int value_len; + php_set_error_handling(EH_THROW, dom_domexception_class_entry TSRMLS_CC); if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), Os, id, dom_cdatasection_class_entry, value, value_len) == FAILURE) { + php_std_error_handling(); return; } + php_std_error_handling(); nodep = xmlNewCDataBlock(NULL, (xmlChar *) value, value_len); - if (!nodep) + if (!nodep) { + php_dom_throw_error(INVALID_STATE_ERR, 1 TSRMLS_CC); RETURN_FALSE; + } intern = (dom_object *)zend_object_store_get_object(id TSRMLS_CC); if (intern != NULL) { http://cvs.php.net/diff.php/php-src/ext/dom/comment.c?r1=1.8r2=1.9ty=u Index: php-src/ext/dom/comment.c diff -u php-src/ext/dom/comment.c:1.8
[PHP-CVS] cvs: php-src /ext ext_skel
wez Sun May 16 07:49:35 2004 EDT Modified files: /php-src/extext_skel Log: Add config.w32 template to ext_skel http://cvs.php.net/diff.php/php-src/ext/ext_skel?r1=1.47r2=1.48ty=u Index: php-src/ext/ext_skel diff -u php-src/ext/ext_skel:1.47 php-src/ext/ext_skel:1.48 --- php-src/ext/ext_skel:1.47 Sun Jun 29 12:07:17 2003 +++ php-src/ext/ext_skelSun May 16 07:49:35 2004 @@ -170,6 +170,22 @@ fi eof +$ECHO_N config.w32$ECHO_C +cat config.w32 eof +// \$Id\$ +// vim:ft=javascript + +// If your extension references something external, use ARG_WITH +// ARG_WITH($extname, for $extname support, no); + +// Otherwise, use ARG_ENABLE +// ARG_ENABLE($extname, enable $extname support, no); + +if (PHP_$EXTNAME != no) { + EXTENSION($extname, $extname.c) +} + +eof $ECHO_N .cvsignore$ECHO_C cat .cvsignore eof -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext ext_skel
wez Sun May 16 08:10:35 2004 EDT Modified files: /php-src/extext_skel Log: ; http://cvs.php.net/diff.php/php-src/ext/ext_skel?r1=1.48r2=1.49ty=u Index: php-src/ext/ext_skel diff -u php-src/ext/ext_skel:1.48 php-src/ext/ext_skel:1.49 --- php-src/ext/ext_skel:1.48 Sun May 16 07:49:35 2004 +++ php-src/ext/ext_skelSun May 16 08:10:35 2004 @@ -182,7 +182,7 @@ // ARG_ENABLE($extname, enable $extname support, no); if (PHP_$EXTNAME != no) { - EXTENSION($extname, $extname.c) + EXTENSION($extname, $extname.c); } eof -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard formatted_print.c
helly Sun May 16 10:01:45 2004 EDT Modified files: /php-src/ext/standard formatted_print.c Log: - Fix printf with floats http://cvs.php.net/diff.php/php-src/ext/standard/formatted_print.c?r1=1.75r2=1.76ty=u Index: php-src/ext/standard/formatted_print.c diff -u php-src/ext/standard/formatted_print.c:1.75 php-src/ext/standard/formatted_print.c:1.76 --- php-src/ext/standard/formatted_print.c:1.75 Tue May 11 15:51:46 2004 +++ php-src/ext/standard/formatted_print.c Sun May 16 10:01:45 2004 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: formatted_print.c,v 1.75 2004/05/11 19:51:46 iliaa Exp $ */ +/* $Id: formatted_print.c,v 1.76 2004/05/16 14:01:45 helly Exp $ */ #include math.h /* modf() */ #include php.h @@ -65,6 +65,7 @@ static char *php_convert_to_decimal(double arg, int ndigits, int *decpt, int *sign, int eflag) { register int r2; + int mvl; double fi, fj; register char *p, *p1; /*THREADX*/ @@ -90,13 +91,21 @@ p1 = cvt_buf[NDIG]; while (fi != 0) { fj = modf(fi / 10, fi); + if (p1 = cvt_buf[0]) { + mvl = NDIG - ndigits; + memmove(cvt_buf[mvl], cvt_buf[0], NDIG-mvl-1); + p1 += mvl; + } *--p1 = (int) ((fj + .03) * 10) + '0'; r2++; } while (p1 cvt_buf[NDIG]) *p++ = *p1++; } else if (arg 0) { - while ((fj = arg * 10.0) 0.999) { + while ((fj = arg * 10) 1) { + if (!eflag (r2 * -1) ndigits) { + break; + } arg = fj; r2--; } @@ -109,10 +118,17 @@ cvt_buf[0] = '\0'; return (cvt_buf); } - while (p = p1 p cvt_buf[NDIG]) { - arg *= 10; - arg = modf(arg, fj); + if (p = p1 p cvt_buf[NDIG]) { + arg = modf(arg * 10, fj); + if ((int)fj==10) { + *p++ = '1'; + fj = 0; + *decpt = ++r2; + } + while (p = p1 p cvt_buf[NDIG]) { *p++ = (int) fj + '0'; + arg = modf(arg * 10, fj); + } } if (p1 = cvt_buf[NDIG]) { cvt_buf[NDIG - 1] = '\0'; @@ -286,7 +302,7 @@ char numbuf[NUM_BUF_SIZE]; char *cvt; register int i = 0, j = 0; - int sign, decpt; + int sign, decpt, cvt_len; char decimal_point = EG(float_separator)[0]; PRINTF_DEBUG((sprintf: appenddouble(%x, %x, %x, %f, %d, '%c', %d, %c)\n, @@ -312,6 +328,7 @@ } cvt = php_convert_to_decimal(number, precision, decpt, sign, (fmt == 'e')); + cvt_len = strlen(cvt); if (sign) { numbuf[i++] = '-'; @@ -330,10 +347,15 @@ } } } else { - while (decpt-- 0) - numbuf[i++] = cvt[j++]; - if (precision 0) + while (decpt-- 0) { + numbuf[i++] = j cvt_len ? cvt[j++] : '0'; + } + if (precision 0) { numbuf[i++] = decimal_point; + while (precision-- 0) { + numbuf[i++] = j cvt_len ? cvt[j++] : '0'; + } + } } } else if (fmt == 'e' || fmt == 'E') { char *exp_p; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/fdf fdf.c
iliaa Sun May 16 10:38:19 2004 EDT Modified files: /php-src/ext/fdffdf.c Log: Added missing safe_mode open_basedir checks. http://cvs.php.net/diff.php/php-src/ext/fdf/fdf.c?r1=1.85r2=1.86ty=u Index: php-src/ext/fdf/fdf.c diff -u php-src/ext/fdf/fdf.c:1.85 php-src/ext/fdf/fdf.c:1.86 --- php-src/ext/fdf/fdf.c:1.85 Thu Jan 8 03:15:25 2004 +++ php-src/ext/fdf/fdf.c Sun May 16 10:38:19 2004 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: fdf.c,v 1.85 2004/01/08 08:15:25 andi Exp $ */ +/* $Id: fdf.c,v 1.86 2004/05/16 14:38:19 iliaa Exp $ */ /* FdfTk lib 2.0 is a Complete C/C++ FDF Toolkit available from http://beta1.adobe.com/ada/acrosdk/forms.html. */ @@ -725,6 +725,10 @@ return; } + if (php_check_open_basedir(filename TSRMLS_CC) || (PG(safe_mode) !php_checkuid(filename, wb+, CHECKUID_CHECK_MODE_PARAM))) { + RETURN_FALSE; + } + ZEND_FETCH_RESOURCE(fdf, FDFDoc *, r_fdf, -1, fdf, le_fdf); err = FDFSetFile(fdf, filename); @@ -1485,6 +1489,10 @@ ZEND_FETCH_RESOURCE(fdf, FDFDoc *, r_fdf, -1, fdf, le_fdf); + if (php_check_open_basedir(savepath TSRMLS_CC) || (PG(safe_mode) !php_checkuid(savepath, wb+, CHECKUID_CHECK_MODE_PARAM))) { + RETURN_FALSE; + } + strncpy(pathbuf , savepath, MAXPATHLEN-1); pathbuf[MAXPATHLEN-1] = '\0'; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_4_3) /ext/fdf fdf.c
iliaa Sun May 16 10:38:27 2004 EDT Modified files: (Branch: PHP_4_3) /php-src/ext/fdffdf.c Log: MFH: Added missing safe_mode open_basedir checks. http://cvs.php.net/diff.php/php-src/ext/fdf/fdf.c?r1=1.66.2.11r2=1.66.2.12ty=u Index: php-src/ext/fdf/fdf.c diff -u php-src/ext/fdf/fdf.c:1.66.2.11 php-src/ext/fdf/fdf.c:1.66.2.12 --- php-src/ext/fdf/fdf.c:1.66.2.11 Wed Sep 10 21:45:02 2003 +++ php-src/ext/fdf/fdf.c Sun May 16 10:38:26 2004 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: fdf.c,v 1.66.2.11 2003/09/11 01:45:02 hholzgra Exp $ */ +/* $Id: fdf.c,v 1.66.2.12 2004/05/16 14:38:26 iliaa Exp $ */ /* FdfTk lib 2.0 is a Complete C/C++ FDF Toolkit available from http://beta1.adobe.com/ada/acrosdk/forms.html. */ @@ -721,6 +721,10 @@ return; } + if (php_check_open_basedir(filename TSRMLS_CC) || (PG(safe_mode) !php_checkuid(filename, wb+, CHECKUID_CHECK_MODE_PARAM))) { + RETURN_FALSE; + } + ZEND_FETCH_RESOURCE(fdf, FDFDoc *, r_fdf, -1, fdf, le_fdf); err = FDFSetFile(fdf, filename); @@ -1481,6 +1485,10 @@ ZEND_FETCH_RESOURCE(fdf, FDFDoc *, r_fdf, -1, fdf, le_fdf); + if (php_check_open_basedir(savepath TSRMLS_CC) || (PG(safe_mode) !php_checkuid(savepath, wb+, CHECKUID_CHECK_MODE_PARAM))) { + RETURN_FALSE; + } + strncpy(pathbuf , savepath, MAXPATHLEN-1); pathbuf[MAXPATHLEN-1] = '\0'; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard/tests/strings sprintf_f.phpt
helly Sun May 16 10:48:45 2004 EDT Added files: /php-src/ext/standard/tests/strings sprintf_f.phpt Log: - Add new test http://cvs.php.net/co.php/php-src/ext/standard/tests/strings/sprintf_f.phpt?r=1.1p=1 Index: php-src/ext/standard/tests/strings/sprintf_f.phpt +++ php-src/ext/standard/tests/strings/sprintf_f.phpt --TEST-- sprintf %f --FILE-- ?php var_dump(sprintf(%3.2f, 1.2)); var_dump(sprintf(%-3.2f, 1.2)); var_dump(sprintf(%03.2f, 1.2)); var_dump(sprintf(%-03.2f, 1.2)); echo \n; var_dump(sprintf(%5.2f, 3.4)); var_dump(sprintf(%-5.2f, 3.4)); var_dump(sprintf(%05.2f, 3.4)); var_dump(sprintf(%-05.2f, 3.4)); echo \n; var_dump(sprintf(%7.2f, -5.6)); var_dump(sprintf(%-7.2f, -5.6)); var_dump(sprintf(%07.2f, -5.6)); var_dump(sprintf(%-07.2f, -5.6)); echo \n; var_dump(sprintf(%3.4f, 1.2345678e99)); ? --EXPECTF-- string(4) 1.20 string(4) 1.20 string(4) 1.20 string(4) 1.20 string(5) 3.40 string(5) 3.40 string(5) 03.40 string(5) 3.400 string(7) -5.60 string(7) -5.60 string(7) -005.60 string(7) -5.6000 string(105) 12345678%d00. -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/sockets sockets.c
iliaa Sun May 16 11:34:53 2004 EDT Modified files: /php-src/ext/socketssockets.c Log: Do not allocate error buffer at the start of every request. http://cvs.php.net/diff.php/php-src/ext/sockets/sockets.c?r1=1.161r2=1.162ty=u Index: php-src/ext/sockets/sockets.c diff -u php-src/ext/sockets/sockets.c:1.161 php-src/ext/sockets/sockets.c:1.162 --- php-src/ext/sockets/sockets.c:1.161 Sun Mar 14 12:53:28 2004 +++ php-src/ext/sockets/sockets.c Sun May 16 11:34:53 2004 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: sockets.c,v 1.161 2004/03/14 17:53:28 jan Exp $ */ +/* $Id: sockets.c,v 1.162 2004/05/16 15:34:53 iliaa Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -322,7 +322,7 @@ buf = hstrerror(error); #else { - sprintf(SOCKETS_G(strerror_buf), Host lookup error %d, error); + spprintf((SOCKETS_G(strerror_buf), Host lookup error %d, error); buf = SOCKETS_G(strerror_buf); } #endif @@ -336,7 +336,7 @@ if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, error, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) tmp, 0, NULL)) { - strlcpy(SOCKETS_G(strerror_buf), (char *) tmp, 1); + SOCKETS_G(strerror_buf) = estrndup(tmp); LocalFree(tmp); buf = SOCKETS_G(strerror_buf); @@ -503,8 +503,6 @@ /* {{{ PHP_RINIT_FUNCTION */ PHP_RINIT_FUNCTION(sockets) { - SOCKETS_G(strerror_buf) = emalloc(16384); - return SUCCESS; } /* }}} */ @@ -512,8 +510,11 @@ /* {{{ PHP_RSHUTDOWN_FUNCTION */ PHP_RSHUTDOWN_FUNCTION(sockets) { - efree(SOCKETS_G(strerror_buf)); - + if (SOCKETS_G(strerror_buf)) { + efree(SOCKETS_G(strerror_buf)); + SOCKETS_G(strerror_buf) = NULL; + } + return SUCCESS; } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_4_3) /ext/sockets sockets.c
iliaa Sun May 16 11:34:56 2004 EDT Modified files: (Branch: PHP_4_3) /php-src/ext/socketssockets.c Log: MFH: Do not allocate error buffer at the start of every request. http://cvs.php.net/diff.php/php-src/ext/sockets/sockets.c?r1=1.125.2.20r2=1.125.2.21ty=u Index: php-src/ext/sockets/sockets.c diff -u php-src/ext/sockets/sockets.c:1.125.2.20 php-src/ext/sockets/sockets.c:1.125.2.21 --- php-src/ext/sockets/sockets.c:1.125.2.20Wed Feb 25 17:12:03 2004 +++ php-src/ext/sockets/sockets.c Sun May 16 11:34:56 2004 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: sockets.c,v 1.125.2.20 2004/02/25 22:12:03 iliaa Exp $ */ +/* $Id: sockets.c,v 1.125.2.21 2004/05/16 15:34:56 iliaa Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -350,7 +350,7 @@ buf = hstrerror(error); #else { - sprintf(SOCKETS_G(strerror_buf), Host lookup error %d, error); + spprintf((SOCKETS_G(strerror_buf), Host lookup error %d, error); buf = SOCKETS_G(strerror_buf); } #endif @@ -364,7 +364,7 @@ if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, error, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) tmp, 0, NULL)) { - strlcpy(SOCKETS_G(strerror_buf), (char *) tmp, 1); + SOCKETS_G(strerror_buf) = estrndup(tmp); LocalFree(tmp); buf = SOCKETS_G(strerror_buf); @@ -483,18 +483,18 @@ /* {{{ PHP_RINIT_FUNCTION */ PHP_RINIT_FUNCTION(sockets) { - if ((SOCKETS_G(strerror_buf) = emalloc(16384))) - return SUCCESS; - - return FAILURE; + return SUCCESS; } /* }}} */ /* {{{ PHP_RSHUTDOWN_FUNCTION */ PHP_RSHUTDOWN_FUNCTION(sockets) { - efree(SOCKETS_G(strerror_buf)); - + if (SOCKETS_G(strerror_buf)) { + efree(SOCKETS_G(strerror_buf)); + SOCKETS_G(strerror_buf) = NULL; + } + return SUCCESS; } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/sybase_ct/tests test_long.phpt
thekid Sun May 16 16:28:31 2004 EDT Added files: /php-src/ext/sybase_ct/teststest_long.phpt Log: - Initial release http://cvs.php.net/co.php/php-src/ext/sybase_ct/tests/test_long.phpt?r=1.1p=1 Index: php-src/ext/sybase_ct/tests/test_long.phpt +++ php-src/ext/sybase_ct/tests/test_long.phpt --TEST-- Sybase-CT select LONG_MAX / LONG_MIN --SKIPIF-- ?php require('skipif.inc'); ? --FILE-- ?php /* This file is part of PHP test framework for ext/sybase_ct * * $Id: test_long.phpt,v 1.1 2004/05/16 20:28:31 thekid Exp $ */ require('test.inc'); define('LONG_MAX', is_int(2147483648) ? 9223372036854775807 : 2147483647); define('LONG_MIN', -LONG_MAX - 1); $db= sybase_connect_ex(); var_dump(sybase_select_db('tempdb', $db)); // Create table and insert some values var_dump(sybase_query('create table test_long (value numeric(20, 0))')); var_dump(sybase_query('insert test_long values ('.(LONG_MAX - 1).')')); var_dump(sybase_query('insert test_long values ('.(LONG_MAX).')')); var_dump(sybase_query('insert test_long values ('.(LONG_MAX + 1).')')); var_dump(sybase_query('insert test_long values ('.(LONG_MIN + 1).')')); var_dump(sybase_query('insert test_long values ('.(LONG_MIN).')')); var_dump(sybase_query('insert test_long values ('.(LONG_MIN - 1).')')); // Select values var_dump(sybase_select_ex($db, 'select value from test_long')); // Drop table var_dump(sybase_query('drop table test_long')); sybase_close($db); ? --EXPECTF-- bool(true) bool(true) bool(true) bool(true) bool(true) bool(true) bool(true) bool(true) Query: select value from test_long Return: resource array(6) { [0]= array(1) { [value]= int(%s) } [1]= array(1) { [value]= int(%s) } [2]= array(1) { [value]= float(%s) } [3]= array(1) { [value]= int(-%s) } [4]= array(1) { [value]= int(-%s) } [5]= array(1) { [value]= float(-%s) } } bool(true) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/sybase_ct php_sybase_ct.c
thekid Sun May 16 16:30:36 2004 EDT Modified files: /php-src/ext/sybase_ct php_sybase_ct.c Log: - Fixed auto-conversion from long to double when LONG_MAX / LONG_MIN where overflown http://cvs.php.net/diff.php/php-src/ext/sybase_ct/php_sybase_ct.c?r1=1.93r2=1.94ty=u Index: php-src/ext/sybase_ct/php_sybase_ct.c diff -u php-src/ext/sybase_ct/php_sybase_ct.c:1.93 php-src/ext/sybase_ct/php_sybase_ct.c:1.94 --- php-src/ext/sybase_ct/php_sybase_ct.c:1.93 Fri Apr 16 12:27:13 2004 +++ php-src/ext/sybase_ct/php_sybase_ct.c Sun May 16 16:30:35 2004 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: php_sybase_ct.c,v 1.93 2004/04/16 16:27:13 thetaphi Exp $ */ +/* $Id: php_sybase_ct.c,v 1.94 2004/05/16 20:30:35 thekid Exp $ */ #ifdef HAVE_CONFIG_H @@ -1127,15 +1127,14 @@ convert_to_long(result-data[i][j]); break; case 2: - /* We also get numbers that are actually integers here due to the check on -* precision against 9 (ranges are -1E10 to -1E9 and 1E9 to 1E10). As we -* cannot be sure that they fit into MIN_LONG = x = MAX_LONG, we call -* convert_to_double() on them. This is a small performance penalty, but -* ensures that select 2147483648 will be a float and select 2147483647 -* will be become an int. -*/ convert_to_double(result-data[i][j]); break; + case 3: + /* This signals we have an integer datatype, but we need to convert to double if we +* overflow. +*/ + convert_scalar_to_number(result-data[i][j]); + break; } } } @@ -1243,7 +1242,7 @@ case CS_DECIMAL_TYPE: result-datafmt[i].maxlength = result-datafmt[i].precision + 3; /* numeric(10) vs numeric(10, 1) */ - result-numerics[i] = (result-datafmt[i].scale == 0 result-datafmt[i].precision = 9) ? 1 : 2; + result-numerics[i] = (result-datafmt[i].scale == 0) ? 3 : 2; break; default: result-datafmt[i].maxlength++; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/sybase_ct/tests test_types.phpt
thekid Sun May 16 16:33:45 2004 EDT Modified files: /php-src/ext/sybase_ct/teststest_types.phpt Log: - Fixed test for LONG_MIN / LONG_MAX for 64-bit platforms http://cvs.php.net/diff.php/php-src/ext/sybase_ct/tests/test_types.phpt?r1=1.2r2=1.3ty=u Index: php-src/ext/sybase_ct/tests/test_types.phpt diff -u php-src/ext/sybase_ct/tests/test_types.phpt:1.2 php-src/ext/sybase_ct/tests/test_types.phpt:1.3 --- php-src/ext/sybase_ct/tests/test_types.phpt:1.2 Sat Jan 24 10:18:52 2004 +++ php-src/ext/sybase_ct/tests/test_types.phpt Sun May 16 16:33:44 2004 @@ -6,18 +6,21 @@ ?php /* This file is part of PHP test framework for ext/sybase_ct * - * $Id: test_types.phpt,v 1.2 2004/01/24 15:18:52 thekid Exp $ + * $Id: test_types.phpt,v 1.3 2004/05/16 20:33:44 thekid Exp $ */ require('test.inc'); + define('LONG_MAX', is_int(2147483648) ? 9223372036854775807 : 2147483647); + define('LONG_MIN', -LONG_MAX - 1); + $db= sybase_connect_ex(); var_dump(sybase_select_ex($db, 'select 1 as integer, --2147483647 as integer_min, --2147483648 as integer_min_exceed, -2147483647 as integer_max, -2147483648 as integer_max_exceed, +'.(LONG_MIN).' as integer_min, +'.(LONG_MIN - 1).' as integer_min_exceed, +'.(LONG_MAX).' as integer_max, +'.(LONG_MAX + 1).' as integer_max_exceed, 1.0 as float, $22.36 as money, Binford as string, @@ -33,10 +36,10 @@ --EXPECTF-- Query: select 1 as integer, --2147483647 as integer_min, --2147483648 as integer_min_exceed, -2147483647 as integer_max, -2147483648 as integer_max_exceed, +-%s as integer_min, +-%s as integer_min_exceed, +%s as integer_max, +%s as integer_max_exceed, 1.0 as float, $22.36 as money, Binford as string, @@ -53,13 +56,13 @@ [integer]= int(1) [integer_min]= -int(-2147483647) +int(-%s) [integer_min_exceed]= -float(-2147483648) +float(-%s) [integer_max]= -int(2147483647) +int(%s) [integer_max_exceed]= -float(2147483648) +float(%s) [float]= float(1) [money]= -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_4_3) /ext/sybase_ct php_sybase_ct.c
thekid Sun May 16 16:36:41 2004 EDT Modified files: (Branch: PHP_4_3) /php-src/ext/sybase_ct php_sybase_ct.c Log: - MFH: Fixed auto-conversion from long to double when LONG_MAX / LONG_MIN where overflown http://cvs.php.net/diff.php/php-src/ext/sybase_ct/php_sybase_ct.c?r1=1.73.2.12r2=1.73.2.13ty=u Index: php-src/ext/sybase_ct/php_sybase_ct.c diff -u php-src/ext/sybase_ct/php_sybase_ct.c:1.73.2.12 php-src/ext/sybase_ct/php_sybase_ct.c:1.73.2.13 --- php-src/ext/sybase_ct/php_sybase_ct.c:1.73.2.12 Fri Apr 16 12:27:57 2004 +++ php-src/ext/sybase_ct/php_sybase_ct.c Sun May 16 16:36:41 2004 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: php_sybase_ct.c,v 1.73.2.12 2004/04/16 16:27:57 thetaphi Exp $ */ +/* $Id: php_sybase_ct.c,v 1.73.2.13 2004/05/16 20:36:41 thekid Exp $ */ #ifdef HAVE_CONFIG_H @@ -1127,15 +1127,14 @@ convert_to_long(result-data[i][j]); break; case 2: - /* We also get numbers that are actually integers here due to the check on -* precision against 9 (ranges are -1E10 to -1E9 and 1E9 to 1E10). As we -* cannot be sure that they fit into MIN_LONG = x = MAX_LONG, we call -* convert_to_double() on them. This is a small performance penalty, but -* ensures that select 2147483648 will be a float and select 2147483647 -* will be become an int. -*/ convert_to_double(result-data[i][j]); break; + case 3: + /* This signals we have an integer datatype, but we need to convert to double if we +* overflow. +*/ + convert_scalar_to_number(result-data[i][j]); + break; } } } @@ -1243,7 +1242,7 @@ case CS_DECIMAL_TYPE: result-datafmt[i].maxlength = result-datafmt[i].precision + 3; /* numeric(10) vs numeric(10, 1) */ - result-numerics[i] = (result-datafmt[i].scale == 0 result-datafmt[i].precision = 9) ? 1 : 2; + result-numerics[i] = (result-datafmt[i].scale == 0) ? 3 : 2; break; default: result-datafmt[i].maxlength++; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_4_3) / NEWS /ext/standard formatted_print.c /ext/standard/tests/strings sprintf_f.phpt
helly Sun May 16 17:20:30 2004 EDT Added files: (Branch: PHP_4_3) /php-src/ext/standard/tests/strings sprintf_f.phpt Modified files: /php-srcNEWS /php-src/ext/standard formatted_print.c Log: MFH: Fix printf with floats http://cvs.php.net/diff.php/php-src/NEWS?r1=1.1247.2.661r2=1.1247.2.662ty=u Index: php-src/NEWS diff -u php-src/NEWS:1.1247.2.661 php-src/NEWS:1.1247.2.662 --- php-src/NEWS:1.1247.2.661 Thu May 13 13:44:33 2004 +++ php-src/NEWSSun May 16 17:20:29 2004 @@ -2,6 +2,7 @@ ||| ?? ??? 2004, Version 4.3.7 - Upgraded bundled GD library to 2.0.23. (Ilia) +- Fixed problems with *printf() functions and '%f' formatting. (Marcus) - Fixed possible crash inside pg_copy_(to|from) function if delimiter is more then 1 character long. (Ilia) - Fixed crash inside cpdf_place_inline_image() when working with truecolor http://cvs.php.net/diff.php/php-src/ext/standard/formatted_print.c?r1=1.59.2.9r2=1.59.2.10ty=u Index: php-src/ext/standard/formatted_print.c diff -u php-src/ext/standard/formatted_print.c:1.59.2.9 php-src/ext/standard/formatted_print.c:1.59.2.10 --- php-src/ext/standard/formatted_print.c:1.59.2.9 Tue May 11 15:51:50 2004 +++ php-src/ext/standard/formatted_print.c Sun May 16 17:20:30 2004 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: formatted_print.c,v 1.59.2.9 2004/05/11 19:51:50 iliaa Exp $ */ +/* $Id: formatted_print.c,v 1.59.2.10 2004/05/16 21:20:30 helly Exp $ */ #include math.h /* modf() */ #include php.h @@ -65,6 +65,7 @@ static char *php_convert_to_decimal(double arg, int ndigits, int *decpt, int *sign, int eflag) { register int r2; + int mvl; double fi, fj; register char *p, *p1; /*THREADX*/ @@ -90,13 +91,21 @@ p1 = cvt_buf[NDIG]; while (fi != 0) { fj = modf(fi / 10, fi); + if (p1 = cvt_buf[0]) { + mvl = NDIG - ndigits; + memmove(cvt_buf[mvl], cvt_buf[0], NDIG-mvl-1); + p1 += mvl; + } *--p1 = (int) ((fj + .03) * 10) + '0'; r2++; } while (p1 cvt_buf[NDIG]) *p++ = *p1++; } else if (arg 0) { - while ((fj = arg * 10.0) 0.999) { + while ((fj = arg * 10) 1) { + if (!eflag (r2 * -1) ndigits) { + break; + } arg = fj; r2--; } @@ -109,10 +118,17 @@ cvt_buf[0] = '\0'; return (cvt_buf); } + if (p = p1 p cvt_buf[NDIG]) { + arg = modf(arg * 10, fj); + if ((int)fj==10) { + *p++ = '1'; + fj = 0; + *decpt = ++r2; + } while (p = p1 p cvt_buf[NDIG]) { - arg *= 10; - arg = modf(arg, fj); *p++ = (int) fj + '0'; + arg = modf(arg * 10, fj); + } } if (p1 = cvt_buf[NDIG]) { cvt_buf[NDIG - 1] = '\0'; @@ -286,7 +302,7 @@ char numbuf[NUM_BUF_SIZE]; char *cvt; register int i = 0, j = 0; - int sign, decpt; + int sign, decpt, cvt_len; char decimal_point = EG(float_separator)[0]; PRINTF_DEBUG((sprintf: appenddouble(%x, %x, %x, %f, %d, '%c', %d, %c)\n, @@ -312,6 +328,7 @@ } cvt = php_convert_to_decimal(number, precision, decpt, sign, (fmt == 'e')); + cvt_len = strlen(cvt); if (sign) { numbuf[i++] = '-'; @@ -330,10 +347,15 @@ } } } else { - while (decpt-- 0) - numbuf[i++] = cvt[j++]; - if (precision 0) + while (decpt-- 0) { + numbuf[i++] = j cvt_len ? cvt[j++] : '0'; + } + if (precision 0) { numbuf[i++] = decimal_point; + while (precision-- 0) { + numbuf[i++] = j cvt_len ? cvt[j++] : '0'; + } + } } } else if (fmt == 'e' || fmt == 'E') { char *exp_p; http://cvs.php.net/co.php/php-src/ext/standard/tests/strings/sprintf_f.phpt?r=1.1p=1 Index: php-src/ext/standard/tests/strings/sprintf_f.phpt +++