summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorGustavo André dos Santos Lopes <cataphract@php.net>2012-06-25 10:59:58 +0200
committerGustavo André dos Santos Lopes <cataphract@php.net>2012-06-25 10:59:58 +0200
commit9c5074a484b7f10e65471a21a7ef50dda8391509 (patch)
tree3f106a51663d8abca754f1dc77716e36b76116f7 /ext
parentee8b9d5c6f7390a56b277b170e2e3baee5c74bf4 (diff)
downloadphp-git-9c5074a484b7f10e65471a21a7ef50dda8391509.tar.gz
Fix undeclared intl_locale_get_default()
This was causing segfaults at least in the resourcebundle constructor. Also moved intl_locale_get_default() to a more central location and fixed a constness warning in resourcebundle_ctor().
Diffstat (limited to 'ext')
-rw-r--r--ext/intl/calendar/calendar_methods.cpp2
-rw-r--r--ext/intl/calendar/gregoriancalendar_methods.cpp2
-rwxr-xr-xext/intl/locale/locale.h2
-rwxr-xr-xext/intl/locale/locale_methods.c8
-rwxr-xr-xext/intl/php_intl.c8
-rwxr-xr-xext/intl/php_intl.h2
-rw-r--r--ext/intl/resourcebundle/resourcebundle_class.c13
-rw-r--r--ext/intl/timezone/timezone_methods.cpp2
8 files changed, 19 insertions, 20 deletions
diff --git a/ext/intl/calendar/calendar_methods.cpp b/ext/intl/calendar/calendar_methods.cpp
index 8562a2d69e..539b11a1f7 100644
--- a/ext/intl/calendar/calendar_methods.cpp
+++ b/ext/intl/calendar/calendar_methods.cpp
@@ -25,12 +25,12 @@
#include <unicode/ustring.h>
#include "../intl_convertcpp.h"
extern "C" {
+#include "../php_intl.h"
#define USE_TIMEZONE_POINTER 1
#include "../timezone/timezone_class.h"
#define USE_CALENDAR_POINTER 1
#include "calendar_class.h"
#include "../intl_convert.h"
-#include "../locale/locale.h"
#include <zend_exceptions.h>
#include <zend_interfaces.h>
#include <ext/date/php_date.h>
diff --git a/ext/intl/calendar/gregoriancalendar_methods.cpp b/ext/intl/calendar/gregoriancalendar_methods.cpp
index 47e84633a2..3c05253de1 100644
--- a/ext/intl/calendar/gregoriancalendar_methods.cpp
+++ b/ext/intl/calendar/gregoriancalendar_methods.cpp
@@ -24,11 +24,11 @@
#include <unicode/calendar.h>
#include <unicode/gregocal.h>
extern "C" {
+#include "../php_intl.h"
#define USE_TIMEZONE_POINTER 1
#include "../timezone/timezone_class.h"
#define USE_CALENDAR_POINTER 1
#include "calendar_class.h"
-#include "../locale/locale.h"
#include <ext/date/php_date.h>
}
diff --git a/ext/intl/locale/locale.h b/ext/intl/locale/locale.h
index 0aaab4b5b5..f3859c7a2a 100755
--- a/ext/intl/locale/locale.h
+++ b/ext/intl/locale/locale.h
@@ -22,8 +22,6 @@
#include <php.h>
void locale_register_constants( INIT_FUNC_ARGS );
-
-const char *intl_locale_get_default( TSRMLS_D );
#define OPTION_DEFAULT NULL
#define LOC_LANG_TAG "language"
diff --git a/ext/intl/locale/locale_methods.c b/ext/intl/locale/locale_methods.c
index 466dba1f20..936e3142ad 100755
--- a/ext/intl/locale/locale_methods.c
+++ b/ext/intl/locale/locale_methods.c
@@ -201,14 +201,6 @@ static int getSingletonPos(char* str)
}
/* }}} */
-const char *intl_locale_get_default( TSRMLS_D )
-{
- if( INTL_G(default_locale) == NULL ) {
- return uloc_getDefault();
- }
- return INTL_G(default_locale);
-}
-
/* {{{ proto static string Locale::getDefault( )
Get default locale */
/* }}} */
diff --git a/ext/intl/php_intl.c b/ext/intl/php_intl.c
index 59272db712..e0d1081514 100755
--- a/ext/intl/php_intl.c
+++ b/ext/intl/php_intl.c
@@ -109,6 +109,14 @@
ZEND_DECLARE_MODULE_GLOBALS( intl )
+const char *intl_locale_get_default( TSRMLS_D )
+{
+ if( INTL_G(default_locale) == NULL ) {
+ return uloc_getDefault();
+ }
+ return INTL_G(default_locale);
+}
+
/* {{{ Arguments info */
ZEND_BEGIN_ARG_INFO_EX(collator_static_0_args, 0, 0, 0)
ZEND_END_ARG_INFO()
diff --git a/ext/intl/php_intl.h b/ext/intl/php_intl.h
index c3d5c60f07..7a7112317d 100755
--- a/ext/intl/php_intl.h
+++ b/ext/intl/php_intl.h
@@ -69,6 +69,8 @@ PHP_RINIT_FUNCTION(intl);
PHP_RSHUTDOWN_FUNCTION(intl);
PHP_MINFO_FUNCTION(intl);
+const char *intl_locale_get_default( TSRMLS_D );
+
#define PHP_INTL_VERSION "1.1.0"
#endif /* PHP_INTL_H */
diff --git a/ext/intl/resourcebundle/resourcebundle_class.c b/ext/intl/resourcebundle/resourcebundle_class.c
index 3d7fd5f00a..7f1529e519 100644
--- a/ext/intl/resourcebundle/resourcebundle_class.c
+++ b/ext/intl/resourcebundle/resourcebundle_class.c
@@ -78,13 +78,11 @@ static zend_object_value ResourceBundle_object_create( zend_class_entry *ce TSRM
/* {{{ ResourceBundle_ctor */
static void resourcebundle_ctor(INTERNAL_FUNCTION_PARAMETERS)
{
- char * bundlename;
- int bundlename_len = 0;
- char * locale;
- int locale_len = 0;
- zend_bool fallback = 1;
-
- char * pbuf;
+ const char *bundlename;
+ int bundlename_len = 0;
+ const char *locale;
+ int locale_len = 0;
+ zend_bool fallback = 1;
zval *object = return_value;
ResourceBundle_object *rb = (ResourceBundle_object *) zend_object_store_get_object( object TSRMLS_CC);
@@ -116,6 +114,7 @@ static void resourcebundle_ctor(INTERNAL_FUNCTION_PARAMETERS)
if (!fallback && (INTL_DATA_ERROR_CODE(rb) == U_USING_FALLBACK_WARNING ||
INTL_DATA_ERROR_CODE(rb) == U_USING_DEFAULT_WARNING)) {
+ char *pbuf;
intl_errors_set_code(NULL, INTL_DATA_ERROR_CODE(rb) TSRMLS_CC);
spprintf(&pbuf, 0, "resourcebundle_ctor: Cannot load libICU resource "
"'%s' without fallback from %s to %s",
diff --git a/ext/intl/timezone/timezone_methods.cpp b/ext/intl/timezone/timezone_methods.cpp
index 1435679fe7..caf5dcdedc 100644
--- a/ext/intl/timezone/timezone_methods.cpp
+++ b/ext/intl/timezone/timezone_methods.cpp
@@ -25,10 +25,10 @@
#include <unicode/ustring.h>
#include "intl_convertcpp.h"
extern "C" {
+#include "../php_intl.h"
#define USE_TIMEZONE_POINTER 1
#include "timezone_class.h"
#include "intl_convert.h"
-#include "../locale/locale.h"
#include <zend_exceptions.h>
#include <ext/date/php_date.h>
}