com php-src: Fixed bug #75090: NEWS ext/intl/calendar/calendar _class.cpp ext/intl/tests/bug75090.phpt
| From: | Nikita Popov | Date: | Fri, 25 Aug 2017 20:02:19 +0000 |
| Subject: | com php-src: Fixed bug #75090: NEWS ext/intl/calendar/calendar _class.cpp ext/intl/tests/bug75090.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-99162@lists.php.net to get a copy of this message | ||
Commit: be9edd83c2b3119018611e178da0ee55f7b71c28
Author: Thomas Punt <tpunt@hotmail.co.uk> Wed, 23 Aug 2017 23:35:18 +0100
Committer: Nikita Popov <nikita.ppv@gmail.com> Fri, 25 Aug 2017 22:02:19 +0200
Parents: 55db2c31cd4596c53e3b952e1ddfea36f23412e4
Branches: PHP-7.0 PHP-7.1 PHP-7.2 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=be9edd83c2b3119018611e178da0ee55f7b71c28
Log:
Fixed bug #75090
Bugs:
https://bugs.php.net/75090
Changed paths:
M NEWS
M ext/intl/calendar/calendar_class.cpp
A ext/intl/tests/bug75090.phpt
Diff:
diff --git a/NEWS b/NEWS
index f0cdd2b...edd4e29 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,10 @@ PHP NEWS
- CURL:
. Fixed bug #75093 (OpenSSL support not detected). (Remi)
+- Intl:
+ . Fixed bug #75090 (IntlGregorianCalendar doesn't have constants from parent
+ class). (tpunt)
+
- PDO_OCI:
. Fixed bug #74631 (PDO_PCO with PHP-FPM: OCI environment initialized
before PHP-FPM sets it up). (Ingmar Runge)
diff --git a/ext/intl/calendar/calendar_class..cpp b/ext/intl/calendar/calendar_class.cpp
index 4414a7a..94a2d5a 100644
--- a/ext/intl/calendar/calendar_class.cpp
+++ b/ext/intl/calendar/calendar_class.cpp
@@ -477,17 +477,6 @@ void calendar_register_IntlCalendar_class(void)
Calendar_handlers.dtor_obj = Calendar_objects_dtor;
Calendar_handlers.free_obj = Calendar_objects_free;
- /* Create and register 'IntlGregorianCalendar' class. */
- INIT_CLASS_ENTRY(ce, "IntlGregorianCalendar", GregorianCalendar_class_functions);
- GregorianCalendar_ce_ptr = zend_register_internal_class_ex(&ce,
- Calendar_ce_ptr);
- if (!GregorianCalendar_ce_ptr) {
- //can't happen know without bigger problems before
- php_error_docref0(NULL, E_ERROR,
- "IntlGregorianCalendar: class registration has failed.");
- return;
- }
-
/* Declare 'IntlCalendar' class constants */
#define CALENDAR_DECL_LONG_CONST(name, val) \
zend_declare_class_constant_long(Calendar_ce_ptr, name, sizeof(name) - 1, \
@@ -541,5 +530,16 @@ void calendar_register_IntlCalendar_class(void)
CALENDAR_DECL_LONG_CONST("WALLTIME_LAST", UCAL_WALLTIME_LAST);
CALENDAR_DECL_LONG_CONST("WALLTIME_NEXT_VALID", UCAL_WALLTIME_NEXT_VALID);
#endif
+
+ /* Create and register 'IntlGregorianCalendar' class. */
+ INIT_CLASS_ENTRY(ce, "IntlGregorianCalendar", GregorianCalendar_class_functions);
+ GregorianCalendar_ce_ptr = zend_register_internal_class_ex(&ce,
+ Calendar_ce_ptr);
+ if (!GregorianCalendar_ce_ptr) {
+ //can't happen know without bigger problems before
+ php_error_docref0(NULL, E_ERROR,
+ "IntlGregorianCalendar: class registration has failed.");
+ return;
+ }
}
/* }}} */
diff --git a/ext/intl/tests/bug75090.phpt b/ext/intl/tests/bug75090.phpt
new file mode 100644
index 0000000..ff5e0bd
--- /dev/null
+++ b/ext/intl/tests/bug75090.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Bug #75090 Constants of parent IntlCalendar class not inherited
+--SKIPIF--
+<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+--FILE--
+<?php
+class Foo extends IntlCalendar {}
+
+$fooRef = new ReflectionClass(Foo::class);
+$intlGregorianCalendarRef = new ReflectionClass(IntlGregorianCalendar::class);
+$intlCalendarRef = new ReflectionClass(IntlCalendar::class);
+
+var_dump(
+ count($fooRef->getConstants()) === count($intlCalendarRef->getConstants()),
+ count($intlGregorianCalendarRef->getConstants()) ===
count($intlCalendarRef->getConstants())
+);
+?>
+===DONE===
+--EXPECT--
+bool(true)
+bool(true)
+===DONE===