From 50f92dca08d3cb38b437c60b5ee699ec2d8c29ab Mon Sep 17 00:00:00 2001 From: Olly Betts Date: Wed, 14 Apr 2021 10:59:12 +1200 Subject: [PATCH] Mark wrapped abstract classes This allows restoring reflection checks in testcase director_abstract. --- Examples/test-suite/php/director_abstract_runme.php | 9 +++++++++ Source/Modules/php.cxx | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/Examples/test-suite/php/director_abstract_runme.php b/Examples/test-suite/php/director_abstract_runme.php index 00c9f6b31..b26878da8 100644 --- a/Examples/test-suite/php/director_abstract_runme.php +++ b/Examples/test-suite/php/director_abstract_runme.php @@ -49,4 +49,13 @@ check::equal($me2->Color(1, 2, 3), 2, "Example2_get_color failed"); $me3 = new MyExample3(); check::equal($me3->Color(1, 2, 3), 3, "Example3_get_color failed"); +$class = new ReflectionClass('Example1'); +check::equal($class->isAbstract(), true, "Example1 abstractness failed"); + +$class = new ReflectionClass('Example2'); +check::equal($class->isAbstract(), true, "Example2 abstractness failed"); + +$class = new ReflectionClass('Example3_i'); +check::equal($class->isAbstract(), true, "Example3_i abstractness failed"); + check::done(); diff --git a/Source/Modules/php.cxx b/Source/Modules/php.cxx index c4e746a8b..c187fbaab 100644 --- a/Source/Modules/php.cxx +++ b/Source/Modules/php.cxx @@ -1783,6 +1783,10 @@ public: Printf(s_oinit, " SWIGTYPE_%s_ce = zend_register_internal_class(&SWIGTYPE_%s_internal_ce);\n", class_name, class_name); } + if (Getattr(n, "abstracts") && !GetFlag(n, "feature:notabstract")) { + Printf(s_oinit, " SWIGTYPE_%s_ce->ce_flags |= ZEND_ACC_EXPLICIT_ABSTRACT_CLASS;\n", class_name); + } + { Node *node = NewHash(); Setattr(node, "type", Getattr(n, "name"));