com php-src: Fixed bug #72639 (Segfault when instantiating class that extends IntlCalendar and adds a property): NEWS ext/intl/calend
ar/calendar_class.cpp ext/intl/tests/bug72639 .phpt
| From: | Xinchen Hui | Date: | Thu, 21 Jul 2016 06:25:15 +0000 |
| Subject: | com php-src: Fixed bug #72639 (Segfault when instantiating class that extends IntlCalendar and adds a property): NEWS ext/intl/calend ar/calendar_class.cpp ext/intl/tests/bug72639 .phpt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-93290@lists.php.net to get a copy of this message | ||
Commit: 4a643e5e1362951362b5eb4a30af0d5068ca6686
Author: Xinchen Hui <laruence@gmail.com> Thu, 21 Jul 2016 14:25:15 +0800
Parents: 7e1843fc0408a9ea5abc06c0c6b6da7d55c69272
Branches: PHP-7.0 PHP-7.1 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=4a643e5e1362951362b5eb4a30af0d5068ca6686
Log:
Fixed bug #72639 (Segfault when instantiating class that extends IntlCalendar and adds a property)
Bugs:
https://bugs.php.net/72639
Changed paths:
M NEWS
M ext/intl/calendar/calendar_class.cpp
A ext/intl/tests/bug72639..phpt
Diff:
diff --git a/NEWS b/NEWS
index af9ce20..d50ba56 100644
--- a/NEWS
+++ b/NEWS
@@ -41,6 +41,8 @@ PHP NEWS
blendingmode).. (cmb)
- Intl:
+ . Fixed bug #72639 (Segfault when instantiating class that extends
+ IntlCalendar and adds a property). (Laruence)
. Partially fixed #72506 (idn_to_ascii for UTS #46 incorrect for long domain
names). (cmb)
diff --git a/ext/intl/calendar/calendar_class.cpp b/ext/intl/calendar/calendar_class.cpp
index 72cd7e1..4414a7a 100644
--- a/ext/intl/calendar/calendar_class.cpp
+++ b/ext/intl/calendar/calendar_class.cpp
@@ -261,7 +261,7 @@ static zend_object *Calendar_object_create(zend_class_entry *ce)
intern = (Calendar_object*)ecalloc(1, sizeof(Calendar_object) + sizeof(zval) *
(ce->default_properties_count - 1));
zend_object_std_init(&intern->zo, ce);
- object_properties_init((zend_object*) intern, ce);
+ object_properties_init(&intern->zo, ce);
calendar_object_init(intern);
diff --git a/ext/intl/tests/bug72639.phpt b/ext/intl/tests/bug72639.phpt
new file mode 100644
index 0000000..2c94dcc
--- /dev/null
+++ b/ext/intl/tests/bug72639.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Bug #72639 (Segfault when instantiating class that extends IntlCalendar and adds a property)
+--SKIPIF--
+<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+--FILE--
+<?php
+class A extends IntlCalendar {
+ public function __construct() {}
+ private $a;
+}
+var_dump(new A());
+?>
+--EXPECTF--
+object(A)#%d (1) {
+ ["valid"]=>
+ bool(false)
+}