fa Wed, 02 Nov 2011 07:36:52 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=318672
Log:
Fix #60192 SegFault when Collator not constructed properly
Bug: https://bugs.php.net/60192 (Assigned) SegFault when Collator not
constructed properly
Changed paths:
U php/php-src/branches/PHP_5_3/ext/intl/collator/collator_compare.c
U php/php-src/branches/PHP_5_3/ext/intl/collator/collator_locale.c
U php/php-src/branches/PHP_5_3/ext/intl/collator/collator_sort.c
A php/php-src/branches/PHP_5_3/ext/intl/tests/bug60192-compare.phpt
A php/php-src/branches/PHP_5_3/ext/intl/tests/bug60192-getlocale.phpt
A php/php-src/branches/PHP_5_3/ext/intl/tests/bug60192-getsortkey.phpt
A php/php-src/branches/PHP_5_3/ext/intl/tests/bug60192-sort.phpt
A
php/php-src/branches/PHP_5_3/ext/intl/tests/bug60192-sortwithsortkeys.phpt
U php/php-src/branches/PHP_5_4/ext/intl/collator/collator_compare.c
U php/php-src/branches/PHP_5_4/ext/intl/collator/collator_locale.c
U php/php-src/branches/PHP_5_4/ext/intl/collator/collator_sort.c
A php/php-src/branches/PHP_5_4/ext/intl/tests/bug60192-compare.phpt
A php/php-src/branches/PHP_5_4/ext/intl/tests/bug60192-getlocale.phpt
A php/php-src/branches/PHP_5_4/ext/intl/tests/bug60192-getsortkey.phpt
A php/php-src/branches/PHP_5_4/ext/intl/tests/bug60192-sort.phpt
A
php/php-src/branches/PHP_5_4/ext/intl/tests/bug60192-sortwithsortkeys.phpt
U php/php-src/trunk/ext/intl/collator/collator_compare.c
U php/php-src/trunk/ext/intl/collator/collator_locale.c
U php/php-src/trunk/ext/intl/collator/collator_sort.c
A php/php-src/trunk/ext/intl/tests/bug60192-compare.phpt
A php/php-src/trunk/ext/intl/tests/bug60192-getlocale.phpt
A php/php-src/trunk/ext/intl/tests/bug60192-getsortkey.phpt
A php/php-src/trunk/ext/intl/tests/bug60192-sort.phpt
A php/php-src/trunk/ext/intl/tests/bug60192-sortwithsortkeys.phpt
Modified: php/php-src/branches/PHP_5_3/ext/intl/collator/collator_compare.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/intl/collator/collator_compare.c 2011-11-02 06:31:33 UTC (rev 318671)
+++ php/php-src/branches/PHP_5_3/ext/intl/collator/collator_compare.c 2011-11-02 07:36:52 UTC (rev 318672)
@@ -99,6 +99,10 @@
RETURN_FALSE;
}
+ if (!co || !co->ucoll) {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Object not initialized");
+ }
+
/* Then compare them. */
result = ucol_strcoll(
co->ucoll,
Modified: php/php-src/branches/PHP_5_3/ext/intl/collator/collator_locale.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/intl/collator/collator_locale.c 2011-11-02 06:31:33 UTC (rev 318671)
+++ php/php-src/branches/PHP_5_3/ext/intl/collator/collator_locale.c 2011-11-02 07:36:52 UTC (rev 318672)
@@ -51,6 +51,10 @@
/* Fetch the object. */
COLLATOR_METHOD_FETCH_OBJECT;
+ if (!co || !co->ucoll) {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Object not initialized");
+ }
+
/* Get locale by specified type. */
locale_name = (char*) ucol_getLocaleByType(
co->ucoll, type, COLLATOR_ERROR_CODE_P( co ) );
Modified: php/php-src/branches/PHP_5_3/ext/intl/collator/collator_sort.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/intl/collator/collator_sort.c 2011-11-02 06:31:33 UTC (rev 318671)
+++ php/php-src/branches/PHP_5_3/ext/intl/collator/collator_sort.c 2011-11-02 07:36:52 UTC (rev 318672)
@@ -73,6 +73,10 @@
/* Fetch collator object. */
co = (Collator_object *) zend_object_store_get_object( INTL_G(current_collator) TSRMLS_CC );
+ if (!co || !co->ucoll) {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Object not initialized");
+ }
+
/* Compare the strings using ICU. */
result->value.lval = ucol_strcoll(
co->ucoll,
@@ -441,6 +445,10 @@
/* Get sort key, reallocating the buffer if needed. */
bufLeft = sortKeyBufSize - sortKeyBufOffset;
+ if (!co || !co->ucoll) {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Object not initialized");
+ }
+
sortKeyLen = ucol_getSortKey( co->ucoll,
utf16_buf,
utf16_len,
@@ -571,6 +579,10 @@
RETURN_FALSE;
}
+ if (!co || !co->ucoll) {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Object not initialized");
+ }
+
key_len = ucol_getSortKey(co->ucoll, ustr, ustr_len, key, 0);
if(!key_len) {
efree( ustr );
Added: php/php-src/branches/PHP_5_3/ext/intl/tests/bug60192-compare.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/intl/tests/bug60192-compare.phpt (rev 0)
+++ php/php-src/branches/PHP_5_3/ext/intl/tests/bug60192-compare.phpt 2011-11-02 07:36:52 UTC (rev 318672)
@@ -0,0 +1,20 @@
+--TEST--
+Bug #60192 (SegFault when Collator not constructed properly)
+--SKIPIF--
+<?php
+ if (!extension_loaded('intl')) { die('skip intl extension not available'); }
+?>
+--FILE--
+<?php
+
+class Collator2 extends Collator{
+ public function __construct() {
+ // ommitting parent::__construct($someLocale);
+ }
+}
+
+$c = new Collator2();
+$c->compare('h', 'H');
+--EXPECTF--
+
+Fatal error: Collator::compare(): Object not initialized in %s on line %d
Added: php/php-src/branches/PHP_5_3/ext/intl/tests/bug60192-getlocale.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/intl/tests/bug60192-getlocale.phpt (rev 0)
+++ php/php-src/branches/PHP_5_3/ext/intl/tests/bug60192-getlocale.phpt 2011-11-02 07:36:52 UTC (rev 318672)
@@ -0,0 +1,20 @@
+--TEST--
+Bug #60192 (SegFault when Collator not constructed properly)
+--SKIPIF--
+<?php
+ if (!extension_loaded('intl')) { die('skip intl extension not available'); }
+?>
+--FILE--
+<?php
+
+class Collator2 extends Collator{
+ public function __construct() {
+ // ommitting parent::__construct($someLocale);
+ }
+}
+
+$c = new Collator2();
+$c->getLocale(Locale::ACTUAL_LOCALE);
+--EXPECTF--
+
+Fatal error: Collator::getLocale(): Object not initialized in %s on line %d
Added: php/php-src/branches/PHP_5_3/ext/intl/tests/bug60192-getsortkey.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/intl/tests/bug60192-getsortkey.phpt (rev 0)
+++ php/php-src/branches/PHP_5_3/ext/intl/tests/bug60192-getsortkey.phpt 2011-11-02 07:36:52 UTC (rev 318672)
@@ -0,0 +1,20 @@
+--TEST--
+Bug #60192 (SegFault when Collator not constructed properly)
+--SKIPIF--
+<?php
+ if (!extension_loaded('intl')) { die('skip intl extension not available'); }
+?>
+--FILE--
+<?php
+
+class Collator2 extends Collator{
+ public function __construct() {
+ // ommitting parent::__construct($someLocale);
+ }
+}
+
+$c = new Collator2();
+$c->getSortKey('h');
+--EXPECTF--
+
+Fatal error: Collator::getSortKey(): Object not initialized in %s on line %d
Added: php/php-src/branches/PHP_5_3/ext/intl/tests/bug60192-sort.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/intl/tests/bug60192-sort.phpt (rev 0)
+++ php/php-src/branches/PHP_5_3/ext/intl/tests/bug60192-sort.phpt 2011-11-02 07:36:52 UTC (rev 318672)
@@ -0,0 +1,21 @@
+--TEST--
+Bug #60192 (SegFault when Collator not constructed properly)
+--SKIPIF--
+<?php
+ if (!extension_loaded('intl')) { die('skip intl extension not available'); }
+?>
+--FILE--
+<?php
+
+class Collator2 extends Collator{
+ public function __construct() {
+ // ommitting parent::__construct($someLocale);
+ }
+}
+
+$c = new Collator2();
+$a = array('a', 'b');
+$c->sort($a);
+--EXPECTF--
+
+Fatal error: Collator::sort(): Object not initialized in %s on line %d
Added: php/php-src/branches/PHP_5_3/ext/intl/tests/bug60192-sortwithsortkeys.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/intl/tests/bug60192-sortwithsortkeys.phpt (rev 0)
+++ php/php-src/branches/PHP_5_3/ext/intl/tests/bug60192-sortwithsortkeys.phpt 2011-11-02 07:36:52 UTC (rev 318672)
@@ -0,0 +1,21 @@
+--TEST--
+Bug #60192 (SegFault when Collator not constructed properly)
+--SKIPIF--
+<?php
+ if (!extension_loaded('intl')) { die('skip intl extension not available'); }
+?>
+--FILE--
+<?php
+
+class Collator2 extends Collator{
+ public function __construct() {
+ // ommitting parent::__construct($someLocale);
+ }
+}
+
+$c = new Collator2();
+$a = array('a', 'b');
+$c->sortWithSortKeys($a);
+--EXPECTF--
+
+Fatal error: Collator::sortWithSortKeys(): Object not initialized in %s on line %d
Modified: php/php-src/branches/PHP_5_4/ext/intl/collator/collator_compare.c
===================================================================
--- php/php-src/branches/PHP_5_4/ext/intl/collator/collator_compare.c 2011-11-02 06:31:33 UTC (rev 318671)
+++ php/php-src/branches/PHP_5_4/ext/intl/collator/collator_compare.c 2011-11-02 07:36:52 UTC (rev 318672)
@@ -99,6 +99,10 @@
RETURN_FALSE;
}
+ if (!co || !co->ucoll) {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Object not initialized");
+ }
+
/* Then compare them. */
result = ucol_strcoll(
co->ucoll,
Modified: php/php-src/branches/PHP_5_4/ext/intl/collator/collator_locale.c
===================================================================
--- php/php-src/branches/PHP_5_4/ext/intl/collator/collator_locale.c 2011-11-02 06:31:33 UTC (rev 318671)
+++ php/php-src/branches/PHP_5_4/ext/intl/collator/collator_locale.c 2011-11-02 07:36:52 UTC (rev 318672)
@@ -51,6 +51,10 @@
/* Fetch the object. */
COLLATOR_METHOD_FETCH_OBJECT;
+ if (!co || !co->ucoll) {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Object not initialized");
+ }
+
/* Get locale by specified type. */
locale_name = (char*) ucol_getLocaleByType(
co->ucoll, type, COLLATOR_ERROR_CODE_P( co ) );
Modified: php/php-src/branches/PHP_5_4/ext/intl/collator/collator_sort.c
===================================================================
--- php/php-src/branches/PHP_5_4/ext/intl/collator/collator_sort.c 2011-11-02 06:31:33 UTC (rev 318671)
+++ php/php-src/branches/PHP_5_4/ext/intl/collator/collator_sort.c 2011-11-02 07:36:52 UTC (rev 318672)
@@ -73,6 +73,10 @@
/* Fetch collator object. */
co = (Collator_object *) zend_object_store_get_object( INTL_G(current_collator) TSRMLS_CC );
+ if (!co || !co->ucoll) {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Object not initialized");
+ }
+
/* Compare the strings using ICU. */
result->value.lval = ucol_strcoll(
co->ucoll,
@@ -441,6 +445,10 @@
/* Get sort key, reallocating the buffer if needed. */
bufLeft = sortKeyBufSize - sortKeyBufOffset;
+ if (!co || !co->ucoll) {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Object not initialized");
+ }
+
sortKeyLen = ucol_getSortKey( co->ucoll,
utf16_buf,
utf16_len,
@@ -571,6 +579,10 @@
RETURN_FALSE;
}
+ if (!co || !co->ucoll) {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Object not initialized");
+ }
+
key_len = ucol_getSortKey(co->ucoll, ustr, ustr_len, key, 0);
if(!key_len) {
efree( ustr );
Added: php/php-src/branches/PHP_5_4/ext/intl/tests/bug60192-compare.phpt
===================================================================
--- php/php-src/branches/PHP_5_4/ext/intl/tests/bug60192-compare.phpt (rev 0)
+++ php/php-src/branches/PHP_5_4/ext/intl/tests/bug60192-compare.phpt 2011-11-02 07:36:52 UTC (rev 318672)
@@ -0,0 +1,20 @@
+--TEST--
+Bug #60192 (SegFault when Collator not constructed properly)
+--SKIPIF--
+<?php
+ if (!extension_loaded('intl')) { die('skip intl extension not available'); }
+?>
+--FILE--
+<?php
+
+class Collator2 extends Collator{
+ public function __construct() {
+ // ommitting parent::__construct($someLocale);
+ }
+}
+
+$c = new Collator2();
+$c->compare('h', 'H');
+--EXPECTF--
+
+Fatal error: Collator::compare(): Object not initialized in %s on line %d
Added: php/php-src/branches/PHP_5_4/ext/intl/tests/bug60192-getlocale.phpt
===================================================================
--- php/php-src/branches/PHP_5_4/ext/intl/tests/bug60192-getlocale.phpt (rev 0)
+++ php/php-src/branches/PHP_5_4/ext/intl/tests/bug60192-getlocale.phpt 2011-11-02 07:36:52 UTC (rev 318672)
@@ -0,0 +1,20 @@
+--TEST--
+Bug #60192 (SegFault when Collator not constructed properly)
+--SKIPIF--
+<?php
+ if (!extension_loaded('intl')) { die('skip intl extension not available'); }
+?>
+--FILE--
+<?php
+
+class Collator2 extends Collator{
+ public function __construct() {
+ // ommitting parent::__construct($someLocale);
+ }
+}
+
+$c = new Collator2();
+$c->getLocale(Locale::ACTUAL_LOCALE);
+--EXPECTF--
+
+Fatal error: Collator::getLocale(): Object not initialized in %s on line %d
Added: php/php-src/branches/PHP_5_4/ext/intl/tests/bug60192-getsortkey.phpt
===================================================================
--- php/php-src/branches/PHP_5_4/ext/intl/tests/bug60192-getsortkey.phpt (rev 0)
+++ php/php-src/branches/PHP_5_4/ext/intl/tests/bug60192-getsortkey.phpt 2011-11-02 07:36:52 UTC (rev 318672)
@@ -0,0 +1,20 @@
+--TEST--
+Bug #60192 (SegFault when Collator not constructed properly)
+--SKIPIF--
+<?php
+ if (!extension_loaded('intl')) { die('skip intl extension not available'); }
+?>
+--FILE--
+<?php
+
+class Collator2 extends Collator{
+ public function __construct() {
+ // ommitting parent::__construct($someLocale);
+ }
+}
+
+$c = new Collator2();
+$c->getSortKey('h');
+--EXPECTF--
+
+Fatal error: Collator::getSortKey(): Object not initialized in %s on line %d
Added: php/php-src/branches/PHP_5_4/ext/intl/tests/bug60192-sort.phpt
===================================================================
--- php/php-src/branches/PHP_5_4/ext/intl/tests/bug60192-sort.phpt (rev 0)
+++ php/php-src/branches/PHP_5_4/ext/intl/tests/bug60192-sort.phpt 2011-11-02 07:36:52 UTC (rev 318672)
@@ -0,0 +1,21 @@
+--TEST--
+Bug #60192 (SegFault when Collator not constructed properly)
+--SKIPIF--
+<?php
+ if (!extension_loaded('intl')) { die('skip intl extension not available'); }
+?>
+--FILE--
+<?php
+
+class Collator2 extends Collator{
+ public function __construct() {
+ // ommitting parent::__construct($someLocale);
+ }
+}
+
+$c = new Collator2();
+$a = array('a', 'b');
+$c->sort($a);
+--EXPECTF--
+
+Fatal error: Collator::sort(): Object not initialized in %s on line %d
Added: php/php-src/branches/PHP_5_4/ext/intl/tests/bug60192-sortwithsortkeys.phpt
===================================================================
--- php/php-src/branches/PHP_5_4/ext/intl/tests/bug60192-sortwithsortkeys.phpt (rev 0)
+++ php/php-src/branches/PHP_5_4/ext/intl/tests/bug60192-sortwithsortkeys.phpt 2011-11-02 07:36:52 UTC (rev 318672)
@@ -0,0 +1,21 @@
+--TEST--
+Bug #60192 (SegFault when Collator not constructed properly)
+--SKIPIF--
+<?php
+ if (!extension_loaded('intl')) { die('skip intl extension not available'); }
+?>
+--FILE--
+<?php
+
+class Collator2 extends Collator{
+ public function __construct() {
+ // ommitting parent::__construct($someLocale);
+ }
+}
+
+$c = new Collator2();
+$a = array('a', 'b');
+$c->sortWithSortKeys($a);
+--EXPECTF--
+
+Fatal error: Collator::sortWithSortKeys(): Object not initialized in %s on line %d
Modified: php/php-src/trunk/ext/intl/collator/collator_compare.c
===================================================================
--- php/php-src/trunk/ext/intl/collator/collator_compare.c 2011-11-02 06:31:33 UTC (rev 318671)
+++ php/php-src/trunk/ext/intl/collator/collator_compare.c 2011-11-02 07:36:52 UTC (rev 318672)
@@ -99,6 +99,10 @@
RETURN_FALSE;
}
+ if (!co || !co->ucoll) {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Object not initialized");
+ }
+
/* Then compare them. */
result = ucol_strcoll(
co->ucoll,
Modified: php/php-src/trunk/ext/intl/collator/collator_locale.c
===================================================================
--- php/php-src/trunk/ext/intl/collator/collator_locale.c 2011-11-02 06:31:33 UTC (rev 318671)
+++ php/php-src/trunk/ext/intl/collator/collator_locale.c 2011-11-02 07:36:52 UTC (rev 318672)
@@ -51,6 +51,10 @@
/* Fetch the object. */
COLLATOR_METHOD_FETCH_OBJECT;
+ if (!co || !co->ucoll) {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Object not initialized");
+ }
+
/* Get locale by specified type. */
locale_name = (char*) ucol_getLocaleByType(
co->ucoll, type, COLLATOR_ERROR_CODE_P( co ) );
Modified: php/php-src/trunk/ext/intl/collator/collator_sort.c
===================================================================
--- php/php-src/trunk/ext/intl/collator/collator_sort.c 2011-11-02 06:31:33 UTC (rev 318671)
+++ php/php-src/trunk/ext/intl/collator/collator_sort.c 2011-11-02 07:36:52 UTC (rev 318672)
@@ -73,6 +73,10 @@
/* Fetch collator object. */
co = (Collator_object *) zend_object_store_get_object( INTL_G(current_collator) TSRMLS_CC );
+ if (!co || !co->ucoll) {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Object not initialized");
+ }
+
/* Compare the strings using ICU. */
result->value.lval = ucol_strcoll(
co->ucoll,
@@ -441,6 +445,10 @@
/* Get sort key, reallocating the buffer if needed. */
bufLeft = sortKeyBufSize - sortKeyBufOffset;
+ if (!co || !co->ucoll) {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Object not initialized");
+ }
+
sortKeyLen = ucol_getSortKey( co->ucoll,
utf16_buf,
utf16_len,
@@ -571,6 +579,10 @@
RETURN_FALSE;
}
+ if (!co || !co->ucoll) {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Object not initialized");
+ }
+
key_len = ucol_getSortKey(co->ucoll, ustr, ustr_len, key, 0);
if(!key_len) {
efree( ustr );
Added: php/php-src/trunk/ext/intl/tests/bug60192-compare.phpt
===================================================================
--- php/php-src/trunk/ext/intl/tests/bug60192-compare.phpt (rev 0)
+++ php/php-src/trunk/ext/intl/tests/bug60192-compare.phpt 2011-11-02 07:36:52 UTC (rev 318672)
@@ -0,0 +1,20 @@
+--TEST--
+Bug #60192 (SegFault when Collator not constructed properly)
+--SKIPIF--
+<?php
+ if (!extension_loaded('intl')) { die('skip intl extension not available'); }
+?>
+--FILE--
+<?php
+
+class Collator2 extends Collator{
+ public function __construct() {
+ // ommitting parent::__construct($someLocale);
+ }
+}
+
+$c = new Collator2();
+$c->compare('h', 'H');
+--EXPECTF--
+
+Fatal error: Collator::compare(): Object not initialized in %s on line %d
Added: php/php-src/trunk/ext/intl/tests/bug60192-getlocale.phpt
===================================================================
--- php/php-src/trunk/ext/intl/tests/bug60192-getlocale.phpt (rev 0)
+++ php/php-src/trunk/ext/intl/tests/bug60192-getlocale.phpt 2011-11-02 07:36:52 UTC (rev 318672)
@@ -0,0 +1,20 @@
+--TEST--
+Bug #60192 (SegFault when Collator not constructed properly)
+--SKIPIF--
+<?php
+ if (!extension_loaded('intl')) { die('skip intl extension not available'); }
+?>
+--FILE--
+<?php
+
+class Collator2 extends Collator{
+ public function __construct() {
+ // ommitting parent::__construct($someLocale);
+ }
+}
+
+$c = new Collator2();
+$c->getLocale(Locale::ACTUAL_LOCALE);
+--EXPECTF--
+
+Fatal error: Collator::getLocale(): Object not initialized in %s on line %d
Added: php/php-src/trunk/ext/intl/tests/bug60192-getsortkey.phpt
===================================================================
--- php/php-src/trunk/ext/intl/tests/bug60192-getsortkey.phpt (rev 0)
+++ php/php-src/trunk/ext/intl/tests/bug60192-getsortkey.phpt 2011-11-02 07:36:52 UTC (rev 318672)
@@ -0,0 +1,20 @@
+--TEST--
+Bug #60192 (SegFault when Collator not constructed properly)
+--SKIPIF--
+<?php
+ if (!extension_loaded('intl')) { die('skip intl extension not available'); }
+?>
+--FILE--
+<?php
+
+class Collator2 extends Collator{
+ public function __construct() {
+ // ommitting parent::__construct($someLocale);
+ }
+}
+
+$c = new Collator2();
+$c->getSortKey('h');
+--EXPECTF--
+
+Fatal error: Collator::getSortKey(): Object not initialized in %s on line %d
Added: php/php-src/trunk/ext/intl/tests/bug60192-sort.phpt
===================================================================
--- php/php-src/trunk/ext/intl/tests/bug60192-sort.phpt (rev 0)
+++ php/php-src/trunk/ext/intl/tests/bug60192-sort.phpt 2011-11-02 07:36:52 UTC (rev 318672)
@@ -0,0 +1,21 @@
+--TEST--
+Bug #60192 (SegFault when Collator not constructed properly)
+--SKIPIF--
+<?php
+ if (!extension_loaded('intl')) { die('skip intl extension not available'); }
+?>
+--FILE--
+<?php
+
+class Collator2 extends Collator{
+ public function __construct() {
+ // ommitting parent::__construct($someLocale);
+ }
+}
+
+$c = new Collator2();
+$a = array('a', 'b');
+$c->sort($a);
+--EXPECTF--
+
+Fatal error: Collator::sort(): Object not initialized in %s on line %d
Added: php/php-src/trunk/ext/intl/tests/bug60192-sortwithsortkeys.phpt
===================================================================
--- php/php-src/trunk/ext/intl/tests/bug60192-sortwithsortkeys.phpt (rev 0)
+++ php/php-src/trunk/ext/intl/tests/bug60192-sortwithsortkeys.phpt 2011-11-02 07:36:52 UTC (rev 318672)
@@ -0,0 +1,21 @@
+--TEST--
+Bug #60192 (SegFault when Collator not constructed properly)
+--SKIPIF--
+<?php
+ if (!extension_loaded('intl')) { die('skip intl extension not available'); }
+?>
+--FILE--
+<?php
+
+class Collator2 extends Collator{
+ public function __construct() {
+ // ommitting parent::__construct($someLocale);
+ }
+}
+
+$c = new Collator2();
+$a = array('a', 'b');
+$c->sortWithSortKeys($a);
+--EXPECTF--
+
+Fatal error: Collator::sortWithSortKeys(): Object not initialized in %s on line %d
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php