]> granicus.if.org Git - php/commitdiff
You shall not clone Exception instances
authorMarcus Boerger <helly@php.net>
Sat, 25 Oct 2003 19:07:09 +0000 (19:07 +0000)
committerMarcus Boerger <helly@php.net>
Sat, 25 Oct 2003 19:07:09 +0000 (19:07 +0000)
Zend/zend_default_classes.c
Zend/zend_exceptions.c

index 619e9ec8664cd8d5e6d50f3cd3f01c49bf305698..338e5fa1b8eff25e67a4c476ae847b3f320e8daa 100644 (file)
@@ -53,6 +53,12 @@ static zend_object_value zend_default_exception_new(zend_class_entry *class_type
        return obj.value.obj;
 }
 
+ZEND_METHOD(reflection, __clone)
+{
+       /* Should never be executable */
+       _DO_THROW("Cannot clone object using __clone()");
+}
+
 ZEND_METHOD(exception, __construct)
 {
        char  *message = NULL;
@@ -348,6 +354,7 @@ ZEND_METHOD(exception, __toString)
  * that gives the user anything to accomplish this.
  */
 static zend_function_entry default_exception_functions[] = {
+       ZEND_ME(exception, __clone, NULL, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
        ZEND_ME(exception, __construct, NULL, 0)
        ZEND_ME(exception, getMessage, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
        ZEND_ME(exception, getCode, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
index 619e9ec8664cd8d5e6d50f3cd3f01c49bf305698..338e5fa1b8eff25e67a4c476ae847b3f320e8daa 100644 (file)
@@ -53,6 +53,12 @@ static zend_object_value zend_default_exception_new(zend_class_entry *class_type
        return obj.value.obj;
 }
 
+ZEND_METHOD(reflection, __clone)
+{
+       /* Should never be executable */
+       _DO_THROW("Cannot clone object using __clone()");
+}
+
 ZEND_METHOD(exception, __construct)
 {
        char  *message = NULL;
@@ -348,6 +354,7 @@ ZEND_METHOD(exception, __toString)
  * that gives the user anything to accomplish this.
  */
 static zend_function_entry default_exception_functions[] = {
+       ZEND_ME(exception, __clone, NULL, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
        ZEND_ME(exception, __construct, NULL, 0)
        ZEND_ME(exception, getMessage, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
        ZEND_ME(exception, getCode, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)