diff options
author | Gustavo Lopes <glopes@nebm.ist.utl.pt> | 2012-08-22 22:37:52 +0200 |
---|---|---|
committer | Gustavo Lopes <glopes@nebm.ist.utl.pt> | 2012-08-22 22:37:52 +0200 |
commit | 87803ace94454a71a04c87f85c938ceffc100bcf (patch) | |
tree | 082e4a8e2d9e5bd2e685b984a6a920695803bafc /ext/intl/resourcebundle | |
parent | fbacf9c237f4fb60af453ff77c08e7513ec93024 (diff) | |
parent | a5d0c1e21b9fa166d8fe5ec7d52a24a5f7adc107 (diff) | |
download | php-git-87803ace94454a71a04c87f85c938ceffc100bcf.tar.gz |
Merge branch 'PHP-5.3' into PHP-5.4
* PHP-5.3:
Fix handling of several uinitialized intl objects
Diffstat (limited to 'ext/intl/resourcebundle')
-rw-r--r-- | ext/intl/resourcebundle/resourcebundle_class.c | 9 | ||||
-rw-r--r-- | ext/intl/resourcebundle/resourcebundle_class.h | 11 |
2 files changed, 18 insertions, 2 deletions
diff --git a/ext/intl/resourcebundle/resourcebundle_class.c b/ext/intl/resourcebundle/resourcebundle_class.c index 23e9449a38..a6a73f5f04 100644 --- a/ext/intl/resourcebundle/resourcebundle_class.c +++ b/ext/intl/resourcebundle/resourcebundle_class.c @@ -261,7 +261,14 @@ PHP_FUNCTION( resourcebundle_get ) /* {{{ resourcebundle_array_count */ int resourcebundle_array_count(zval *object, long *count TSRMLS_DC) { - ResourceBundle_object *rb = (ResourceBundle_object *) zend_object_store_get_object( object TSRMLS_CC); + ResourceBundle_object *rb; + RESOURCEBUNDLE_METHOD_FETCH_OBJECT_NO_CHECK; + + if (rb->me == NULL) { + intl_errors_set(&rb->error, U_ILLEGAL_ARGUMENT_ERROR, + "Found unconstructed ResourceBundle", 0 TSRMLS_CC); + return 0; + } *count = ures_getSize( rb->me ); diff --git a/ext/intl/resourcebundle/resourcebundle_class.h b/ext/intl/resourcebundle/resourcebundle_class.h index 4755d723b8..8da3ed9d47 100644 --- a/ext/intl/resourcebundle/resourcebundle_class.h +++ b/ext/intl/resourcebundle/resourcebundle_class.h @@ -33,7 +33,16 @@ typedef struct { } ResourceBundle_object; #define RESOURCEBUNDLE_METHOD_INIT_VARS INTL_METHOD_INIT_VARS(ResourceBundle, rb) -#define RESOURCEBUNDLE_METHOD_FETCH_OBJECT INTL_METHOD_FETCH_OBJECT(ResourceBundle, rb) +#define RESOURCEBUNDLE_METHOD_FETCH_OBJECT_NO_CHECK INTL_METHOD_FETCH_OBJECT(ResourceBundle, rb) +#define RESOURCEBUNDLE_METHOD_FETCH_OBJECT \ + INTL_METHOD_FETCH_OBJECT(ResourceBundle, rb); \ + if (RESOURCEBUNDLE_OBJECT(rb) == NULL) { \ + intl_errors_set(&rb->error, U_ILLEGAL_ARGUMENT_ERROR, \ + "Found unconstructed ResourceBundle", 0 TSRMLS_CC); \ + RETURN_FALSE; \ + } + + #define RESOURCEBUNDLE_OBJECT(rb) (rb)->me void resourcebundle_register_class( TSRMLS_D ); |