From bbcd8c5b693e84483ee15bde2c683c8e6ee8c875 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Johannes=20Schl=C3=BCter?= Date: Thu, 12 Apr 2007 18:39:46 +0000 Subject: [PATCH] - Fix bug #41061 ("visibility error" in ReflectionFunction::export()) --- NEWS | 2 ++ ext/reflection/php_reflection.c | 34 +++++++++++++++++------------- ext/reflection/tests/bug41061.phpt | 30 ++++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 15 deletions(-) create mode 100755 ext/reflection/tests/bug41061.phpt diff --git a/NEWS b/NEWS index 287a3b2d07..67da13e199 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,8 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? Apr 2007, PHP 5.2.2RC2 - Fixed bug #41063 (chdir doesn't like root paths). (Dmitry) +- Fixed bug #41061 ("visibility error" in ReflectionFunction::export()). + (Johannes) - Fixed bug #40861 (strtotime() doesn't handle double negative relative time units correctly). (Derick) diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index f974d53f4c..258f8e5e14 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -747,23 +747,27 @@ static void _function_string(string *str, zend_function *fptr, zend_class_entry string_printf(str, "static "); } - /* These are mutually exclusive */ - switch (fptr->common.fn_flags & ZEND_ACC_PPP_MASK) { - case ZEND_ACC_PUBLIC: - string_printf(str, "public "); - break; - case ZEND_ACC_PRIVATE: - string_printf(str, "private "); - break; - case ZEND_ACC_PROTECTED: - string_printf(str, "protected "); - break; - default: - string_printf(str, " "); - break; + if (fptr->common.scope) { + /* These are mutually exclusive */ + switch (fptr->common.fn_flags & ZEND_ACC_PPP_MASK) { + case ZEND_ACC_PUBLIC: + string_printf(str, "public "); + break; + case ZEND_ACC_PRIVATE: + string_printf(str, "private "); + break; + case ZEND_ACC_PROTECTED: + string_printf(str, "protected "); + break; + default: + string_printf(str, " "); + break; + } + string_printf(str, "method "); + } else { + string_printf(str, "function "); } - string_printf(str, fptr->common.scope ? "method " : "function "); if (fptr->op_array.return_reference) { string_printf(str, "&"); } diff --git a/ext/reflection/tests/bug41061.phpt b/ext/reflection/tests/bug41061.phpt new file mode 100755 index 0000000000..977828ef65 --- /dev/null +++ b/ext/reflection/tests/bug41061.phpt @@ -0,0 +1,30 @@ +--TEST-- +Reflection Bug #41061 ("visibility error" in ReflectionFunction::export()) +--SKIPIF-- + +--FILE-- + +===DONE=== + +--EXPECTF-- +Function [ function foo ] { + @@ %sbug41061.php 3 - 4 +} + +Method [ private method foo ] { + @@ %sbug41061.php 7 - 8 +} + +===DONE=== -- 2.40.0