From 483636b67e1f806cae2264062bbb83a90646702a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Sat, 29 Feb 2020 22:47:04 +0100 Subject: [PATCH 1/4] Make float to string casts locale-independent --- Zend/zend.c | 1 + Zend/zend_globals.h | 1 + Zend/zend_operators.c | 36 ++++-- ext/intl/tests/bug67052-win32.phpt | 2 +- ext/intl/tests/bug67052.phpt | 2 +- ext/json/tests/bug41403.phpt | 6 +- ext/pdo/pdo_stmt.c | 11 +- ext/soap/tests/bugs/bug39815.phpt | 2 +- .../consistent_float_string_casts.phpt | 30 +++++ .../locale_independent_float_to_string.phpt | 101 ++++++++++++++++ ...ndependent_float_to_string_debug_mode.phpt | 113 ++++++++++++++++++ ext/standard/var.c | 4 +- main/main.c | 19 +++ main/php.h | 4 +- tests/lang/034.phpt | 2 +- 15 files changed, 302 insertions(+), 32 deletions(-) create mode 100644 ext/standard/tests/strings/consistent_float_string_casts.phpt create mode 100644 ext/standard/tests/strings/locale_independent_float_to_string.phpt create mode 100644 ext/standard/tests/strings/locale_independent_float_to_string_debug_mode.phpt diff --git a/Zend/zend.c b/Zend/zend.c index 40dd8991a1ea0..3d1457ceb5256 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -158,6 +158,7 @@ static ZEND_INI_MH(OnUpdateAssertions) /* {{{ */ ZEND_INI_BEGIN() ZEND_INI_ENTRY("error_reporting", NULL, ZEND_INI_ALL, OnUpdateErrorReporting) + STD_ZEND_INI_BOOLEAN("debug_locale_sensitive_float_casts", "0", ZEND_INI_ALL, OnUpdateBool, debug_locale_sensitive_float_casts, zend_executor_globals, executor_globals) STD_ZEND_INI_ENTRY("zend.assertions", "1", ZEND_INI_ALL, OnUpdateAssertions, assertions, zend_executor_globals, executor_globals) ZEND_INI_ENTRY3_EX("zend.enable_gc", "1", ZEND_INI_ALL, OnUpdateGCEnabled, NULL, NULL, NULL, zend_gc_enabled_displayer_cb) STD_ZEND_INI_BOOLEAN("zend.multibyte", "0", ZEND_INI_PERDIR, OnUpdateBool, multibyte, zend_compiler_globals, compiler_globals) diff --git a/Zend/zend_globals.h b/Zend/zend_globals.h index 298c22fe61651..a26d696be559e 100644 --- a/Zend/zend_globals.h +++ b/Zend/zend_globals.h @@ -237,6 +237,7 @@ struct _zend_executor_globals { HashTable weakrefs; zend_bool exception_ignore_args; + zend_bool debug_locale_sensitive_float_casts; zend_get_gc_buffer get_gc_buffer; diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index 012e95d3b2593..792e73bf9990e 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -607,15 +607,7 @@ ZEND_API void ZEND_FASTCALL convert_to_boolean(zval *op) /* {{{ */ ZEND_API void ZEND_FASTCALL _convert_to_cstring(zval *op) /* {{{ */ { - if (Z_TYPE_P(op) == IS_DOUBLE) { - zend_string *str; - double dval = Z_DVAL_P(op); - - str = zend_strpprintf_unchecked(0, "%.*H", (int) EG(precision), dval); - ZVAL_NEW_STR(op, str); - } else { - _convert_to_string(op); - } + _convert_to_string(op); } /* }}} */ @@ -648,8 +640,17 @@ ZEND_API void ZEND_FASTCALL _convert_to_string(zval *op) /* {{{ */ zend_string *str; double dval = Z_DVAL_P(op); - str = zend_strpprintf(0, "%.*G", (int) EG(precision), dval); - /* %G already handles removing trailing zeros from the fractional part, yay */ + str = zend_strpprintf_unchecked(0, "%.*H", (int) EG(precision), dval); + + if (EG(debug_locale_sensitive_float_casts)) { + zend_string *original_str = zend_strpprintf(0, "%.*G", (int) EG(precision), dval); + + if (!zend_string_equals(str, original_str)) { + zend_error(E_WARNING, "Locale-independent float to string conversion"); + } + zend_string_release(original_str); + } + ZVAL_NEW_STR(op, str); break; } @@ -953,7 +954,18 @@ static zend_always_inline zend_string* __zval_get_string_func(zval *op, zend_boo return zend_long_to_str(Z_LVAL_P(op)); } case IS_DOUBLE: { - return zend_strpprintf(0, "%.*G", (int) EG(precision), Z_DVAL_P(op)); + zend_string *str = zend_strpprintf_unchecked(0, "%.*H", (int) EG(precision), Z_DVAL_P(op)); + + if (EG(debug_locale_sensitive_float_casts)) { + zend_string *original_str = zend_strpprintf(0, "%.*G", (int) EG(precision), Z_DVAL_P(op)); + + if (!zend_string_equals(str, original_str)) { + zend_error(E_WARNING, "Locale-independent float to string conversion"); + } + zend_string_release(original_str); + } + + return str; } case IS_ARRAY: zend_error(E_WARNING, "Array to string conversion"); diff --git a/ext/intl/tests/bug67052-win32.phpt b/ext/intl/tests/bug67052-win32.phpt index 2c27624562281..060a98b9fb342 100644 --- a/ext/intl/tests/bug67052-win32.phpt +++ b/ext/intl/tests/bug67052-win32.phpt @@ -25,5 +25,5 @@ ut_run(); ?> --EXPECT-- -1234567,891 +1234567.891 de-de diff --git a/ext/intl/tests/bug67052.phpt b/ext/intl/tests/bug67052.phpt index 6cdfd9f5a9401..56d825aa5d348 100644 --- a/ext/intl/tests/bug67052.phpt +++ b/ext/intl/tests/bug67052.phpt @@ -30,5 +30,5 @@ ut_run(); ?> --EXPECT-- -1234567,891 +1234567.891 de_DE.UTF-8 diff --git a/ext/json/tests/bug41403.phpt b/ext/json/tests/bug41403.phpt index 685c8318387ff..91b4de7ead4e8 100644 --- a/ext/json/tests/bug41403.phpt +++ b/ext/json/tests/bug41403.phpt @@ -23,15 +23,15 @@ echo "Done\n"; --EXPECT-- array(1) { [0]=> - float(2,1) + float(2.1) } array(1) { [0]=> - float(0,15) + float(0.15) } array(1) { [0]=> - float(123,13452345) + float(123.13452345) } array(2) { [0]=> diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c index 42cc447608e24..b095425cafd7a 100644 --- a/ext/pdo/pdo_stmt.c +++ b/ext/pdo/pdo_stmt.c @@ -230,15 +230,8 @@ static int really_register_bound_param(struct pdo_bound_param_data *param, pdo_s } if (PDO_PARAM_TYPE(param->param_type) == PDO_PARAM_STR && param->max_value_len <= 0 && !Z_ISNULL_P(parameter)) { - if (Z_TYPE_P(parameter) == IS_DOUBLE) { - char *p; - int len = zend_spprintf_unchecked(&p, 0, "%.*H", (int) EG(precision), Z_DVAL_P(parameter)); - ZVAL_STRINGL(parameter, p, len); - efree(p); - } else { - if (!try_convert_to_string(parameter)) { - return 0; - } + if (!try_convert_to_string(parameter)) { + return 0; } } else if (PDO_PARAM_TYPE(param->param_type) == PDO_PARAM_INT && (Z_TYPE_P(parameter) == IS_FALSE || Z_TYPE_P(parameter) == IS_TRUE)) { convert_to_long(parameter); diff --git a/ext/soap/tests/bugs/bug39815.phpt b/ext/soap/tests/bugs/bug39815.phpt index 57b429ec432db..e8786ada5acbf 100644 --- a/ext/soap/tests/bugs/bug39815.phpt +++ b/ext/soap/tests/bugs/bug39815.phpt @@ -41,7 +41,7 @@ setlocale(LC_ALL,"en_US","en_US.ISO8859-1"); var_dump($x->test()); echo $x->__getLastResponse(); --EXPECT-- -float(123,456) +float(123.456) 123.456 float(123.456) diff --git a/ext/standard/tests/strings/consistent_float_string_casts.phpt b/ext/standard/tests/strings/consistent_float_string_casts.phpt new file mode 100644 index 0000000000000..adbc1b23ae8b1 --- /dev/null +++ b/ext/standard/tests/strings/consistent_float_string_casts.phpt @@ -0,0 +1,30 @@ +--TEST-- +Test that float to string and string to float casts are consistent +--SKIPIF-- + +--FILE-- + +--EXPECT-- +0,33 diff --git a/ext/standard/tests/strings/locale_independent_float_to_string.phpt b/ext/standard/tests/strings/locale_independent_float_to_string.phpt new file mode 100644 index 0000000000000..86da22f789a04 --- /dev/null +++ b/ext/standard/tests/strings/locale_independent_float_to_string.phpt @@ -0,0 +1,101 @@ +--TEST-- +Test that floats are converted to string locale independently +--SKIPIF-- + +--FILE-- + +--EXPECT-- +C locale: +- casting: +3.14 +3.14 +3.14 +- *printf functions: +3.14 +3.14 +3.14 +3.14 +- export/import: +3.14 +d:3.14; +3.14 +- debugging: +3.14 +float(3.14) +float(3.14) +- other: +3.14 + +de_DE locale: +- casting: +3.14 +3.14 +3.14 +- *printf functions: +3,14 +3.14 +3,14 +3.14 +- export/import: +3.14 +d:3.14; +3.14 +- debugging: +3.14 +float(3.14) +float(3.14) +- other: +3.14 diff --git a/ext/standard/tests/strings/locale_independent_float_to_string_debug_mode.phpt b/ext/standard/tests/strings/locale_independent_float_to_string_debug_mode.phpt new file mode 100644 index 0000000000000..8677a9c0f4fd7 --- /dev/null +++ b/ext/standard/tests/strings/locale_independent_float_to_string_debug_mode.phpt @@ -0,0 +1,113 @@ +--TEST-- +Test that floats are converted to string locale independently +--SKIPIF-- + +--INI-- +debug_locale_sensitive_float_casts=1 +--FILE-- + +--EXPECTF-- +C locale: +- casting: +3.14 +3.14 +3.14 +- *printf functions: +3.14 +3.14 +3.14 +3.14 +- export/import: +3.14 +d:3.14; +3.14 +- debugging: +3.14 +float(3.14) +float(3.14) +- other: +3.14 + +de_DE locale: +- casting: + +Warning: Locale-independent float to string conversion in %s on line %d +3.14 + +Warning: Locale-independent float to string conversion in %s on line %d +3.14 + +Warning: Locale-independent float to string conversion in %s on line %d +3.14 +- *printf functions: +3,14 +3.14 +3,14 +3.14 +- export/import: +3.14 +d:3.14; +3.14 +- debugging: + +Warning: Locale-independent float to string conversion in %s on line %d +3.14 +float(3.14) +float(3.14) +- other: + +Warning: Locale-independent float to string conversion in %s on line %d +3.14 diff --git a/ext/standard/var.c b/ext/standard/var.c index 609acf449e1fa..5b4fd8fe54fd7 100644 --- a/ext/standard/var.c +++ b/ext/standard/var.c @@ -114,7 +114,7 @@ PHPAPI void php_var_dump(zval *struc, int level) /* {{{ */ php_printf("%sint(" ZEND_LONG_FMT ")\n", COMMON, Z_LVAL_P(struc)); break; case IS_DOUBLE: - php_printf("%sfloat(%.*G)\n", COMMON, (int) PG(serialize_precision), Z_DVAL_P(struc)); + php_printf_unchecked("%sfloat(%.*H)\n", COMMON, (int) PG(serialize_precision), Z_DVAL_P(struc)); break; case IS_STRING: php_printf("%sstring(%zd) \"", COMMON, Z_STRLEN_P(struc)); @@ -295,7 +295,7 @@ PHPAPI void php_debug_zval_dump(zval *struc, int level) /* {{{ */ php_printf("%sint(" ZEND_LONG_FMT ")\n", COMMON, Z_LVAL_P(struc)); break; case IS_DOUBLE: - php_printf("%sfloat(%.*G)\n", COMMON, (int) PG(serialize_precision), Z_DVAL_P(struc)); + php_printf_unchecked("%sfloat(%.*H)\n", COMMON, (int) PG(serialize_precision), Z_DVAL_P(struc)); break; case IS_STRING: php_printf("%sstring(%zd) \"", COMMON, Z_STRLEN_P(struc)); diff --git a/main/main.c b/main/main.c index 98aaa5beceb24..eef57c690fba7 100644 --- a/main/main.c +++ b/main/main.c @@ -912,6 +912,25 @@ PHPAPI size_t php_printf(const char *format, ...) } /* }}} */ +/* {{{ php_printf_unchecked + */ +PHPAPI size_t php_printf_unchecked(const char *format, ...) +{ + va_list args; + size_t ret; + char *buffer; + size_t size; + + va_start(args, format); + size = vspprintf(&buffer, 0, format, args); + ret = PHPWRITE(buffer, size); + efree(buffer); + va_end(args); + + return ret; +} +/* }}} */ + static zend_string *escape_html(const char *buffer, size_t buffer_len) { zend_string *result = php_escape_html_entities_ex( (const unsigned char *) buffer, buffer_len, 0, ENT_COMPAT, diff --git a/main/php.h b/main/php.h index a20b4a3bfc551..87f7d000f9fde 100644 --- a/main/php.h +++ b/main/php.h @@ -309,8 +309,8 @@ ssize_t pread(int, void *, size_t, off64_t); BEGIN_EXTERN_C() void phperror(char *error); PHPAPI size_t php_write(void *buf, size_t size); -PHPAPI size_t php_printf(const char *format, ...) PHP_ATTRIBUTE_FORMAT(printf, 1, - 2); +PHPAPI size_t php_printf(const char *format, ...) PHP_ATTRIBUTE_FORMAT(printf, 1, 2); +PHPAPI size_t php_printf_unchecked(const char *format, ...); PHPAPI int php_get_module_initialized(void); #ifdef HAVE_SYSLOG_H #include "php_syslog.h" diff --git a/tests/lang/034.phpt b/tests/lang/034.phpt index 38ecc0b451563..2ed6bce9d7b8b 100644 --- a/tests/lang/034.phpt +++ b/tests/lang/034.phpt @@ -16,4 +16,4 @@ setlocale(LC_NUMERIC, "de_DE.UTF-8", "de_DE", "de", "german", "ge", "de_DE.ISO-8 echo (float)"3.14", "\n"; ?> --EXPECT-- -3,14 +3.14 From 1209669f63f9f01f5bfccd46ef407f40d1ce1496 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Wed, 6 May 2020 08:35:28 +0200 Subject: [PATCH 2/4] Finalize implementation --- Zend/zend.c | 1 - Zend/zend_globals.h | 1 - Zend/zend_operators.c | 18 --- .../locale_independent_float_to_string.phpt | 8 +- ...ndependent_float_to_string_debug_mode.phpt | 113 ------------------ .../basic}/consistent_float_string_casts.phpt | 0 6 files changed, 7 insertions(+), 134 deletions(-) delete mode 100644 ext/standard/tests/strings/locale_independent_float_to_string_debug_mode.phpt rename {ext/standard/tests/strings => tests/basic}/consistent_float_string_casts.phpt (100%) diff --git a/Zend/zend.c b/Zend/zend.c index 3d1457ceb5256..40dd8991a1ea0 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -158,7 +158,6 @@ static ZEND_INI_MH(OnUpdateAssertions) /* {{{ */ ZEND_INI_BEGIN() ZEND_INI_ENTRY("error_reporting", NULL, ZEND_INI_ALL, OnUpdateErrorReporting) - STD_ZEND_INI_BOOLEAN("debug_locale_sensitive_float_casts", "0", ZEND_INI_ALL, OnUpdateBool, debug_locale_sensitive_float_casts, zend_executor_globals, executor_globals) STD_ZEND_INI_ENTRY("zend.assertions", "1", ZEND_INI_ALL, OnUpdateAssertions, assertions, zend_executor_globals, executor_globals) ZEND_INI_ENTRY3_EX("zend.enable_gc", "1", ZEND_INI_ALL, OnUpdateGCEnabled, NULL, NULL, NULL, zend_gc_enabled_displayer_cb) STD_ZEND_INI_BOOLEAN("zend.multibyte", "0", ZEND_INI_PERDIR, OnUpdateBool, multibyte, zend_compiler_globals, compiler_globals) diff --git a/Zend/zend_globals.h b/Zend/zend_globals.h index a26d696be559e..298c22fe61651 100644 --- a/Zend/zend_globals.h +++ b/Zend/zend_globals.h @@ -237,7 +237,6 @@ struct _zend_executor_globals { HashTable weakrefs; zend_bool exception_ignore_args; - zend_bool debug_locale_sensitive_float_casts; zend_get_gc_buffer get_gc_buffer; diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index 792e73bf9990e..4dbcabee9f041 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -642,15 +642,6 @@ ZEND_API void ZEND_FASTCALL _convert_to_string(zval *op) /* {{{ */ str = zend_strpprintf_unchecked(0, "%.*H", (int) EG(precision), dval); - if (EG(debug_locale_sensitive_float_casts)) { - zend_string *original_str = zend_strpprintf(0, "%.*G", (int) EG(precision), dval); - - if (!zend_string_equals(str, original_str)) { - zend_error(E_WARNING, "Locale-independent float to string conversion"); - } - zend_string_release(original_str); - } - ZVAL_NEW_STR(op, str); break; } @@ -956,15 +947,6 @@ static zend_always_inline zend_string* __zval_get_string_func(zval *op, zend_boo case IS_DOUBLE: { zend_string *str = zend_strpprintf_unchecked(0, "%.*H", (int) EG(precision), Z_DVAL_P(op)); - if (EG(debug_locale_sensitive_float_casts)) { - zend_string *original_str = zend_strpprintf(0, "%.*G", (int) EG(precision), Z_DVAL_P(op)); - - if (!zend_string_equals(str, original_str)) { - zend_error(E_WARNING, "Locale-independent float to string conversion"); - } - zend_string_release(original_str); - } - return str; } case IS_ARRAY: diff --git a/ext/standard/tests/strings/locale_independent_float_to_string.phpt b/ext/standard/tests/strings/locale_independent_float_to_string.phpt index 86da22f789a04..634d2ce0e6f2f 100644 --- a/ext/standard/tests/strings/locale_independent_float_to_string.phpt +++ b/ext/standard/tests/strings/locale_independent_float_to_string.phpt @@ -2,13 +2,19 @@ Test that floats are converted to string locale independently --SKIPIF-- --FILE-- ---INI-- -debug_locale_sensitive_float_casts=1 ---FILE-- - ---EXPECTF-- -C locale: -- casting: -3.14 -3.14 -3.14 -- *printf functions: -3.14 -3.14 -3.14 -3.14 -- export/import: -3.14 -d:3.14; -3.14 -- debugging: -3.14 -float(3.14) -float(3.14) -- other: -3.14 - -de_DE locale: -- casting: - -Warning: Locale-independent float to string conversion in %s on line %d -3.14 - -Warning: Locale-independent float to string conversion in %s on line %d -3.14 - -Warning: Locale-independent float to string conversion in %s on line %d -3.14 -- *printf functions: -3,14 -3.14 -3,14 -3.14 -- export/import: -3.14 -d:3.14; -3.14 -- debugging: - -Warning: Locale-independent float to string conversion in %s on line %d -3.14 -float(3.14) -float(3.14) -- other: - -Warning: Locale-independent float to string conversion in %s on line %d -3.14 diff --git a/ext/standard/tests/strings/consistent_float_string_casts.phpt b/tests/basic/consistent_float_string_casts.phpt similarity index 100% rename from ext/standard/tests/strings/consistent_float_string_casts.phpt rename to tests/basic/consistent_float_string_casts.phpt From b57176282b8ead6bc80fe4818d8a6a1d72b33e0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Thu, 7 May 2020 10:00:46 +0200 Subject: [PATCH 3/4] Add UPGRADING note --- UPGRADING | 2 ++ 1 file changed, 2 insertions(+) diff --git a/UPGRADING b/UPGRADING index 84b345ff9cf22..5380b1058d58b 100644 --- a/UPGRADING +++ b/UPGRADING @@ -189,6 +189,8 @@ PHP 8.0 UPGRADE NOTES array, resource or non-overloaded object. The only exception to this is the array + array merge operation, which remains supported. RFC: https://wiki.php.net/rfc/arithmetic_operator_type_checks + . Float to string casting will now always behave locale-independently. + RFC: https://wiki.php.net/rfc/locale_independent_float_to_string - COM: . Removed the ability to import case-insensitive constants from type From 0b5adb0cd66b2383f2b1a0bd6b201d76f538c99a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Fri, 8 May 2020 10:05:02 +0200 Subject: [PATCH 4/4] Address code review comments --- Zend/zend_operators.c | 10 +--------- Zend/zend_operators.h | 2 -- ext/pgsql/pgsql.c | 2 +- 3 files changed, 2 insertions(+), 12 deletions(-) diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index 4dbcabee9f041..562a0f6d5418c 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -605,12 +605,6 @@ ZEND_API void ZEND_FASTCALL convert_to_boolean(zval *op) /* {{{ */ } /* }}} */ -ZEND_API void ZEND_FASTCALL _convert_to_cstring(zval *op) /* {{{ */ -{ - _convert_to_string(op); -} -/* }}} */ - ZEND_API void ZEND_FASTCALL _convert_to_string(zval *op) /* {{{ */ { try_again: @@ -945,9 +939,7 @@ static zend_always_inline zend_string* __zval_get_string_func(zval *op, zend_boo return zend_long_to_str(Z_LVAL_P(op)); } case IS_DOUBLE: { - zend_string *str = zend_strpprintf_unchecked(0, "%.*H", (int) EG(precision), Z_DVAL_P(op)); - - return str; + return zend_strpprintf_unchecked(0, "%.*H", (int) EG(precision), Z_DVAL_P(op)); } case IS_ARRAY: zend_error(E_WARNING, "Array to string conversion"); diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h index 13f236bbaa0ff..2c3766fd38965 100644 --- a/Zend/zend_operators.h +++ b/Zend/zend_operators.h @@ -257,7 +257,6 @@ ZEND_API int ZEND_FASTCALL increment_function(zval *op1); ZEND_API int ZEND_FASTCALL decrement_function(zval *op2); ZEND_API void ZEND_FASTCALL convert_scalar_to_number(zval *op); -ZEND_API void ZEND_FASTCALL _convert_to_cstring(zval *op); ZEND_API void ZEND_FASTCALL _convert_to_string(zval *op); ZEND_API void ZEND_FASTCALL convert_to_long(zval *op); ZEND_API void ZEND_FASTCALL convert_to_double(zval *op); @@ -340,7 +339,6 @@ static zend_always_inline zend_bool try_convert_to_string(zval *op) { #define _zval_get_double_func(op) zval_get_double_func(op) #define _zval_get_string_func(op) zval_get_string_func(op) -#define convert_to_cstring(op) if (Z_TYPE_P(op) != IS_STRING) { _convert_to_cstring((op)); } #define convert_to_string(op) if (Z_TYPE_P(op) != IS_STRING) { _convert_to_string((op)); } diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index 9450bf0f611be..3a4d6fd578a5c 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -1987,7 +1987,7 @@ PHP_FUNCTION(pg_query_params) zval tmp_val; ZVAL_COPY(&tmp_val, tmp); - convert_to_cstring(&tmp_val); + convert_to_string(&tmp_val); if (Z_TYPE(tmp_val) != IS_STRING) { php_error_docref(NULL, E_WARNING,"Error converting parameter"); zval_ptr_dtor(&tmp_val);