johannes                Thu Apr 12 18:39:46 2007 UTC

  Added files:                 (Branch: PHP_5_2)
    /php-src/ext/reflection/tests       bug41061.phpt 

  Modified files:              
    /php-src    NEWS 
    /php-src/ext/reflection     php_reflection.c 
  Log:
  - Fix bug #41061 ("visibility error" in ReflectionFunction::export())
  
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.639&r2=1.2027.2.547.2.640&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.639 php-src/NEWS:1.2027.2.547.2.640
--- php-src/NEWS:1.2027.2.547.2.639     Thu Apr 12 15:28:57 2007
+++ php-src/NEWS        Thu Apr 12 18:39:45 2007
@@ -2,6 +2,8 @@
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? 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)
 
http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.164.2.33.2.36&r2=1.164.2.33.2.37&diff_format=u
Index: php-src/ext/reflection/php_reflection.c
diff -u php-src/ext/reflection/php_reflection.c:1.164.2.33.2.36 
php-src/ext/reflection/php_reflection.c:1.164.2.33.2.37
--- php-src/ext/reflection/php_reflection.c:1.164.2.33.2.36     Sat Mar 17 
23:00:49 2007
+++ php-src/ext/reflection/php_reflection.c     Thu Apr 12 18:39:46 2007
@@ -20,7 +20,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: php_reflection.c,v 1.164.2.33.2.36 2007/03/17 23:00:49 tony2001 Exp $ 
*/
+/* $Id: php_reflection.c,v 1.164.2.33.2.37 2007/04/12 18:39:46 johannes Exp $ 
*/
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -747,23 +747,27 @@
                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, "<visibility error> ");
-                   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, "<visibility error> ");
+                           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, "&");
        }
@@ -4889,7 +4893,7 @@
        php_info_print_table_start();
        php_info_print_table_header(2, "Reflection", "enabled");
 
-       php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 
1.164.2.33.2.36 2007/03/17 23:00:49 tony2001 Exp $");
+       php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 
1.164.2.33.2.37 2007/04/12 18:39:46 johannes Exp $");
 
        php_info_print_table_end();
 } /* }}} */

http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug41061.phpt?view=markup&rev=1.1
Index: php-src/ext/reflection/tests/bug41061.phpt
+++ php-src/ext/reflection/tests/bug41061.phpt
--TEST--
Reflection Bug #41061 ("visibility error" in ReflectionFunction::export())
--SKIPIF--
<?php extension_loaded('reflection') or die('skip'); ?>
--FILE--
<?php

function foo() {
}
 
class bar {
    private function foo() {
    }
}

Reflection::export(new ReflectionFunction('foo'));
Reflection::export(new ReflectionMethod('bar', 'foo'));
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
Function [ <user> function foo ] {
  @@ %sbug41061.php 3 - 4
}

Method [ <user> private method foo ] {
  @@ %sbug41061.php 7 - 8
}

===DONE===

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to