]> granicus.if.org Git - php/commitdiff
Fixed bug #72639 (Segfault when instantiating class that extends IntlCalendar and...
authorXinchen Hui <laruence@gmail.com>
Thu, 21 Jul 2016 06:25:15 +0000 (14:25 +0800)
committerXinchen Hui <laruence@gmail.com>
Thu, 21 Jul 2016 06:25:15 +0000 (14:25 +0800)
NEWS
ext/intl/calendar/calendar_class.cpp
ext/intl/tests/bug72639.phpt [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index af9ce204ae97374b084eaa3a277ceaadaf3baab4..d50ba56e198b47e03f44a8effe823c85ee00fce9 100644 (file)
--- 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)
 
index 72cd7e1dd0f2cc7723d63530bedb4353bc13d593..4414a7a092befe8118105602b4ee02140c48b42e 100644 (file)
@@ -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 (file)
index 0000000..2c94dcc
--- /dev/null
@@ -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)
+}