[PHP-CVS] cvs: php-src(PHP_5_3) /ext/reflection php_reflection.c /ext/reflection/tests bug48757.phpt

2009-07-01 Thread Kalle Sommer Nielsen
kalle   Wed Jul  1 17:38:04 2009 UTC

  Added files: (Branch: PHP_5_3)
/php-src/ext/reflection/tests   bug48757.phpt 

  Modified files:  
/php-src/ext/reflection php_reflection.c 
  Log:
  MFH: Fixed bug #48757 (ReflectionFunction::invoke() parameter issues)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.164.2.33.2.45.2.58r2=1.164.2.33.2.45.2.59diff_format=u
Index: php-src/ext/reflection/php_reflection.c
diff -u php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.58 
php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.59
--- php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.58Tue Jun 
16 14:33:33 2009
+++ php-src/ext/reflection/php_reflection.c Wed Jul  1 17:38:03 2009
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.58 2009/06/16 14:33:33 felipe Exp 
$ */
+/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.59 2009/07/01 17:38:03 kalle Exp 
$ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -1717,7 +1717,7 @@
 }
 /* }}} */
 
-/* {{{ proto public mixed ReflectionFunction::invoke(mixed* args)
+/* {{{ proto public mixed ReflectionFunction::invoke([mixed* args])
Invokes the function */
 ZEND_METHOD(reflection_function, invoke)
 {
@@ -1732,7 +1732,7 @@
METHOD_NOTSTATIC(reflection_function_ptr);
GET_REFLECTION_OBJECT_PTR(fptr);
 
-   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, +, params, 
num_args) == FAILURE) {
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, *, params, 
num_args) == FAILURE) {
return;
}
 
@@ -5008,7 +5008,7 @@
ZEND_ARG_INFO(0, name)
 ZEND_END_ARG_INFO()
 
-ZEND_BEGIN_ARG_INFO(arginfo_reflection_function_invoke, 0)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_reflection_function_invoke, 0, 0, 0)
ZEND_ARG_INFO(0, args)
 ZEND_END_ARG_INFO()
 
@@ -5442,7 +5442,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Reflection, enabled);
 
-   php_info_print_table_row(2, Version, $Revision: 1.164.2.33.2.45.2.58 
$);
+   php_info_print_table_row(2, Version, $Revision: 1.164.2.33.2.45.2.59 
$);
 
php_info_print_table_end();
 } /* }}} */
@@ -5456,7 +5456,7 @@
NULL,
NULL,
PHP_MINFO(reflection),
-   $Revision: 1.164.2.33.2.45.2.58 $,
+   $Revision: 1.164.2.33.2.45.2.59 $,
STANDARD_MODULE_PROPERTIES
 }; /* }}} */
 

http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug48757.phpt?view=markuprev=1.1
Index: php-src/ext/reflection/tests/bug48757.phpt
+++ php-src/ext/reflection/tests/bug48757.phpt
--TEST--
Bug #48757 (ReflectionFunction::invoke() parameter issues)
--FILE--
?php
function test() {
echo Hello World\n;
}

function another_test($parameter) {
var_dump($parameter);
}

$func = new ReflectionFunction('test');
$func-invoke();

$func = new ReflectionFunction('another_test');
$func-invoke('testing');
?
--EXPECT--
Hello World
unicode(7) testing



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



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/reflection php_reflection.c

2009-07-01 Thread Kalle Sommer Nielsen
kalle   Wed Jul  1 17:43:16 2009 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/reflection php_reflection.c 
  Log:
  MFH: Fixed memory leak if zero parameters are passed, Thanks Felipe
  
http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.164.2.33.2.45.2.59r2=1.164.2.33.2.45.2.60diff_format=u
Index: php-src/ext/reflection/php_reflection.c
diff -u php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.59 
php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.60
--- php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.59Wed Jul 
 1 17:38:03 2009
+++ php-src/ext/reflection/php_reflection.c Wed Jul  1 17:43:16 2009
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.59 2009/07/01 17:38:03 kalle Exp 
$ */
+/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.60 2009/07/01 17:43:16 kalle Exp 
$ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -1754,7 +1754,9 @@
 
result = zend_call_function(fci, fcc TSRMLS_CC);
 
-   efree(params);
+   if (num_args) {
+   efree(params);
+   }
 
if (result == FAILURE) {
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, 
@@ -5442,7 +5444,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Reflection, enabled);
 
-   php_info_print_table_row(2, Version, $Revision: 1.164.2.33.2.45.2.59 
$);
+   php_info_print_table_row(2, Version, $Revision: 1.164.2.33.2.45.2.60 
$);
 
php_info_print_table_end();
 } /* }}} */
@@ -5456,7 +5458,7 @@
NULL,
NULL,
PHP_MINFO(reflection),
-   $Revision: 1.164.2.33.2.45.2.59 $,
+   $Revision: 1.164.2.33.2.45.2.60 $,
STANDARD_MODULE_PROPERTIES
 }; /* }}} */
 



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



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/reflection php_reflection.c ZendEngine2 zend_stream.h

2009-06-16 Thread Felipe Pena
felipe  Tue Jun 16 14:33:33 2009 UTC

  Modified files:  (Branch: PHP_5_3)
/ZendEngine2zend_stream.h 
/php-src/ext/reflection php_reflection.c 
  Log:
  - MFH: Fixed build (removed trailing comma) patch by Seiji Masugata 
s.masugata at digicom.dnp.co.jp
  
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_stream.h?r1=1.8.2.1.2.1.2.5r2=1.8.2.1.2.1.2.6diff_format=u
Index: ZendEngine2/zend_stream.h
diff -u ZendEngine2/zend_stream.h:1.8.2.1.2.1.2.5 
ZendEngine2/zend_stream.h:1.8.2.1.2.1.2.6
--- ZendEngine2/zend_stream.h:1.8.2.1.2.1.2.5   Wed Mar 11 22:11:53 2009
+++ ZendEngine2/zend_stream.h   Tue Jun 16 14:33:33 2009
@@ -19,7 +19,7 @@
+--+
 */
 
-/* $Id: zend_stream.h,v 1.8.2.1.2.1.2.5 2009/03/11 22:11:53 shire Exp $ */
+/* $Id: zend_stream.h,v 1.8.2.1.2.1.2.6 2009/06/16 14:33:33 felipe Exp $ */
 
 #ifndef ZEND_STREAM_H
 #define ZEND_STREAM_H
@@ -38,7 +38,7 @@
ZEND_HANDLE_FD,
ZEND_HANDLE_FP,
ZEND_HANDLE_STREAM,
-   ZEND_HANDLE_MAPPED,
+   ZEND_HANDLE_MAPPED
 } zend_stream_type;
 
 typedef struct _zend_mmap {
http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.164.2.33.2.45.2.57r2=1.164.2.33.2.45.2.58diff_format=u
Index: php-src/ext/reflection/php_reflection.c
diff -u php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.57 
php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.58
--- php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.57Thu May 
21 16:01:37 2009
+++ php-src/ext/reflection/php_reflection.c Tue Jun 16 14:33:33 2009
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.57 2009/05/21 16:01:37 lbarnaud 
Exp $ */
+/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.58 2009/06/16 14:33:33 felipe Exp 
$ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -191,7 +191,7 @@
REF_TYPE_OTHER,  /* Must be 0 */
REF_TYPE_FUNCTION,
REF_TYPE_PARAMETER,
-   REF_TYPE_PROPERTY,
+   REF_TYPE_PROPERTY
 } reflection_type_t;
 
 /* Struct for reflection objects */
@@ -5442,7 +5442,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Reflection, enabled);
 
-   php_info_print_table_row(2, Version, $Revision: 1.164.2.33.2.45.2.57 
$);
+   php_info_print_table_row(2, Version, $Revision: 1.164.2.33.2.45.2.58 
$);
 
php_info_print_table_end();
 } /* }}} */
@@ -5456,7 +5456,7 @@
NULL,
NULL,
PHP_MINFO(reflection),
-   $Revision: 1.164.2.33.2.45.2.57 $,
+   $Revision: 1.164.2.33.2.45.2.58 $,
STANDARD_MODULE_PROPERTIES
 }; /* }}} */
 



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



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/reflection php_reflection.c /ext/reflection/tests bug48336.phpt

2009-05-21 Thread Arnaud Le Blanc
lbarnaudThu May 21 16:01:37 2009 UTC

  Added files: (Branch: PHP_5_3)
/php-src/ext/reflection/tests   bug48336.phpt 

  Modified files:  
/php-src/ext/reflection php_reflection.c 
  Log:
  MFH: Fixed bug #48336 (ReflectionProperty::getDeclaringClass() does not 
  work with redeclared property) 
  (patch by Markus dot Lidel at shadowconnect dot com)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.164.2.33.2.45.2.56r2=1.164.2.33.2.45.2.57diff_format=u
Index: php-src/ext/reflection/php_reflection.c
diff -u php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.56 
php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.57
--- php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.56Mon Apr 
27 19:48:45 2009
+++ php-src/ext/reflection/php_reflection.c Thu May 21 16:01:37 2009
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.56 2009/04/27 19:48:45 felipe Exp 
$ */
+/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.57 2009/05/21 16:01:37 lbarnaud 
Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -4603,6 +4603,10 @@
break;
}
ce = tmp_ce;
+   if (tmp_ce == tmp_info-ce) {
+   /* declared in this class, done */
+   break;
+   }
tmp_ce = tmp_ce-parent;
}
 
@@ -5438,7 +5442,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Reflection, enabled);
 
-   php_info_print_table_row(2, Version, $Revision: 1.164.2.33.2.45.2.56 
$);
+   php_info_print_table_row(2, Version, $Revision: 1.164.2.33.2.45.2.57 
$);
 
php_info_print_table_end();
 } /* }}} */
@@ -5452,7 +5456,7 @@
NULL,
NULL,
PHP_MINFO(reflection),
-   $Revision: 1.164.2.33.2.45.2.56 $,
+   $Revision: 1.164.2.33.2.45.2.57 $,
STANDARD_MODULE_PROPERTIES
 }; /* }}} */
 

http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug48336.phpt?view=markuprev=1.1
Index: php-src/ext/reflection/tests/bug48336.phpt
+++ php-src/ext/reflection/tests/bug48336.phpt
--TEST--
Bug #48286 (ReflectionProperty::getDeclaringClass() does not work with 
redeclared properties)
--FILE--
?php
class A {
}

class B extends A {
  static protected $prop;
}

class C extends B {
  static protected $prop;
}

class D extends C {
}

class E extends D {
}

class F extends E {
  static protected $prop;
}

$class = 'A';
for($class = 'A'; $class = 'F'; $class ++) {
  print($class.' = ');
  try {
$rp = new ReflectionProperty($class, 'prop');
print($rp-getDeclaringClass()-getName());
  } catch(Exception $e) {
print('N/A');
  }
  print(\n);
}
?
--EXPECT--
A = N/A
B = B
C = C
D = C
E = C
F = F



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



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/reflection php_reflection.c /ext/reflection/tests 002.phpt ReflectionClass_getMethod_001.phpt ReflectionClass_getMethods_001.phpt ReflectionClass_getProperties_00

2009-04-27 Thread Felipe Pena
felipe  Mon Apr 27 19:48:46 2009 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/reflection php_reflection.c 
/php-src/ext/reflection/tests   002.phpt 
ReflectionClass_getMethod_001.phpt 
ReflectionClass_getMethods_001.phpt 
ReflectionClass_getProperties_001.phpt 
ReflectionClass_getProperty_001.phpt 
ReflectionClass_getProperty_003.phpt 
ReflectionClass_getProperty_004.phpt 

ReflectionMethod_getModifiers_basic.phpt 
  Log:
  - MFH: Fixed bug #47254 (Wrong Reflection for extends class)
  http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.164.2.33.2.45.2.55r2=1.164.2.33.2.45.2.56diff_format=u
Index: php-src/ext/reflection/php_reflection.c
diff -u php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.55 
php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.56
--- php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.55Sat Apr 
 4 14:36:22 2009
+++ php-src/ext/reflection/php_reflection.c Mon Apr 27 19:48:45 2009
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.55 2009/04/04 14:36:22 sebastian 
Exp $ */
+/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.56 2009/04/27 19:48:45 felipe Exp 
$ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -1238,7 +1238,7 @@
MAKE_STD_ZVAL(name);
MAKE_STD_ZVAL(classname);
ZVAL_STRING(name, method-common.function_name, 1);
-   ZVAL_STRINGL(classname, ce-name, ce-name_length, 1);
+   ZVAL_STRINGL(classname, method-common.scope-name, 
method-common.scope-name_length, 1);
reflection_instantiate(reflection_method_ptr, object TSRMLS_CC);
intern = (reflection_object *) zend_object_store_get_object(object 
TSRMLS_CC);
intern-ptr = method;
@@ -1281,7 +1281,7 @@
MAKE_STD_ZVAL(name);
MAKE_STD_ZVAL(classname);
ZVAL_STRING(name, prop_name, 1);
-   ZVAL_STRINGL(classname, ce-name, ce-name_length, 1);
+   ZVAL_STRINGL(classname, prop-ce-name, prop-ce-name_length, 1);
 
reflection_instantiate(reflection_property_ptr, object TSRMLS_CC);
intern = (reflection_object *) zend_object_store_get_object(object 
TSRMLS_CC);
@@ -2482,11 +2482,6 @@
zval_dtor(ztmp);
}
 
-   MAKE_STD_ZVAL(classname);
-   ZVAL_STRINGL(classname, ce-name, ce-name_length, 1);
-
-   zend_hash_update(Z_OBJPROP_P(object), class, sizeof(class), (void 
**) classname, sizeof(zval *), NULL);
-   
lcname = zend_str_tolower_dup(name_str, name_len);
 
if (ce == zend_ce_closure  orig_obj  (name_len == 
sizeof(ZEND_INVOKE_FUNC_NAME)-1)
@@ -2502,6 +2497,11 @@
}
efree(lcname);
 
+   MAKE_STD_ZVAL(classname);
+   ZVAL_STRINGL(classname, mptr-common.scope-name, 
mptr-common.scope-name_length, 1);
+
+   zend_hash_update(Z_OBJPROP_P(object), class, sizeof(class), (void 
**) classname, sizeof(zval *), NULL);
+   
MAKE_STD_ZVAL(name);
ZVAL_STRING(name, mptr-common.function_name, 1);
zend_hash_update(Z_OBJPROP_P(object), name, sizeof(name), (void **) 
name, sizeof(zval *), NULL);
@@ -4326,17 +4326,18 @@
}
}
 
-   MAKE_STD_ZVAL(classname);
-   ZVAL_STRINGL(classname, ce-name, ce-name_length, 1);
-   zend_hash_update(Z_OBJPROP_P(object), class, sizeof(class), (void 
**) classname, sizeof(zval *), NULL);
-   
+   MAKE_STD_ZVAL(classname);   
MAKE_STD_ZVAL(propname);
+   
if (dynam_prop == 0) {
zend_unmangle_property_name(property_info-name, 
property_info-name_length, class_name, prop_name);
+   ZVAL_STRINGL(classname, property_info-ce-name, 
property_info-ce-name_length, 1);
ZVAL_STRING(propname, prop_name, 1);
} else {
+   ZVAL_STRINGL(classname, ce-name, ce-name_length, 1);  
ZVAL_STRINGL(propname, name_str, name_len, 1);
}
+   zend_hash_update(Z_OBJPROP_P(object), class, sizeof(class), (void 
**) classname, sizeof(zval *), NULL);
zend_hash_update(Z_OBJPROP_P(object), name, sizeof(name), (void **) 
propname, sizeof(zval *), NULL);
 
reference = (property_reference*) emalloc(sizeof(property_reference));
@@ -5437,7 +5438,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Reflection, enabled);
 
-   php_info_print_table_row(2, Version, $Revision: 1.164.2.33.2.45.2.55 
$);
+   php_info_print_table_row(2, Version, $Revision: 1.164.2.33.2.45.2.56 
$);
 
php_info_print_table_end();
 } /* }}} */
@@ -5451,7 +5452,7 @@
NULL,
NULL,

[PHP-CVS] cvs: php-src(PHP_5_3) /ext/reflection php_reflection.c

2009-04-02 Thread Ilia Alshanetsky
iliaa   Thu Apr  2 21:30:10 2009 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/reflection php_reflection.c 
  Log:
  
  Block unused function
  
http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.164.2.33.2.45.2.53r2=1.164.2.33.2.45.2.54diff_format=u
Index: php-src/ext/reflection/php_reflection.c
diff -u php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.53 
php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.54
--- php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.53Sun Feb 
 1 15:06:19 2009
+++ php-src/ext/reflection/php_reflection.c Thu Apr  2 21:30:09 2009
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.53 2009/02/01 15:06:19 cseiler 
Exp $ */
+/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.54 2009/04/02 21:30:09 iliaa Exp 
$ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -218,6 +218,7 @@
INIT_PZVAL(return_value);
 }
 
+#ifdef ilia_0
 static void _default_lookup_entry(zval *object, char *name, int name_len, zval 
**return_value TSRMLS_DC) /* {{{ */
 {
zval **value;
@@ -229,6 +230,7 @@
}
 }
 /* }}} */
+#endif
 
 static void reflection_register_implement(zend_class_entry *class_entry, 
zend_class_entry *interface_entry TSRMLS_DC)
 {
@@ -5435,7 +5437,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Reflection, enabled);
 
-   php_info_print_table_row(2, Version, $Revision: 1.164.2.33.2.45.2.53 
$);
+   php_info_print_table_row(2, Version, $Revision: 1.164.2.33.2.45.2.54 
$);
 
php_info_print_table_end();
 } /* }}} */
@@ -5449,7 +5451,7 @@
NULL,
NULL,
PHP_MINFO(reflection),
-   $Revision: 1.164.2.33.2.45.2.53 $,
+   $Revision: 1.164.2.33.2.45.2.54 $,
STANDARD_MODULE_PROPERTIES
 }; /* }}} */
 



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



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/reflection php_reflection.c

2009-02-01 Thread Christian Seiler
cseiler Sun Feb  1 15:06:20 2009 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/reflection php_reflection.c 
  Log:
  Fixed regression of bug #46205, thanks to felipe for pointing this out.
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.164.2.33.2.45.2.52r2=1.164.2.33.2.45.2.53diff_format=u
Index: php-src/ext/reflection/php_reflection.c
diff -u php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.52 
php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.53
--- php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.52Mon Jan 
26 22:54:33 2009
+++ php-src/ext/reflection/php_reflection.c Sun Feb  1 15:06:19 2009
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.52 2009/01/26 22:54:33 cseiler 
Exp $ */
+/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.53 2009/02/01 15:06:19 cseiler 
Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -2077,6 +2077,9 @@
}
efree(fptr);
}
+   if (is_closure) {
+   zval_ptr_dtor(reference);
+   }
_DO_THROW(The parameter specified by its offset could 
not be found);
/* returns out of this function */
}
@@ -2098,6 +2101,9 @@
}
efree(fptr);
}
+   if (is_closure) {
+   zval_ptr_dtor(reference);
+   }
_DO_THROW(The parameter specified by its name could 
not be found);
/* returns out of this function */
}
@@ -5429,7 +5435,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Reflection, enabled);
 
-   php_info_print_table_row(2, Version, $Revision: 1.164.2.33.2.45.2.52 
$);
+   php_info_print_table_row(2, Version, $Revision: 1.164.2.33.2.45.2.53 
$);
 
php_info_print_table_end();
 } /* }}} */
@@ -5443,7 +5449,7 @@
NULL,
NULL,
PHP_MINFO(reflection),
-   $Revision: 1.164.2.33.2.45.2.52 $,
+   $Revision: 1.164.2.33.2.45.2.53 $,
STANDARD_MODULE_PROPERTIES
 }; /* }}} */
 



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



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/reflection php_reflection.c /ext/reflection/tests 027.phpt ReflectionFunction_getClosure_basic.phpt ReflectionFunction_getClosure_error.phpt ReflectionMethod_getC

2009-01-26 Thread Christian Seiler
cseiler Mon Jan 26 22:54:41 2009 UTC

  Removed files:   (Branch: PHP_5_3)
/ZendEngine2/tests  closure_005.phpt closure_007.phpt 
/php-src/ext/reflection/tests   027.phpt 

ReflectionFunction_getClosure_basic.phpt 

ReflectionFunction_getClosure_error.phpt 
ReflectionMethod_getClosure_basic.phpt 
ReflectionMethod_getClosure_error.phpt 
closures_004.phpt 

  Modified files:  
/ZendEngine2zend_closures.c zend_closures.h zend_compile.c 
zend_compile.h zend_language_parser.y zend_vm_def.h 
zend_vm_execute.h 
/ZendEngine2/tests  closure_020.phpt closure_026.phpt 
closure_032.phpt 
/php-src/ext/reflection php_reflection.c 
/php-src/ext/reflection/tests   closures_001.phpt closures_002.phpt 
closures_003.phpt 
  Log:
  [DOC] Remove $this support in closures for PHP 5.3 beta 1
  - Implementation notes here:
http://wiki.php.net/rfc/closures/removal-of-this
  
  http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_closures.c?r1=1.3.2.25r2=1.3.2.26diff_format=u
Index: ZendEngine2/zend_closures.c
diff -u ZendEngine2/zend_closures.c:1.3.2.25 
ZendEngine2/zend_closures.c:1.3.2.26
--- ZendEngine2/zend_closures.c:1.3.2.25Wed Jan 14 10:28:22 2009
+++ ZendEngine2/zend_closures.c Mon Jan 26 22:54:18 2009
@@ -18,7 +18,7 @@
+--+
 */
 
-/* $Id: zend_closures.c,v 1.3.2.25 2009/01/14 10:28:22 dmitry Exp $ */
+/* $Id: zend_closures.c,v 1.3.2.26 2009/01/26 22:54:18 cseiler Exp $ */
 
 #include zend.h
 #include zend_API.h
@@ -37,7 +37,6 @@
 typedef struct _zend_closure {
zend_objectstd;
zend_function  func;
-   zval  *this_ptr;
 } zend_closure;
 
 /* non-static since it needs to be referenced */
@@ -111,13 +110,6 @@
 }
 /* }}} */
 
-ZEND_API zval* zend_get_closure_this_ptr(zval *obj TSRMLS_DC) /* {{{ */
-{
-   zend_closure *closure = (zend_closure 
*)zend_object_store_get_object(obj TSRMLS_CC);
-   return closure-this_ptr;
-}
-/* }}} */
-
 static zend_function *zend_closure_get_method(zval **object_ptr, char 
*method_name, int method_len TSRMLS_DC) /* {{{ */
 {
char *lc_name;
@@ -187,10 +179,6 @@
destroy_op_array(closure-func.op_array TSRMLS_CC);
}
 
-   if (closure-this_ptr) {
-   zval_ptr_dtor(closure-this_ptr);
-   }
-
efree(closure);
 }
 /* }}} */
@@ -223,17 +211,10 @@
closure = (zend_closure *)zend_object_store_get_object(obj TSRMLS_CC);
*fptr_ptr = closure-func;
 
-   if (closure-this_ptr) {
-   if (zobj_ptr) {
-   *zobj_ptr = closure-this_ptr;
-   }
-   *ce_ptr = Z_OBJCE_P(closure-this_ptr);
-   } else {
-   if (zobj_ptr) {
-   *zobj_ptr = NULL;
-   }
-   *ce_ptr = closure-func.common.scope;
+   if (zobj_ptr) {
+   *zobj_ptr = NULL;
}
+   *ce_ptr = NULL;
return SUCCESS;
 }
 /* }}} */
@@ -248,13 +229,6 @@
*is_temp = 1;
ALLOC_HASHTABLE(rv);
zend_hash_init(rv, 1, NULL, ZVAL_PTR_DTOR, 0);
-   val = closure-this_ptr;
-   if (!val) {
-   ALLOC_INIT_ZVAL(val);
-   } else {
-   Z_ADDREF_P(val);
-   }
-   zend_symtable_update(rv, this, sizeof(this), (void *) val, 
sizeof(zval *), NULL);
if (closure-func.type == ZEND_USER_FUNCTION  
closure-func.op_array.static_variables) {
HashTable *static_variables = 
closure-func.op_array.static_variables;
MAKE_STD_ZVAL(val);
@@ -369,7 +343,7 @@
 }
 /* }}} */
 
-ZEND_API void zend_create_closure(zval *res, zend_function *func, 
zend_class_entry *scope, zval *this_ptr TSRMLS_DC) /* {{{ */
+ZEND_API void zend_create_closure(zval *res, zend_function *func TSRMLS_DC) /* 
{{{ */
 {
zend_closure *closure;
 
@@ -390,19 +364,7 @@
(*closure-func.op_array.refcount)++;
}
 
-   closure-func.common.scope = scope;
-   if (scope) {
-   closure-func.common.fn_flags |= ZEND_ACC_PUBLIC;
-   if (this_ptr  (closure-func.common.fn_flags  
ZEND_ACC_STATIC) == 0) {
-   closure-this_ptr = this_ptr;
-   Z_ADDREF_P(this_ptr);
-   } else {
-   closure-func.common.fn_flags |= ZEND_ACC_STATIC;
-   closure-this_ptr = NULL;
-   }
-   } else {
-   closure-this_ptr = NULL;
-   }
+   closure-func.common.scope = NULL;
 }
 /* }}} */
 

[PHP-CVS] cvs: php-src(PHP_5_3) /ext/reflection php_reflection.c

2009-01-03 Thread Marcus Boerger
helly   Sat Jan  3 12:39:28 2009 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/reflection php_reflection.c 
  Log:
  - MFH Add minimalistic closure support
  http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.164.2.33.2.45.2.45r2=1.164.2.33.2.45.2.46diff_format=u
Index: php-src/ext/reflection/php_reflection.c
diff -u php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.45 
php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.46
--- php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.45Wed Dec 
31 14:36:27 2008
+++ php-src/ext/reflection/php_reflection.c Sat Jan  3 12:39:27 2009
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.45 2008/12/31 14:36:27 helly Exp 
$ */
+/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.46 2009/01/03 12:39:27 helly Exp 
$ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -319,7 +319,7 @@
 }
 
 static void _const_string(string *str, char *name, zval *value, char *indent 
TSRMLS_DC);
-static void _function_string(string *str, zend_function *fptr, 
zend_class_entry *scope, char *indent TSRMLS_DC);
+static void _function_string(string *str, zend_function *fptr, 
zend_class_entry *scope, zval* closure, char *indent TSRMLS_DC);
 static void _property_string(string *str, zend_property_info *prop, char 
*prop_name, char* indent TSRMLS_DC);
 static void _class_string(string *str, zend_class_entry *ce, zval *obj, char 
*indent TSRMLS_DC);
 static void _extension_string(string *str, zend_module_entry *module, char 
*indent TSRMLS_DC);
@@ -485,7 +485,7 @@
 ((mptr-common.fn_flags  
ZEND_ACC_PRIVATE) == 0 || mptr-common.scope == ce))
{
string_printf(str, \n);
-   _function_string(str, mptr, ce, 
sub_indent.string TSRMLS_CC);
+   _function_string(str, mptr, ce, NULL, 
sub_indent.string TSRMLS_CC);
}
zend_hash_move_forward_ex(ce-function_table, 
pos);
}
@@ -587,7 +587,7 @@
closure = NULL;
}
string_printf(dyn, \n);
-   _function_string(dyn, mptr, 
ce, sub_indent.string TSRMLS_CC);
+   _function_string(dyn, mptr, 
ce, NULL, sub_indent.string TSRMLS_CC);
count++;
_free_function(closure 
TSRMLS_CC);
}
@@ -744,7 +744,7 @@
 /* }}} */
 
 /* {{{ _function_string */
-static void _function_string(string *str, zend_function *fptr, 
zend_class_entry *scope, char* indent TSRMLS_DC)
+static void _function_string(string *str, zend_function *fptr, 
zend_class_entry *scope, zval* closure, char* indent TSRMLS_DC)
 {
string param_indent;
zend_function *overwrites;
@@ -759,7 +759,8 @@
string_printf(str, %s%s\n, indent, 
fptr-op_array.doc_comment);
}
 
-   string_printf(str, fptr-common.scope ? %sMethod [  : %sFunction [ 
, indent);
+   string_write(str, indent, strlen(indent));
+   string_printf(str, closure ? Closure [  : (fptr-common.scope ? 
Method [  : Function [ ));
string_printf(str, (fptr-type == ZEND_USER_FUNCTION) ? user : 
internal);
if (fptr-common.fn_flags  ZEND_ACC_DEPRECATED) {
string_printf(str, , deprecated);
@@ -835,6 +836,28 @@
fptr-op_array.line_start,
fptr-op_array.line_end);
}
+   if (closure) {
+   const zend_function *closure_fptr = 
zend_get_closure_method_def(closure TSRMLS_CC);
+   if (closure_fptr-type == ZEND_USER_FUNCTION  
closure_fptr-op_array.static_variables) {
+   HashTable *static_variables = 
closure_fptr-op_array.static_variables;
+   HashPosition pos;
+   uint key_len;
+   char* key;
+   ulong num_index, index = 0;
+   int count = zend_hash_num_elements(static_variables);
+   if (count) {
+   string_printf(str, \n);
+   string_printf(str, %s  - Static Parameters 
[%d] {\n, indent, count);
+   
zend_hash_internal_pointer_reset_ex(static_variables, pos);
+   while (index++  count) {
+   
zend_hash_get_current_key_ex(static_variables, key, key_len, num_index, 0, 
pos);
+  

[PHP-CVS] cvs: php-src(PHP_5_3) /ext/reflection php_reflection.c

2009-01-03 Thread Marcus Boerger
helly   Sat Jan  3 14:20:22 2009 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/reflection php_reflection.c 
  Log:
  - MFH Improved closure support
  
http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.164.2.33.2.45.2.46r2=1.164.2.33.2.45.2.47diff_format=u
Index: php-src/ext/reflection/php_reflection.c
diff -u php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.46 
php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.47
--- php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.46Sat Jan 
 3 12:39:27 2009
+++ php-src/ext/reflection/php_reflection.c Sat Jan  3 14:20:22 2009
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.46 2009/01/03 12:39:27 helly Exp 
$ */
+/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.47 2009/01/03 14:20:22 helly Exp 
$ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -223,6 +223,18 @@
INIT_PZVAL(return_value);
 }
 
+static void _default_lookup_entry(zval *object, char *name, int name_len, zval 
**return_value TSRMLS_DC) /* {{{ */
+{
+   zval **value;
+
+   if (zend_hash_find(Z_OBJPROP_P(object), name, name_len, (void **) 
value) == FAILURE) {
+   *return_value = NULL;
+   } else {
+   *return_value = *value;
+   }
+}
+/* }}} */
+
 static void reflection_register_implement(zend_class_entry *class_entry, 
zend_class_entry *interface_entry TSRMLS_DC)
 {
zend_uint num_interfaces = ++class_entry-num_interfaces;
@@ -319,7 +331,7 @@
 }
 
 static void _const_string(string *str, char *name, zval *value, char *indent 
TSRMLS_DC);
-static void _function_string(string *str, zend_function *fptr, 
zend_class_entry *scope, zval* closure, char *indent TSRMLS_DC);
+static void _function_string(string *str, zend_function *fptr, 
zend_class_entry *scope, zval* prop_name, zval* closure, char *indent 
TSRMLS_DC);
 static void _property_string(string *str, zend_property_info *prop, char 
*prop_name, char* indent TSRMLS_DC);
 static void _class_string(string *str, zend_class_entry *ce, zval *obj, char 
*indent TSRMLS_DC);
 static void _extension_string(string *str, zend_module_entry *module, char 
*indent TSRMLS_DC);
@@ -485,7 +497,7 @@
 ((mptr-common.fn_flags  
ZEND_ACC_PRIVATE) == 0 || mptr-common.scope == ce))
{
string_printf(str, \n);
-   _function_string(str, mptr, ce, NULL, 
sub_indent.string TSRMLS_CC);
+   _function_string(str, mptr, ce, NULL, 
NULL, sub_indent.string TSRMLS_CC);
}
zend_hash_move_forward_ex(ce-function_table, 
pos);
}
@@ -587,7 +599,7 @@
closure = NULL;
}
string_printf(dyn, \n);
-   _function_string(dyn, mptr, 
ce, NULL, sub_indent.string TSRMLS_CC);
+   _function_string(dyn, mptr, 
ce, NULL, NULL, sub_indent.string TSRMLS_CC);
count++;
_free_function(closure 
TSRMLS_CC);
}
@@ -744,7 +756,7 @@
 /* }}} */
 
 /* {{{ _function_string */
-static void _function_string(string *str, zend_function *fptr, 
zend_class_entry *scope, zval* closure, char* indent TSRMLS_DC)
+static void _function_string(string *str, zend_function *fptr, 
zend_class_entry *scope, zval* prop_name, zval* closure, char* indent TSRMLS_DC)
 {
string param_indent;
zend_function *overwrites;
@@ -828,7 +840,7 @@
if (fptr-op_array.return_reference) {
string_printf(str, );
}
-   string_printf(str, %s ] {\n, fptr-common.function_name);
+   string_printf(str, %s ] {\n, closure  prop_name ? 
Z_STRVAL_P(prop_name) : fptr-common.function_name);
/* The information where a function is declared is only available for 
user classes */
if (fptr-type == ZEND_USER_FUNCTION) {
string_printf(str, %s  @@ %s %d - %d\n, indent, 
@@ -1060,7 +1072,7 @@
continue;
}

-   _function_string(str, fptr, NULL, NULL,  
TSRMLS_CC);
+   _function_string(str, fptr, NULL, NULL, NULL,  
TSRMLS_CC);
func++;
}
string_printf(str, %s  }\n, indent);
@@ -1473,7 +1485,7 @@
}
 
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() 
TSRMLS_CC, O, closure, zend_ce_closure) == SUCCESS) {
-  

[PHP-CVS] cvs: php-src(PHP_5_3) /ext/reflection php_reflection.c

2009-01-03 Thread Marcus Boerger
helly   Sat Jan  3 19:08:47 2009 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/reflection php_reflection.c 
  Log:
  MFH
  - Add ReflectionFunctionAbstract::getClosureThis()
  [DOC]
  # Returns the this pointer bound to the closure is the relection object
  # points to closure. Since not all closures have a bound this, the method
  # cannot be used to differentiate between normal functions/methods and 
  # closures. Instead ReflectionFunctionAbstract::isClosure() has to be used.
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.164.2.33.2.45.2.47r2=1.164.2.33.2.45.2.48diff_format=u
Index: php-src/ext/reflection/php_reflection.c
diff -u php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.47 
php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.48
--- php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.47Sat Jan 
 3 14:20:22 2009
+++ php-src/ext/reflection/php_reflection.c Sat Jan  3 19:08:47 2009
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.47 2009/01/03 14:20:22 helly Exp 
$ */
+/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.48 2009/01/03 19:08:47 helly Exp 
$ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -1550,6 +1550,23 @@
 }
 /* }}} */
 
+/* {{{ proto public bool ReflectionFunction::getClosureThis()
+   Returns this pointer bound to closure */
+ZEND_METHOD(reflection_function, getClosureThis)
+{
+   reflection_object *intern;
+   zend_function *fptr;
+   zval* closure_this;
+
+   METHOD_NOTSTATIC_NUMPARAMS(reflection_function_abstract_ptr, 0);
+   GET_REFLECTION_OBJECT_PTR(fptr);
+   if (intern-obj) {
+   closure_this = zend_get_closure_this_ptr(intern-obj TSRMLS_CC);
+   RETURN_ZVAL(closure_this, 1, 0);
+   }
+}
+/* }}} */
+
 /* {{{ proto public bool ReflectionFunction::isInternal()
Returns whether this is an internal function */
 ZEND_METHOD(reflection_function, isInternal)
@@ -4927,25 +4944,26 @@
 static const zend_function_entry reflection_function_abstract_functions[] = {
ZEND_ME(reflection, __clone, NULL, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
PHP_ABSTRACT_ME(reflection_function, __toString, NULL)
+   ZEND_ME(reflection_function, inNamespace, NULL, 0)
ZEND_ME(reflection_function, isClosure, NULL, 0)
+   ZEND_ME(reflection_function, isDeprecated, NULL, 0)
ZEND_ME(reflection_function, isInternal, NULL, 0)
ZEND_ME(reflection_function, isUserDefined, NULL, 0)
-   ZEND_ME(reflection_function, getName, NULL, 0)
-   ZEND_ME(reflection_function, getFileName, NULL, 0)
-   ZEND_ME(reflection_function, getStartLine, NULL, 0)
-   ZEND_ME(reflection_function, getEndLine, NULL, 0)
+   ZEND_ME(reflection_function, getClosureThis, NULL, 0)
ZEND_ME(reflection_function, getDocComment, NULL, 0)
-   ZEND_ME(reflection_function, getStaticVariables, NULL, 0)
-   ZEND_ME(reflection_function, returnsReference, NULL, 0)
-   ZEND_ME(reflection_function, getParameters, NULL, 0)
-   ZEND_ME(reflection_function, getNumberOfParameters, NULL, 0)
-   ZEND_ME(reflection_function, getNumberOfRequiredParameters, NULL, 0)
+   ZEND_ME(reflection_function, getEndLine, NULL, 0)
ZEND_ME(reflection_function, getExtension, NULL, 0)
ZEND_ME(reflection_function, getExtensionName, NULL, 0)
-   ZEND_ME(reflection_function, isDeprecated, NULL, 0)
-   ZEND_ME(reflection_function, inNamespace, NULL, 0)
+   ZEND_ME(reflection_function, getFileName, NULL, 0)
+   ZEND_ME(reflection_function, getName, NULL, 0)
ZEND_ME(reflection_function, getNamespaceName, NULL, 0)
+   ZEND_ME(reflection_function, getNumberOfParameters, NULL, 0)
+   ZEND_ME(reflection_function, getNumberOfRequiredParameters, NULL, 0)
+   ZEND_ME(reflection_function, getParameters, NULL, 0)
ZEND_ME(reflection_function, getShortName, NULL, 0)
+   ZEND_ME(reflection_function, getStartLine, NULL, 0)
+   ZEND_ME(reflection_function, getStaticVariables, NULL, 0)
+   ZEND_ME(reflection_function, returnsReference, NULL, 0)
{NULL, NULL, NULL}
 };
 
@@ -5352,7 +5370,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Reflection, enabled);
 
-   php_info_print_table_row(2, Version, $Revision: 1.164.2.33.2.45.2.47 
$);
+   php_info_print_table_row(2, Version, $Revision: 1.164.2.33.2.45.2.48 
$);
 
php_info_print_table_end();
 } /* }}} */
@@ -5366,7 +5384,7 @@
NULL,
NULL,
PHP_MINFO(reflection),
-   $Revision: 1.164.2.33.2.45.2.47 $,
+   $Revision: 1.164.2.33.2.45.2.48 $,
STANDARD_MODULE_PROPERTIES
 }; /* }}} */
 



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



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/reflection php_reflection.c

2009-01-03 Thread Marcus Boerger
helly   Sat Jan  3 20:04:23 2009 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/reflection php_reflection.c 
  Log:
  - MFH Show closure's bound  as static parameter
  
http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.164.2.33.2.45.2.48r2=1.164.2.33.2.45.2.49diff_format=u
Index: php-src/ext/reflection/php_reflection.c
diff -u php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.48 
php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.49
--- php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.48Sat Jan 
 3 19:08:47 2009
+++ php-src/ext/reflection/php_reflection.c Sat Jan  3 20:04:22 2009
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.48 2009/01/03 19:08:47 helly Exp 
$ */
+/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.49 2009/01/03 20:04:22 helly Exp 
$ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -850,24 +850,32 @@
}
if (closure) {
const zend_function *closure_fptr = 
zend_get_closure_method_def(closure TSRMLS_CC);
+   zval *closure_this = zend_get_closure_this_ptr(closure 
TSRMLS_CC);
+   HashTable *static_variables = NULL;
+   int index = 0, count = closure_this ? 1 : 0;
if (closure_fptr-type == ZEND_USER_FUNCTION  
closure_fptr-op_array.static_variables) {
-   HashTable *static_variables = 
closure_fptr-op_array.static_variables;
-   HashPosition pos;
-   uint key_len;
-   char* key;
-   ulong num_index, index = 0;
-   int count = zend_hash_num_elements(static_variables);
-   if (count) {
-   string_printf(str, \n);
-   string_printf(str, %s  - Static Parameters 
[%d] {\n, indent, count);
+   static_variables = 
closure_fptr-op_array.static_variables;
+   count += zend_hash_num_elements(static_variables);
+   }
+   if (count) {
+   string_printf(str, \n);
+   string_printf(str, %s  - Static Parameters [%d] {\n, 
indent, count);
+   if (closure_this) {
+   string_printf(str, %sParameter #%d [ %s 
$this ]\n, indent, ++index, Z_OBJCE_P(closure_this)-name);
+   }
+   if (static_variables) {
+   HashPosition pos;
+   uint key_len;
+   char* key;
+   ulong num_index;

zend_hash_internal_pointer_reset_ex(static_variables, pos);
while (index++  count) {

zend_hash_get_current_key_ex(static_variables, key, key_len, num_index, 0, 
pos);
string_printf(str, %sParameter #%d 
[ $%s ]\n, indent, index++, key);

zend_hash_move_forward_ex(static_variables, pos);
-   }   
-   string_printf(str, %s  }\n, indent);
+   }
}
+   string_printf(str, %s  }\n, indent);
}
}
string_init(param_indent);
@@ -5370,7 +5378,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Reflection, enabled);
 
-   php_info_print_table_row(2, Version, $Revision: 1.164.2.33.2.45.2.48 
$);
+   php_info_print_table_row(2, Version, $Revision: 1.164.2.33.2.45.2.49 
$);
 
php_info_print_table_end();
 } /* }}} */
@@ -5384,7 +5392,7 @@
NULL,
NULL,
PHP_MINFO(reflection),
-   $Revision: 1.164.2.33.2.45.2.48 $,
+   $Revision: 1.164.2.33.2.45.2.49 $,
STANDARD_MODULE_PROPERTIES
 }; /* }}} */
 



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



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/reflection php_reflection.c /ext/reflection/tests 027.phpt ReflectionMethod_getClosure_error.phpt

2009-01-03 Thread Marcus Boerger
helly   Sat Jan  3 20:41:01 2009 UTC

  Added files: (Branch: PHP_5_3)
/php-src/ext/reflection/tests   027.phpt 

  Modified files:  
/php-src/ext/reflection php_reflection.c 
/php-src/ext/reflection/tests   
ReflectionMethod_getClosure_error.phpt 
  Log:
  - MFH Minor corrections and a new test
  
http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.164.2.33.2.45.2.49r2=1.164.2.33.2.45.2.50diff_format=u
Index: php-src/ext/reflection/php_reflection.c
diff -u php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.49 
php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.50
--- php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.49Sat Jan 
 3 20:04:22 2009
+++ php-src/ext/reflection/php_reflection.c Sat Jan  3 20:41:00 2009
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.49 2009/01/03 20:04:22 helly Exp 
$ */
+/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.50 2009/01/03 20:41:00 helly Exp 
$ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -861,7 +861,7 @@
string_printf(str, \n);
string_printf(str, %s  - Static Parameters [%d] {\n, 
indent, count);
if (closure_this) {
-   string_printf(str, %sParameter #%d [ %s 
$this ]\n, indent, ++index, Z_OBJCE_P(closure_this)-name);
+   string_printf(str, %sParameter #%d [ %s 
$this ]\n, indent, index++, Z_OBJCE_P(closure_this)-name);
}
if (static_variables) {
HashPosition pos;
@@ -869,7 +869,7 @@
char* key;
ulong num_index;

zend_hash_internal_pointer_reset_ex(static_variables, pos);
-   while (index++  count) {
+   while (index  count) {

zend_hash_get_current_key_ex(static_variables, key, key_len, num_index, 0, 
pos);
string_printf(str, %sParameter #%d 
[ $%s ]\n, indent, index++, key);

zend_hash_move_forward_ex(static_variables, pos);
@@ -1570,7 +1570,9 @@
GET_REFLECTION_OBJECT_PTR(fptr);
if (intern-obj) {
closure_this = zend_get_closure_this_ptr(intern-obj TSRMLS_CC);
-   RETURN_ZVAL(closure_this, 1, 0);
+   if (closure_this) {
+   RETURN_ZVAL(closure_this, 1, 0);
+   }
}
 }
 /* }}} */
@@ -5378,7 +5380,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Reflection, enabled);
 
-   php_info_print_table_row(2, Version, $Revision: 1.164.2.33.2.45.2.49 
$);
+   php_info_print_table_row(2, Version, $Revision: 1.164.2.33.2.45.2.50 
$);
 
php_info_print_table_end();
 } /* }}} */
@@ -5392,7 +5394,7 @@
NULL,
NULL,
PHP_MINFO(reflection),
-   $Revision: 1.164.2.33.2.45.2.49 $,
+   $Revision: 1.164.2.33.2.45.2.50 $,
STANDARD_MODULE_PROPERTIES
 }; /* }}} */
 
http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/ReflectionMethod_getClosure_error.phpt?r1=1.1.2.1r2=1.1.2.2diff_format=u
Index: php-src/ext/reflection/tests/ReflectionMethod_getClosure_error.phpt
diff -u 
php-src/ext/reflection/tests/ReflectionMethod_getClosure_error.phpt:1.1.2.1 
php-src/ext/reflection/tests/ReflectionMethod_getClosure_error.phpt:1.1.2.2
--- php-src/ext/reflection/tests/ReflectionMethod_getClosure_error.phpt:1.1.2.1 
Fri Aug  8 12:39:16 2008
+++ php-src/ext/reflection/tests/ReflectionMethod_getClosure_error.phpt Sat Jan 
 3 20:41:01 2009
@@ -56,9 +56,13 @@
 *** Testing ReflectionMethod::getClosure() : error conditions ***
 
 -- Testing ReflectionMethod::getClosure() function with more than expected no. 
of arguments --
-object(Closure)#%d (0) {
+object(Closure)#%d (1) {
+  [this]=
+  NULL
 }
-object(Closure)#%d (0) {
+object(Closure)#%d (1) {
+  [this]=
+  NULL
 }
 
 Warning: ReflectionMethod::getClosure() expects exactly 1 parameter, 2 given 
in %s on line %d

http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/027.phpt?view=markuprev=1.1
Index: php-src/ext/reflection/tests/027.phpt
+++ php-src/ext/reflection/tests/027.phpt
--TEST--
--FILE--
?php

$global = 42;

$func = function($x, stdClass $y=NULL) use($global) {
static $static;
};

ReflectionFunction::Export($func);

$r = new ReflectionFunction($func);

var_dump(@get_class($r-getClosureThis()));
var_dump($r-getName());
var_dump($r-isClosure());

Class Test {
public $func;
function __construct(){
global $global;
$this-func = function($x, stdClass $y = NULL) use($global) {
   

[PHP-CVS] cvs: php-src(PHP_5_3) /ext/reflection php_reflection.c

2008-12-31 Thread Marcus Boerger
helly   Wed Dec 31 14:36:27 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/reflection php_reflection.c 
  Log:
  - Use Revision instead of Id tag for version
  
http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.164.2.33.2.45.2.44r2=1.164.2.33.2.45.2.45diff_format=u
Index: php-src/ext/reflection/php_reflection.c
diff -u php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.44 
php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.45
--- php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.44Wed Dec 
31 11:15:42 2008
+++ php-src/ext/reflection/php_reflection.c Wed Dec 31 14:36:27 2008
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.44 2008/12/31 11:15:42 sebastian 
Exp $ */
+/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.45 2008/12/31 14:36:27 helly Exp 
$ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -5262,7 +5262,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.45.2.44 2008/12/31 11:15:42 sebastian Exp $);
+   php_info_print_table_row(2, Version, $Revision: 1.164.2.33.2.45.2.45 
$);
 
php_info_print_table_end();
 } /* }}} */
@@ -5276,7 +5276,7 @@
NULL,
NULL,
PHP_MINFO(reflection),
-   0.1,
+   $Revision: 1.164.2.33.2.45.2.45 $,
STANDARD_MODULE_PROPERTIES
 }; /* }}} */
 



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



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/reflection php_reflection.c /ext/reflection/tests reflectionProperty_setAccessible.phpt

2008-11-29 Thread Sebastian Bergmann
sebastian   Sat Nov 29 15:58:54 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/reflection php_reflection.c 
/php-src/ext/reflection/tests   reflectionProperty_setAccessible.phpt 
  Log:
  MFH: Fix #46718: ReflectionProperty::setValue() and 
ReflectionProperty::setAccessible().
  
http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.164.2.33.2.45.2.42r2=1.164.2.33.2.45.2.43diff_format=u
Index: php-src/ext/reflection/php_reflection.c
diff -u php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.42 
php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.43
--- php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.42Thu Nov 
27 19:01:22 2008
+++ php-src/ext/reflection/php_reflection.c Sat Nov 29 15:58:54 2008
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.42 2008/11/27 19:01:22 dmitry Exp 
$ */
+/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.43 2008/11/29 15:58:54 sebastian 
Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -4365,7 +4365,7 @@
METHOD_NOTSTATIC(reflection_property_ptr);
GET_REFLECTION_OBJECT_PTR(ref);
 
-   if (!(ref-prop.flags  ZEND_ACC_PUBLIC)) {
+   if (!(ref-prop.flags  ZEND_ACC_PUBLIC)  ref-ignore_visibility == 
0) {
_default_get_entry(getThis(), name, sizeof(name), name 
TSRMLS_CC);
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, 
Cannot access non-public member %s::%s, 
intern-ce-name, Z_STRVAL(name));
@@ -4409,10 +4409,13 @@
zend_hash_quick_update(prop_table, ref-prop.name, 
ref-prop.name_length+1, ref-prop.h, value, sizeof(zval *), (void **) foo);
}
} else {
+   char *class_name, *prop_name;
+
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, oz, 
object, value) == FAILURE) {
return;
}
-   zend_update_property(Z_OBJCE_P(object), object, ref-prop.name, 
ref-prop.name_length, value TSRMLS_CC);
+   zend_unmangle_property_name(ref-prop.name, 
ref-prop.name_length, class_name, prop_name);
+   zend_update_property(Z_OBJCE_P(object), object, prop_name, 
strlen(prop_name), value TSRMLS_CC);
}
 }
 /* }}} */
@@ -5259,7 +5262,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.45.2.42 2008/11/27 19:01:22 dmitry Exp $);
+   php_info_print_table_row(2, Version, $Id: php_reflection.c,v 
1.164.2.33.2.45.2.43 2008/11/29 15:58:54 sebastian Exp $);
 
php_info_print_table_end();
 } /* }}} */
http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/reflectionProperty_setAccessible.phpt?r1=1.1.2.3r2=1.1.2.4diff_format=u
Index: php-src/ext/reflection/tests/reflectionProperty_setAccessible.phpt
diff -u 
php-src/ext/reflection/tests/reflectionProperty_setAccessible.phpt:1.1.2.3 
php-src/ext/reflection/tests/reflectionProperty_setAccessible.phpt:1.1.2.4
--- php-src/ext/reflection/tests/reflectionProperty_setAccessible.phpt:1.1.2.3  
Sat May 24 13:34:22 2008
+++ php-src/ext/reflection/tests/reflectionProperty_setAccessible.phpt  Sat Nov 
29 15:58:54 2008
@@ -2,43 +2,81 @@
 Test ReflectionProperty::setAccessible().
 --FILE--
 ?php
-
-class TestClass {
-public $pub;
-public $pub2 = 5;
-static public $stat = static property;
-protected $prot = 4;
-private $priv = keepOut;
+class A {
+protected $protected = 'a';
+protected static $protectedStatic = 'b';
+private $private = 'c';
+private static $privateStatic = 'd';
 }
 
-class AnotherClass {
+$a   = new A;
+$protected   = new ReflectionProperty($a, 'protected');
+$protectedStatic = new ReflectionProperty('A', 'protectedStatic');
+$private = new ReflectionProperty($a, 'private');
+$privateStatic   = new ReflectionProperty('A', 'privateStatic');
+
+try {
+var_dump($protected-getValue($a));
 }
 
-$instance = new TestClass();
+catch (ReflectionException $e) {
+var_dump($e-getMessage());
+}
 
-echo \nProtected property:\n;
-$propInfo = new ReflectionProperty('TestClass', 'prot');
 try {
-var_dump($propInfo-getValue($instance));
+var_dump($protectedStatic-getValue());
 }
-catch(Exception $exc) {
-echo $exc-getMessage(), \n;
+
+catch (ReflectionException $e) {
+var_dump($e-getMessage());
 }
 
-$propInfo-setAccessible(true);
-var_dump($propInfo-getValue($instance));
+try {
+var_dump($private-getValue($a));
+}
+
+catch (ReflectionException $e) {
+var_dump($e-getMessage());
+}
 
-$propInfo-setAccessible(false);
 try {
-var_dump($propInfo-getValue($instance));
+var_dump($privateStatic-getValue());
 }
-catch(Exception $exc) {
-echo $exc-getMessage(), \n;
+
+catch 

[PHP-CVS] cvs: php-src(PHP_5_3) /ext/reflection php_reflection.c

2008-11-14 Thread Hannes Magnusson
bjori   Fri Nov 14 19:22:43 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/reflection php_reflection.c 
  Log:
  MFH: Interfaces extend other interfaces, not implement
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.164.2.33.2.45.2.39r2=1.164.2.33.2.45.2.40diff_format=u
Index: php-src/ext/reflection/php_reflection.c
diff -u php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.39 
php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.40
--- php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.39Tue Nov 
 4 15:58:55 2008
+++ php-src/ext/reflection/php_reflection.c Fri Nov 14 19:22:43 2008
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.39 2008/11/04 15:58:55 helly Exp 
$ */
+/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.40 2008/11/14 19:22:43 bjori Exp 
$ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -371,7 +371,11 @@
if (ce-num_interfaces) {
zend_uint i;
 
-   string_printf(str,  implements %s, ce-interfaces[0]-name);
+   if (ce-ce_flags  ZEND_ACC_INTERFACE) {
+   string_printf(str,  extends %s, 
ce-interfaces[0]-name);
+   } else {
+   string_printf(str,  implements %s, 
ce-interfaces[0]-name);
+   }
for (i = 1; i  ce-num_interfaces; ++i) {
string_printf(str, , %s, ce-interfaces[i]-name);
}
@@ -5293,7 +5297,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.45.2.39 2008/11/04 15:58:55 helly Exp $);
+   php_info_print_table_row(2, Version, $Id: php_reflection.c,v 
1.164.2.33.2.45.2.40 2008/11/14 19:22:43 bjori Exp $);
 
php_info_print_table_end();
 } /* }}} */



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



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/reflection php_reflection.c /ext/reflection/tests bug46064.phpt bug46064_2.phpt

2008-10-29 Thread Felipe Pena
felipe  Wed Oct 29 12:56:29 2008 UTC

  Added files: (Branch: PHP_5_3)
/php-src/ext/reflection/tests   bug46064.phpt bug46064_2.phpt 

  Modified files:  
/php-src/ext/reflection php_reflection.c 
  Log:
  - MFH: Fixed bug #46064 (Exception when creating ReflectionProperty object on 
dynamicly created property)
  
  http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.164.2.33.2.45.2.36r2=1.164.2.33.2.45.2.37diff_format=u
Index: php-src/ext/reflection/php_reflection.c
diff -u php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.36 
php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.37
--- php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.36Fri Oct 
24 14:35:37 2008
+++ php-src/ext/reflection/php_reflection.c Wed Oct 29 12:56:28 2008
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.36 2008/10/24 14:35:37 felipe Exp 
$ */
+/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.37 2008/10/29 12:56:28 felipe Exp 
$ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -1395,6 +1395,9 @@
if (modifiers  (ZEND_ACC_FINAL | ZEND_ACC_FINAL_CLASS)) {
add_next_index_stringl(return_value, final, 
sizeof(final)-1, 1);
}
+   if (modifiers  ZEND_ACC_IMPLICIT_PUBLIC) {
+   add_next_index_stringl(return_value, public, 
sizeof(public)-1, 1);
+   }
 
/* These are mutually exclusive */
switch (modifiers  ZEND_ACC_PPP_MASK) {
@@ -3378,9 +3381,25 @@
}
 
GET_REFLECTION_OBJECT_PTR(ce);
-   if (zend_hash_find(ce-properties_info, name, name_len + 1, (void**) 
property_info) == SUCCESS  (property_info-flags  ZEND_ACC_SHADOW) == 0) {
-   reflection_property_factory(ce, property_info, return_value 
TSRMLS_CC);
-   return;
+   if (zend_hash_find(ce-properties_info, name, name_len + 1, (void**) 
property_info) == SUCCESS) {
+   if ((property_info-flags  ZEND_ACC_SHADOW) == 0) {
+   reflection_property_factory(ce, property_info, 
return_value TSRMLS_CC);
+   return;
+   }
+   } else if (intern-obj) {
+   /* Check for dynamic properties */
+   if 
(zend_hash_exists(Z_OBJ_HT_P(intern-obj)-get_properties(intern-obj 
TSRMLS_CC), name, name_len+1)) {
+   zend_property_info property_info_tmp;
+   property_info_tmp.flags = ZEND_ACC_IMPLICIT_PUBLIC;
+   property_info_tmp.name = name;
+   property_info_tmp.name_length = name_len;
+   property_info_tmp.h = zend_get_hash_value(name, 
name_len+1);
+   property_info_tmp.doc_comment = NULL;
+   property_info_tmp.ce = ce;
+
+   reflection_property_factory(ce, property_info_tmp, 
return_value TSRMLS_CC);
+   return;
+   }
}
if ((tmp = strstr(name, ::)) != NULL) {
classname_len = tmp - name;
@@ -4094,12 +4113,12 @@
 {
zval *propname, *classname;
char *name_str, *class_name, *prop_name;
-   int name_len;
+   int name_len, dynam_prop = 0;
zval *object;
reflection_object *intern;
zend_class_entry **pce;
zend_class_entry *ce;
-   zend_property_info *property_info;
+   zend_property_info *property_info = NULL;
property_reference *reference;
 
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, zs, classname, 
name_str, name_len) == FAILURE) {
@@ -4133,12 +4152,19 @@
}
 
if (zend_hash_find(ce-properties_info, name_str, name_len + 1, (void 
**) property_info) == FAILURE || (property_info-flags  ZEND_ACC_SHADOW)) {
-   zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, 
-   Property %s::$%s does not exist, ce-name, name_str);
-   return;
+   /* Check for dynamic properties */
+   if (property_info == NULL  Z_TYPE_P(classname) == IS_OBJECT 
 Z_OBJ_HT_P(classname)-get_properties) {
+   if 
(zend_hash_exists(Z_OBJ_HT_P(classname)-get_properties(classname TSRMLS_CC), 
name_str, name_len+1)) {
+   dynam_prop = 1;
+   }
+   }
+   if (dynam_prop == 0) {
+   zend_throw_exception_ex(reflection_exception_ptr, 0 
TSRMLS_CC, Property %s::$%s does not exist, ce-name, name_str);
+   return;
+   }
}

-   if (!(property_info-flags  ZEND_ACC_PRIVATE)) {
+   if (dynam_prop == 0  (property_info-flags  ZEND_ACC_PRIVATE) == 0) {
/* we have to search the class hierarchy for this (implicit) 
public or protected property */
zend_class_entry *tmp_ce = ce;
   

[PHP-CVS] cvs: php-src(PHP_5_3) /ext/reflection php_reflection.c ZendEngine2 zend_compile.c

2008-08-22 Thread Felipe Pena
felipe  Fri Aug 22 15:54:22 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/ZendEngine2zend_compile.c 
/php-src/ext/reflection php_reflection.c 
  Log:
  - MFH: Removed unused arguments
  
  
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_compile.c?r1=1.647.2.27.2.41.2.82r2=1.647.2.27.2.41.2.83diff_format=u
Index: ZendEngine2/zend_compile.c
diff -u ZendEngine2/zend_compile.c:1.647.2.27.2.41.2.82 
ZendEngine2/zend_compile.c:1.647.2.27.2.41.2.83
--- ZendEngine2/zend_compile.c:1.647.2.27.2.41.2.82 Tue Aug 12 17:20:24 2008
+++ ZendEngine2/zend_compile.c  Fri Aug 22 15:54:20 2008
@@ -17,7 +17,7 @@
+--+
 */
 
-/* $Id: zend_compile.c,v 1.647.2.27.2.41.2.82 2008/08/12 17:20:24 felipe Exp $ 
*/
+/* $Id: zend_compile.c,v 1.647.2.27.2.41.2.83 2008/08/22 15:54:20 felipe Exp $ 
*/
 
 #include zend_language_parser.h
 #include zend.h
@@ -2790,7 +2790,7 @@
zend_update_class_constants(parent_ce  TSRMLS_CC);
zend_hash_apply_with_arguments(CE_STATIC_MEMBERS(parent_ce) 
TSRMLS_CC, (apply_func_args_t)inherit_static_prop, 1, 
ce-default_static_members);
} else {
-   
zend_hash_apply_with_arguments(parent_ce-default_static_members TSRMLS_CC, 
(apply_func_args_t)inherit_static_prop, 1, ce-default_static_members 
TSRMLS_CC);
+   
zend_hash_apply_with_arguments(parent_ce-default_static_members TSRMLS_CC, 
(apply_func_args_t)inherit_static_prop, 1, ce-default_static_members);
}
zend_hash_merge_ex(ce-properties_info, parent_ce-properties_info, 
(copy_ctor_func_t) (ce-type  ZEND_INTERNAL_CLASS ? 
zend_duplicate_property_info_internal : zend_duplicate_property_info), 
sizeof(zend_property_info), (merge_checker_func_t) 
do_inherit_property_access_check, ce);
 
http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.164.2.33.2.45.2.33r2=1.164.2.33.2.45.2.34diff_format=u
Index: php-src/ext/reflection/php_reflection.c
diff -u php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.33 
php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.34
--- php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.33Mon Aug 
11 22:31:21 2008
+++ php-src/ext/reflection/php_reflection.c Fri Aug 22 15:54:21 2008
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.33 2008/08/11 22:31:21 cseiler 
Exp $ */
+/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.34 2008/08/22 15:54:21 felipe Exp 
$ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -1010,7 +1010,7 @@
int num_constants = 0;

string_init(str_constants);
-   zend_hash_apply_with_arguments(EG(zend_constants) TSRMLS_CC, 
(apply_func_args_t) _extension_const_string, 4, str_constants, indent, module, 
num_constants TSRMLS_CC);
+   zend_hash_apply_with_arguments(EG(zend_constants) TSRMLS_CC, 
(apply_func_args_t) _extension_const_string, 4, str_constants, indent, module, 
num_constants);
if (num_constants) {
string_printf(str, \n  - Constants [%d] {\n, 
num_constants);
string_append(str, str_constants);
@@ -1047,7 +1047,7 @@
string_init(sub_indent);
string_printf(sub_indent, %s, indent);
string_init(str_classes);
-   zend_hash_apply_with_arguments(EG(class_table) TSRMLS_CC, 
(apply_func_args_t) _extension_class_string, 4, str_classes, 
sub_indent.string, module, num_classes TSRMLS_CC);
+   zend_hash_apply_with_arguments(EG(class_table) TSRMLS_CC, 
(apply_func_args_t) _extension_class_string, 4, str_classes, 
sub_indent.string, module, num_classes);
if (num_classes) {
string_printf(str, \n  - Classes [%d] {, num_classes);
string_append(str, str_classes);
@@ -4648,7 +4648,7 @@
GET_REFLECTION_OBJECT_PTR(module);
 
array_init(return_value);
-   zend_hash_apply_with_arguments(EG(class_table) TSRMLS_CC, 
(apply_func_args_t) add_extension_class, 3, return_value, module, 1 TSRMLS_CC);
+   zend_hash_apply_with_arguments(EG(class_table) TSRMLS_CC, 
(apply_func_args_t) add_extension_class, 3, return_value, module, 1);
 }
 /* }}} */
 
@@ -4663,7 +4663,7 @@
GET_REFLECTION_OBJECT_PTR(module);
 
array_init(return_value);
-   zend_hash_apply_with_arguments(EG(class_table) TSRMLS_CC, 
(apply_func_args_t) add_extension_class, 3, return_value, module, 0 TSRMLS_CC);
+   zend_hash_apply_with_arguments(EG(class_table) TSRMLS_CC, 
(apply_func_args_t) add_extension_class, 3, return_value, module, 0);
 }
 /* }}} */
 
@@ -5242,7 +5242,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Reflection, enabled);
 
-   php_info_print_table_row(2, Version, $Id: 

[PHP-CVS] cvs: php-src(PHP_5_3) /ext/reflection php_reflection.c /ext/reflection/tests closures_001.phpt closures_002.phpt reflectionParameter_export_error2.phpt

2008-08-11 Thread Marcus Boerger
helly   Mon Aug 11 12:43:22 2008 UTC

  Added files: (Branch: PHP_5_3)
/php-src/ext/reflection/tests   closures_001.phpt closures_002.phpt 

  Modified files:  
/php-src/ext/reflection php_reflection.c 
/php-src/ext/reflection/tests   
reflectionParameter_export_error2.phpt 
  Log:
  - MFH Closure/Reflection integration (original idea by Christian Seiler)
  
  http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.164.2.33.2.45.2.28r2=1.164.2.33.2.45.2.29diff_format=u
Index: php-src/ext/reflection/php_reflection.c
diff -u php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.28 
php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.29
--- php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.28Mon Aug 
11 00:47:45 2008
+++ php-src/ext/reflection/php_reflection.c Mon Aug 11 12:43:21 2008
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.28 2008/08/11 00:47:45 felipe Exp 
$ */
+/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.29 2008/08/11 12:43:21 helly Exp 
$ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -192,11 +192,18 @@
zend_function *fptr;
 } parameter_reference;
 
+typedef enum {
+   REF_TYPE_OTHER,  /* Must be 0 */
+   REF_TYPE_FUNCTION,
+   REF_TYPE_PARAMETER,
+   REF_TYPE_PROPERTY,
+} reflection_type_t;
+
 /* Struct for reflection objects */
 typedef struct {
zend_object zo;
void *ptr;
-   unsigned int free_ptr:1;
+   reflection_type_t ref_type;
zval *obj;
zend_class_entry *ce;
 } reflection_object;
@@ -224,33 +231,45 @@
class_entry-interfaces[num_interfaces - 1] = interface_entry;
 }
 
-static void reflection_free_objects_storage(void *object TSRMLS_DC)
+static void _free_function(zend_function *fptr TSRMLS_DC) /* {{{ */
 {
-   reflection_object *intern = (reflection_object *) object;
-
-   if (intern-free_ptr  intern-ptr) {
-   efree(intern-ptr);
-   intern-ptr = NULL;
-   }
-   if (intern-obj) {
-   zval_ptr_dtor(intern-obj);
+   if (fptr
+fptr-type == ZEND_INTERNAL_FUNCTION
+(fptr-internal_function.fn_flags  
ZEND_ACC_CALL_VIA_HANDLER) != 0
+   ) {
+   efree(fptr-internal_function.function_name);
+   efree(fptr);
}
-   zend_objects_free_object_storage(object TSRMLS_CC);
 }
+/* }}} */
 
-static void reflection_objects_clone(void *object, void **object_clone 
TSRMLS_DC)
+static void reflection_free_objects_storage(void *object TSRMLS_DC)
 {
reflection_object *intern = (reflection_object *) object;
-   reflection_object **intern_clone = (reflection_object **) object_clone;
+   parameter_reference *reference;
 
-   *intern_clone = emalloc(sizeof(reflection_object));
-   zend_object_std_init((*intern_clone)-zo, intern-zo.ce TSRMLS_CC);
-   (*intern_clone)-ptr = intern-ptr;
-   (*intern_clone)-free_ptr = intern-free_ptr;
-   (*intern_clone)-obj = intern-obj;
+   if (intern-ptr) {
+   switch (intern-ref_type) {
+   case REF_TYPE_PARAMETER:
+   reference = (parameter_reference*)intern-ptr;
+   _free_function(reference-fptr TSRMLS_CC);
+   efree(intern-ptr);
+   break;
+   case REF_TYPE_FUNCTION:
+   _free_function(intern-ptr TSRMLS_CC);
+   break;
+   case REF_TYPE_PROPERTY:
+   efree(intern-ptr);
+   break;
+   case REF_TYPE_OTHER:
+   break;
+   }
+   }
+   intern-ptr = NULL;
if (intern-obj) {
-   zval_add_ref(intern-obj);
+   zval_ptr_dtor(intern-obj);
}
+   zend_objects_free_object_storage(object TSRMLS_CC);
 }
 
 static zend_object_value reflection_objects_new(zend_class_entry *class_type 
TSRMLS_DC)
@@ -259,16 +278,12 @@
zend_object_value retval;
reflection_object *intern;
 
-   intern = emalloc(sizeof(reflection_object));
+   intern = ecalloc(1, sizeof(reflection_object));
intern-zo.ce = class_type;
-   intern-zo.guards = NULL;
-   intern-ptr = NULL;
-   intern-obj = NULL;
-   intern-free_ptr = 0;
 
zend_object_std_init(intern-zo, class_type TSRMLS_CC);
zend_hash_copy(intern-zo.properties, class_type-default_properties, 
(copy_ctor_func_t) zval_add_ref, (void *) tmp, sizeof(zval *));
-   retval.handle = zend_objects_store_put(intern, NULL, 
reflection_free_objects_storage, reflection_objects_clone TSRMLS_CC);
+   retval.handle = zend_objects_store_put(intern, NULL, 
reflection_free_objects_storage, NULL TSRMLS_CC);
retval.handlers = 

[PHP-CVS] cvs: php-src(PHP_5_3) /ext/reflection php_reflection.c

2008-08-11 Thread Felipe Pena
felipe  Mon Aug 11 12:48:23 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/reflection php_reflection.c 
  Log:
  - Fix build (ZTS)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.164.2.33.2.45.2.29r2=1.164.2.33.2.45.2.30diff_format=u
Index: php-src/ext/reflection/php_reflection.c
diff -u php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.29 
php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.30
--- php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.29Mon Aug 
11 12:43:21 2008
+++ php-src/ext/reflection/php_reflection.c Mon Aug 11 12:48:22 2008
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.29 2008/08/11 12:43:21 helly Exp 
$ */
+/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.30 2008/08/11 12:48:22 felipe Exp 
$ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -3274,7 +3274,7 @@
 
array_init(return_value);
zend_hash_apply_with_arguments(ce-function_table TSRMLS_CC, 
(apply_func_args_t) _addmethod_va, 4, ce, return_value, filter, intern-obj);
-   if (intern-obj  instanceof_function(ce, zend_ce_closure)) {
+   if (intern-obj  instanceof_function(ce, zend_ce_closure TSRMLS_CC)) {
zend_function *closure = 
zend_get_closure_invoke_method(intern-obj TSRMLS_CC);
if (closure) {
_addmethod(closure, ce, return_value, filter, 
intern-obj TSRMLS_CC);
@@ -5207,7 +5207,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.45.2.29 2008/08/11 12:43:21 helly Exp $);
+   php_info_print_table_row(2, Version, $Id: php_reflection.c,v 
1.164.2.33.2.45.2.30 2008/08/11 12:48:22 felipe Exp $);
 
php_info_print_table_end();
 } /* }}} */



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



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/reflection php_reflection.c

2008-08-11 Thread Marcus Boerger
helly   Mon Aug 11 19:35:01 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/reflection php_reflection.c 
  Log:
  - Cleanup
  http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.164.2.33.2.45.2.31r2=1.164.2.33.2.45.2.32diff_format=u
Index: php-src/ext/reflection/php_reflection.c
diff -u php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.31 
php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.32
--- php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.31Mon Aug 
11 13:56:24 2008
+++ php-src/ext/reflection/php_reflection.c Mon Aug 11 19:35:00 2008
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.31 2008/08/11 13:56:24 felipe Exp 
$ */
+/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.32 2008/08/11 19:35:00 helly Exp 
$ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -235,8 +235,8 @@
 {
if (fptr
 fptr-type == ZEND_INTERNAL_FUNCTION
-(fptr-internal_function.fn_flags  
ZEND_ACC_CALL_VIA_HANDLER) != 0
-   ) {
+(fptr-internal_function.fn_flags  
ZEND_ACC_CALL_VIA_HANDLER) != 0)
+   {
efree(fptr-internal_function.function_name);
efree(fptr);
}
@@ -363,7 +363,7 @@
/* The information where a class is declared is only available for user 
classes */
if (ce-type == ZEND_USER_CLASS) {
string_printf(str, %s  @@ %s %d-%d\n, indent, ce-filename,
- ce-line_start, ce-line_end);
+   ce-line_start, ce-line_end);
}
 
/* Constants */
@@ -442,7 +442,8 @@
 
while 
(zend_hash_get_current_data_ex(ce-function_table, (void **) mptr, pos) == 
SUCCESS) {
if (mptr-common.fn_flags  ZEND_ACC_STATIC
-((mptr-common.fn_flags  
ZEND_ACC_PRIVATE) == 0 || mptr-common.scope == ce)) {
+((mptr-common.fn_flags  
ZEND_ACC_PRIVATE) == 0 || mptr-common.scope == ce))
+   {
count_static_funcs++;
}
zend_hash_move_forward_ex(ce-function_table, 
pos);
@@ -459,7 +460,8 @@
 
while 
(zend_hash_get_current_data_ex(ce-function_table, (void **) mptr, pos) == 
SUCCESS) {
if (mptr-common.fn_flags  ZEND_ACC_STATIC
-((mptr-common.fn_flags  
ZEND_ACC_PRIVATE) == 0 || mptr-common.scope == ce)) {
+((mptr-common.fn_flags  
ZEND_ACC_PRIVATE) == 0 || mptr-common.scope == ce))
+   {
string_printf(str, \n);
_function_string(str, mptr, ce, 
sub_indent.string TSRMLS_CC);
}
@@ -538,25 +540,26 @@

zend_hash_internal_pointer_reset_ex(ce-function_table, pos);
 
while 
(zend_hash_get_current_data_ex(ce-function_table, (void **) mptr, pos) == 
SUCCESS) {
-   if ((mptr-common.fn_flags  ZEND_ACC_STATIC) 
== 0 
-   ((mptr-common.fn_flags  
ZEND_ACC_PRIVATE) == 0 || mptr-common.scope == ce)) {
+   if ((mptr-common.fn_flags  ZEND_ACC_STATIC) 
== 0
+((mptr-common.fn_flags  
ZEND_ACC_PRIVATE) == 0 || mptr-common.scope == ce))
+   {
char *key;
uint key_len;
ulong num_index;
uint len = 
strlen(mptr-common.function_name);
 
/* Do not display old-style inherited 
constructors */
-   if ((mptr-common.fn_flags  
ZEND_ACC_CTOR) == 0 ||
-   mptr-common.scope == ce ||
-   
zend_hash_get_current_key_ex(ce-function_table, key, key_len, num_index, 
0, pos) != HASH_KEY_IS_STRING ||
-   zend_binary_strcasecmp(key, 
key_len-1, mptr-common.function_name, len) == 0) {
-
+   if ((mptr-common.fn_flags  
ZEND_ACC_CTOR) == 0
+   || mptr-common.scope == ce
+   || 
zend_hash_get_current_key_ex(ce-function_table, key, key_len, num_index, 
0, pos) != HASH_KEY_IS_STRING
+   || zend_binary_strcasecmp(key, 
key_len-1, mptr-common.function_name, len) 

[PHP-CVS] cvs: php-src(PHP_5_3) /ext/reflection php_reflection.c /ext/reflection/tests closures_003.phpt closures_004.phpt reflectionParameter_invalidMethodInConstructor.phpt

2008-08-11 Thread Christian Seiler
cseiler Mon Aug 11 22:31:23 2008 UTC

  Added files: (Branch: PHP_5_3)
/php-src/ext/reflection/tests   closures_003.phpt closures_004.phpt 

reflectionParameter_invalidMethodInConstructor.phpt 

  Modified files:  
/php-src/ext/reflection php_reflection.c 
  Log:
  MFH: Fixed segfaults (tests added)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.164.2.33.2.45.2.32r2=1.164.2.33.2.45.2.33diff_format=u
Index: php-src/ext/reflection/php_reflection.c
diff -u php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.32 
php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.33
--- php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.32Mon Aug 
11 19:35:00 2008
+++ php-src/ext/reflection/php_reflection.c Mon Aug 11 22:31:21 2008
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.32 2008/08/11 19:35:00 helly Exp 
$ */
+/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.33 2008/08/11 22:31:21 cseiler 
Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -231,6 +231,24 @@
class_entry-interfaces[num_interfaces - 1] = interface_entry;
 }
 
+static zend_function *_copy_function(zend_function *fptr TSRMLS_DC) /* {{{ */
+{
+   if (fptr
+fptr-type == ZEND_INTERNAL_FUNCTION
+(fptr-internal_function.fn_flags  
ZEND_ACC_CALL_VIA_HANDLER) != 0)
+   {
+   zend_function *copy_fptr;
+   copy_fptr = emalloc(sizeof(zend_function));
+   memcpy(copy_fptr, fptr, sizeof(zend_function));
+   copy_fptr-internal_function.function_name = 
estrdup(fptr-internal_function.function_name);
+   return copy_fptr;
+   } else {
+   /* no copy needed */
+   return fptr;
+   }
+}
+/* }}} */
+
 static void _free_function(zend_function *fptr TSRMLS_DC) /* {{{ */
 {
if (fptr
@@ -1782,7 +1800,7 @@
zval *parameter;   
 
ALLOC_ZVAL(parameter);
-   reflection_parameter_factory(fptr, arg_info, i, 
fptr-common.required_num_args, parameter TSRMLS_CC);
+   reflection_parameter_factory(_copy_function(fptr TSRMLS_CC), 
arg_info, i, fptr-common.required_num_args, parameter TSRMLS_CC);
add_next_index_zval(return_value, parameter);
 
arg_info++;
@@ -2033,9 +2051,9 @@
GET_REFLECTION_OBJECT_PTR(param);
 
if (!param-fptr-common.scope) {
-   reflection_function_factory(param-fptr, return_value 
TSRMLS_CC);
+   reflection_function_factory(_copy_function(param-fptr 
TSRMLS_CC), return_value TSRMLS_CC);
} else {
-   reflection_method_factory(param-fptr-common.scope, 
param-fptr, return_value TSRMLS_CC);
+   reflection_method_factory(param-fptr-common.scope, 
_copy_function(param-fptr TSRMLS_CC), return_value TSRMLS_CC);
}
 }
 /* }}} */
@@ -2393,7 +2411,14 @@
/* Returns from this function */
}
 
-   zend_create_closure(return_value, mptr, mptr-common.scope, obj 
TSRMLS_CC);
+   /* This is an original closure object and __invoke is to be 
called. */
+   if (Z_OBJCE_P(obj) == zend_ce_closure  mptr-type == 
ZEND_INTERNAL_FUNCTION 
+   (mptr-internal_function.fn_flags  
ZEND_ACC_CALL_VIA_HANDLER) != 0)
+   {
+   RETURN_ZVAL(obj, 1, 0);
+   } else {
+   zend_create_closure(return_value, mptr, 
mptr-common.scope, obj TSRMLS_CC);
+   }
}
 }
 /* }}} */
@@ -5217,7 +5242,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.45.2.32 2008/08/11 19:35:00 helly Exp $);
+   php_info_print_table_row(2, Version, $Id: php_reflection.c,v 
1.164.2.33.2.45.2.33 2008/08/11 22:31:21 cseiler Exp $);
 
php_info_print_table_end();
 } /* }}} */

http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/closures_003.phpt?view=markuprev=1.1
Index: php-src/ext/reflection/tests/closures_003.phpt
+++ php-src/ext/reflection/tests/closures_003.phpt
--TEST--
Reflection on closures: Segfaults with getParameters() and 
getDeclaringFunction()
--FILE-- 
?php

$closure = function($a, $b = 0) { };

$method = new ReflectionMethod ($closure);
$params = $method-getParameters ();
unset ($method);
$method = $params[0]-getDeclaringFunction ();
unset ($params);
echo $method-getName ().\n;

$parameter = new ReflectionParameter ($closure, 'b');
$method = $parameter-getDeclaringFunction ();
unset ($parameter);
echo $method-getName ().\n;

?
===DONE===
--EXPECTF--
__invoke
__invoke
===DONE===


[PHP-CVS] cvs: php-src(PHP_5_3) /ext/reflection php_reflection.c /ext/reflection/tests bug45765.phpt

2008-08-10 Thread Felipe Pena
felipe  Mon Aug 11 00:47:45 2008 UTC

  Added files: (Branch: PHP_5_3)
/php-src/ext/reflection/tests   bug45765.phpt 

  Modified files:  
/php-src/ext/reflection php_reflection.c 
  Log:
  - MFH: Fixed bug #45765 (ReflectionObject with default parameters of 
self::xxx cause an error)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.164.2.33.2.45.2.27r2=1.164.2.33.2.45.2.28diff_format=u
Index: php-src/ext/reflection/php_reflection.c
diff -u php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.27 
php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.28
--- php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.27Fri Aug 
 8 10:52:48 2008
+++ php-src/ext/reflection/php_reflection.c Mon Aug 11 00:47:45 2008
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.27 2008/08/08 10:52:48 felixdv 
Exp $ */
+/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.28 2008/08/11 00:47:45 felipe Exp 
$ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -642,7 +642,7 @@
*zv = precv-op2.u.constant;
zval_copy_ctor(zv);
INIT_PZVAL(zv);
-   zval_update_constant(zv, (void*)1 TSRMLS_CC);
+   zval_update_constant_ex(zv, (void*)1, 
fptr-common.scope TSRMLS_CC);
if (Z_TYPE_P(zv) == IS_BOOL) {
if (Z_LVAL_P(zv)) {
string_write(str, true, 
sizeof(true)-1);
@@ -5117,7 +5117,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.45.2.27 2008/08/08 10:52:48 felixdv Exp $);
+   php_info_print_table_row(2, Version, $Id: php_reflection.c,v 
1.164.2.33.2.45.2.28 2008/08/11 00:47:45 felipe Exp $);
 
php_info_print_table_end();
 } /* }}} */

http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug45765.phpt?view=markuprev=1.1
Index: php-src/ext/reflection/tests/bug45765.phpt
+++ php-src/ext/reflection/tests/bug45765.phpt
--TEST--
Fixed bug #45765 (ReflectionObject with default parameters of self::xxx cause 
an error)
--FILE--
?php

class foo2 {
const BAR = 'foobar';
}

class foo extends foo2 {
const BAR = foo's bar;

function test($a = self::BAR) {
}

function test2($a = parent::BAR) {
}

function test3($a = foo::BAR) {
}

function test4($a = foo2::BAR) {
}
}

ReflectionObject::export(new foo);

?
--EXPECTF--
Object of class [ user class foo extends foo2 ] {
  @@ %s 7-21

  - Constants [1] {
Constant [ Unicode string BAR ] { foo's bar }
  }

  - Static properties [0] {
  }

  - Static methods [0] {
  }

  - Properties [0] {
  }

  - Dynamic properties [0] {
  }

  - Methods [4] {
Method [ user public method test ] {
  @@ %s 10 - 11

  - Parameters [1] {
Parameter #0 [ optional $a = 'foo's bar' ]
  }
}

Method [ user public method test2 ] {
  @@ %s 13 - 14

  - Parameters [1] {
Parameter #0 [ optional $a = 'foobar' ]
  }
}

Method [ user public method test3 ] {
  @@ %s 16 - 17

  - Parameters [1] {
Parameter #0 [ optional $a = 'foo's bar' ]
  }
}

Method [ user public method test4 ] {
  @@ %s 19 - 20

  - Parameters [1] {
Parameter #0 [ optional $a = 'foobar' ]
  }
}
  }
}



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



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/reflection php_reflection.c

2008-08-08 Thread Felix De Vliegher
felixdv Fri Aug  8 10:52:49 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/reflection php_reflection.c 
  Log:
  Documentation fix for getClosure()
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.164.2.33.2.45.2.26r2=1.164.2.33.2.45.2.27diff_format=u
Index: php-src/ext/reflection/php_reflection.c
diff -u php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.26 
php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.27
--- php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.26Sat Jul 
26 13:14:03 2008
+++ php-src/ext/reflection/php_reflection.c Fri Aug  8 10:52:48 2008
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.26 2008/07/26 13:14:03 dmitry Exp 
$ */
+/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.27 2008/08/08 10:52:48 felixdv 
Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -1565,7 +1565,7 @@
 /* }}} */
 
 /* {{{ proto public mixed ReflectionFunction::getClosure()
-   Invokes the function */
+   Returns a dynamically created closure for the function */
 ZEND_METHOD(reflection_function, getClosure)
 {
reflection_object *intern;
@@ -5117,7 +5117,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.45.2.26 2008/07/26 13:14:03 dmitry Exp $);
+   php_info_print_table_row(2, Version, $Id: php_reflection.c,v 
1.164.2.33.2.45.2.27 2008/08/08 10:52:48 felixdv Exp $);
 
php_info_print_table_end();
 } /* }}} */



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



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/reflection php_reflection.c /ext/spl php_spl.c /ext/spl/tests spl_autoload_007.phpt /ext/standard/tests/array array_map_object1.phpt array_map_object3.phpt /ex

2008-07-26 Thread Dmitry Stogov
dmitry  Sat Jul 26 13:14:07 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/ZendEngine2zend_API.c zend_API.h zend_closures.c zend_compile.h 
zend_execute_API.c zend_object_handlers.c 
zend_vm_def.h zend_vm_execute.h 
/ZendEngine2/tests  bug32290.phpt objects_027.phpt 
/php-src/ext/reflection php_reflection.c 
/php-src/ext/splphp_spl.c 
/php-src/ext/spl/tests  spl_autoload_007.phpt 
/php-src/ext/standard/tests/array   array_map_object1.phpt 
array_map_object3.phpt 
/php-src/ext/standard/tests/general_functions   bug40398.phpt 
callbacks_001.phpt 
  Log:
  Fixed is_callable/call_user_func mess that had done different things for very 
similar arguments e.g. array(A,B) and A::B
  
  http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_API.c?r1=1.296.2.27.2.34.2.42r2=1.296.2.27.2.34.2.43diff_format=u
Index: ZendEngine2/zend_API.c
diff -u ZendEngine2/zend_API.c:1.296.2.27.2.34.2.42 
ZendEngine2/zend_API.c:1.296.2.27.2.34.2.43
--- ZendEngine2/zend_API.c:1.296.2.27.2.34.2.42 Thu Jul 24 19:52:23 2008
+++ ZendEngine2/zend_API.c  Sat Jul 26 13:14:00 2008
@@ -18,7 +18,7 @@
+--+
 */
 
-/* $Id: zend_API.c,v 1.296.2.27.2.34.2.42 2008/07/24 19:52:23 felipe Exp $ */
+/* $Id: zend_API.c,v 1.296.2.27.2.34.2.43 2008/07/26 13:14:00 dmitry Exp $ */
 
 #include zend.h
 #include zend_execute.h
@@ -2318,6 +2318,9 @@
} else {
fcc-called_scope = EG(called_scope);
fcc-calling_scope = EG(scope);
+   if (!fcc-object_pp) {
+   fcc-object_pp = EG(This) ? EG(This) : NULL;
+   }
ret = 1;
}
} else if (name_len == sizeof(parent) - 1  
@@ -2329,6 +2332,9 @@
} else {
fcc-called_scope = EG(called_scope);
fcc-calling_scope = EG(scope)-parent;
+   if (!fcc-object_pp) {
+   fcc-object_pp = EG(This) ? EG(This) : NULL;
+   }
ret = 1;
}
} else if (name_len == sizeof(static) - 1 
@@ -2338,10 +2344,23 @@
} else {
fcc-called_scope = EG(called_scope);
fcc-calling_scope = EG(called_scope);
+   if (!fcc-object_pp) {
+   fcc-object_pp = EG(This) ? EG(This) : NULL;
+   }
ret = 1;
}
} else if (zend_lookup_class_ex(name, name_len, 1, pce TSRMLS_CC) == 
SUCCESS) {
-   fcc-called_scope = fcc-calling_scope = *pce;
+   zend_class_entry *scope = EG(active_op_array) ? 
EG(active_op_array)-scope : NULL;
+
+   fcc-calling_scope = *pce;
+   if (scope  !fcc-object_pp  EG(This) 
+   instanceof_function(Z_OBJCE_P(EG(This)), scope TSRMLS_CC) 
+   instanceof_function(scope, fcc-calling_scope TSRMLS_CC)) {
+   fcc-object_pp = EG(This);
+   fcc-called_scope = Z_OBJCE_PP(fcc-object_pp);
+   } else {
+   fcc-called_scope = fcc-object_pp ? 
Z_OBJCE_PP(fcc-object_pp) : fcc-calling_scope;
+   }
ret = 1;
} else {
if (error) zend_spprintf(error, 0, class '%.*s' not found, 
name_len, name);
@@ -2355,8 +2374,8 @@
 static int zend_is_callable_check_func(int check_flags, zval *callable, 
zend_fcall_info_cache *fcc, char **error TSRMLS_DC) /* {{{ */
 {
zend_class_entry *ce_org = fcc-calling_scope;
-   int retval;
-   char *lmname, *colon;
+   int retval = 0;
+   char *mname, *lmname, *colon;
int clen, mlen;
zend_class_entry *last_scope;
HashTable *ftable;
@@ -2375,9 +2394,11 @@
Z_STRVAL_P(callable)[1] == ':'
) {
mlen = Z_STRLEN_P(callable) - 2;
+   mname = Z_STRVAL_P(callable) + 2;
lmname = zend_str_tolower_dup(Z_STRVAL_P(callable) + 2, 
mlen);
} else {
mlen = Z_STRLEN_P(callable);
+   mname = Z_STRVAL_P(callable);
lmname = zend_str_tolower_dup(Z_STRVAL_P(callable), 
mlen);
}
/* Check if function with given name exists.
@@ -2397,7 +2418,6 @@
colon--;
clen = colon - Z_STRVAL_P(callable);
mlen = Z_STRLEN_P(callable) - clen - 2;
-   lmname = colon + 2;
 
if (colon == Z_STRVAL_P(callable)) {
if (error) 

Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/reflection php_reflection.c /ext/spl php_spl.c /ext/spl/tests spl_autoload_007.phpt /ext/standard/tests/array array_map_object1.phpt array_map_object3.phpt

2008-07-26 Thread Marcus Boerger
Hello Dmitry,

Saturday, July 26, 2008, 3:14:07 PM, you wrote:

 dmitry  Sat Jul 26 13:14:07 2008 UTC

   Modified files:  (Branch: PHP_5_3)
 /ZendEngine2zend_API.c zend_API.h zend_closures.c zend_compile.h
 zend_execute_API.c zend_object_handlers.c 
 zend_vm_def.h zend_vm_execute.h 
 /ZendEngine2/tests  bug32290.phpt objects_027.phpt 
 /php-src/ext/reflection php_reflection.c 
 /php-src/ext/splphp_spl.c 
 /php-src/ext/spl/tests  spl_autoload_007.phpt 
 /php-src/ext/standard/tests/array   array_map_object1.phpt 
 array_map_object3.phpt 
 /php-src/ext/standard/tests/general_functions   bug40398.phpt 
 callbacks_001.phpt 
   Log:
   Fixed is_callable/call_user_func mess that had done different things
 for very similar arguments e.g. array(A,B) and A::B
   
   

As far as I understand it zou did a nice unification of all that argument
handling, just as mentioned in the submit message. However I saw that zou
dropped the zend_function* invoke from struct zend_closure. This was an
optimization as repeated calls no longer needed to recreate the function.
Why was this dropped? Is it because something might change before the
closure gets called a second time? If so how is it a closure then?

Best regards,
 Marcus



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



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/reflection php_reflection.c

2008-07-25 Thread Dmitry Stogov
dmitry  Fri Jul 25 08:50:55 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/reflection php_reflection.c 
  Log:
  Fixed uninitialized data
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.164.2.33.2.45.2.23r2=1.164.2.33.2.45.2.24diff_format=u
Index: php-src/ext/reflection/php_reflection.c
diff -u php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.23 
php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.24
--- php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.23Fri Jul 
25 08:45:09 2008
+++ php-src/ext/reflection/php_reflection.c Fri Jul 25 08:50:55 2008
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.23 2008/07/25 08:45:09 tony2001 
Exp $ */
+/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.24 2008/07/25 08:50:55 dmitry Exp 
$ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -1235,7 +1235,7 @@
fcc.initialized = 1;
fcc.function_handler = ce_ptr-constructor;
fcc.calling_scope = ce_ptr;
-   fcc.called_scope = reflection_ptr;
+   fcc.called_scope = Z_OBJCE_P(reflector_ptr);
fcc.object_pp = reflector_ptr;
 
result = zend_call_function(fci, fcc TSRMLS_CC);
@@ -5117,7 +5117,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.45.2.23 2008/07/25 08:45:09 tony2001 Exp $);
+   php_info_print_table_row(2, Version, $Id: php_reflection.c,v 
1.164.2.33.2.45.2.24 2008/07/25 08:50:55 dmitry Exp $);
 
php_info_print_table_end();
 } /* }}} */



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



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/reflection php_reflection.c /ext/reflection/tests bug45571.phpt

2008-07-20 Thread Felipe Pena
felipe  Sun Jul 20 16:51:28 2008 UTC

  Added files: (Branch: PHP_5_3)
/php-src/ext/reflection/tests   bug45571.phpt 

  Modified files:  
/php-src/ext/reflection php_reflection.c 
  Log:
  - Fixed bug #45571 (ReflectionClass::export() shows superclasses' private 
static methods.)
patch by Robin Fernandes
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.164.2.33.2.45.2.19r2=1.164.2.33.2.45.2.20diff_format=u
Index: php-src/ext/reflection/php_reflection.c
diff -u php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.19 
php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.20
--- php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.19Mon Jul 
14 09:49:03 2008
+++ php-src/ext/reflection/php_reflection.c Sun Jul 20 16:51:28 2008
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.19 2008/07/14 09:49:03 dmitry Exp 
$ */
+/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.20 2008/07/20 16:51:28 felipe Exp 
$ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -417,7 +417,7 @@

/* Static methods */
if (ce-function_table) {
-   /* counting static properties */
+   /* counting static methods */   
count = zend_hash_num_elements(ce-function_table);
if (count  0) {
HashPosition pos;
@@ -426,14 +426,15 @@

zend_hash_internal_pointer_reset_ex(ce-function_table, pos);
 
while 
(zend_hash_get_current_data_ex(ce-function_table, (void **) mptr, pos) == 
SUCCESS) {
-   if (mptr-common.fn_flags  ZEND_ACC_STATIC) {
+   if (mptr-common.fn_flags  ZEND_ACC_STATIC
+((mptr-common.fn_flags  
ZEND_ACC_PRIVATE) == 0 || mptr-common.scope == ce)) {
count_static_funcs++;
}
zend_hash_move_forward_ex(ce-function_table, 
pos);
}
}
 
-   /* static properties */ 
+   /* static methods */
string_printf(str, \n%s  - Static methods [%d] {, indent, 
count_static_funcs);
if (count_static_funcs  0) {
HashPosition pos;
@@ -442,7 +443,8 @@

zend_hash_internal_pointer_reset_ex(ce-function_table, pos);
 
while 
(zend_hash_get_current_data_ex(ce-function_table, (void **) mptr, pos) == 
SUCCESS) {
-   if (mptr-common.fn_flags  ZEND_ACC_STATIC) {
+   if (mptr-common.fn_flags  ZEND_ACC_STATIC
+((mptr-common.fn_flags  
ZEND_ACC_PRIVATE) == 0 || mptr-common.scope == ce)) {
string_printf(str, \n);
_function_string(str, mptr, ce, 
sub_indent.string TSRMLS_CC);
}
@@ -5114,7 +5116,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.45.2.19 2008/07/14 09:49:03 dmitry Exp $);
+   php_info_print_table_row(2, Version, $Id: php_reflection.c,v 
1.164.2.33.2.45.2.20 2008/07/20 16:51:28 felipe Exp $);
 
php_info_print_table_end();
 } /* }}} */

http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug45571.phpt?view=markuprev=1.1
Index: php-src/ext/reflection/tests/bug45571.phpt
+++ php-src/ext/reflection/tests/bug45571.phpt



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



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/reflection php_reflection.c

2008-06-27 Thread Dmitry Stogov
dmitry  Fri Jun 27 06:43:21 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/reflection php_reflection.c 
  Log:
  ws
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.164.2.33.2.45.2.17r2=1.164.2.33.2.45.2.18diff_format=u
Index: php-src/ext/reflection/php_reflection.c
diff -u php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.17 
php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.18
--- php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.17Wed Jun 
25 12:33:46 2008
+++ php-src/ext/reflection/php_reflection.c Fri Jun 27 06:43:21 2008
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.17 2008/06/25 12:33:46 dmitry Exp 
$ */
+/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.18 2008/06/27 06:43:21 dmitry Exp 
$ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -2565,7 +2565,7 @@
(colon = zend_memrchr(Z_STRVAL_PP(name), ':', Z_STRLEN_PP(name))) 
colon  Z_STRVAL_PP(name)  *(colon-1) == ':') {
RETURN_TRUE;
-}
+   }
RETURN_FALSE;
 }
 /* }}} */
@@ -2585,7 +2585,7 @@
(colon = zend_memrchr(Z_STRVAL_PP(name), ':', Z_STRLEN_PP(name))) 
colon  Z_STRVAL_PP(name)  *(colon-1) == ':') {
RETURN_STRINGL(Z_STRVAL_PP(name), colon - Z_STRVAL_PP(name) - 
1, 1);
-}
+   }
RETURN_EMPTY_STRING();
 }
 /* }}} */
@@ -2605,8 +2605,8 @@
(colon = zend_memrchr(Z_STRVAL_PP(name), ':', Z_STRLEN_PP(name))) 
colon  Z_STRVAL_PP(name)  *(colon-1) == ':') {
RETURN_STRINGL(colon + 1, Z_STRLEN_PP(name) - (colon - 
Z_STRVAL_PP(name) + 1), 1);
-}
-RETURN_ZVAL(*name, 1, 0);
+   }
+   RETURN_ZVAL(*name, 1, 0);
 }
 /* }}} */
 
@@ -5069,7 +5069,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.45.2.17 2008/06/25 12:33:46 dmitry Exp $);
+   php_info_print_table_row(2, Version, $Id: php_reflection.c,v 
1.164.2.33.2.45.2.18 2008/06/27 06:43:21 dmitry Exp $);
 
php_info_print_table_end();
 } /* }}} */



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



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/reflection php_reflection.c /ext/reflection/tests ReflectionFunction_getNamespaceName.phpt reflectionClass_getNamespaceName.phpt

2008-06-25 Thread Dmitry Stogov
dmitry  Wed Jun 25 12:33:46 2008 UTC

  Added files: (Branch: PHP_5_3)
/php-src/ext/reflection/tests   

ReflectionFunction_getNamespaceName.phpt 
reflectionClass_getNamespaceName.phpt 

  Modified files:  
/php-src/ext/reflection php_reflection.c 
  Log:
  Added support for namespaces
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.164.2.33.2.45.2.16r2=1.164.2.33.2.45.2.17diff_format=u
Index: php-src/ext/reflection/php_reflection.c
diff -u php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.16 
php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.17
--- php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.16Sat Jun 
21 02:41:27 2008
+++ php-src/ext/reflection/php_reflection.c Wed Jun 25 12:33:46 2008
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.16 2008/06/21 02:41:27 felipe Exp 
$ */
+/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.17 2008/06/25 12:33:46 dmitry Exp 
$ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -2550,6 +2550,66 @@
 }
 /* }}} */
 
+/* {{{ proto public bool ReflectionFunction::inNamespace()
+   Returns whether this function is defined in namespace */
+ZEND_METHOD(reflection_function, inNamespace)
+{
+   zval **name;
+   char *colon;
+
+   METHOD_NOTSTATIC_NUMPARAMS(reflection_function_abstract_ptr, 0);
+   if (zend_hash_find(Z_OBJPROP_P(getThis()), name, sizeof(name), 
(void **) name) == FAILURE) {
+   RETURN_FALSE;
+   }
+   if (Z_TYPE_PP(name) == IS_STRING 
+   (colon = zend_memrchr(Z_STRVAL_PP(name), ':', Z_STRLEN_PP(name))) 
+   colon  Z_STRVAL_PP(name)  *(colon-1) == ':') {
+   RETURN_TRUE;
+}
+   RETURN_FALSE;
+}
+/* }}} */
+
+/* {{{ proto public string ReflectionFunction::getNamespaceName()
+   Returns the name of namespace where this function is defined */
+ZEND_METHOD(reflection_function, getNamespaceName)
+{
+   zval **name;
+   char *colon;
+
+   METHOD_NOTSTATIC_NUMPARAMS(reflection_function_abstract_ptr, 0);
+   if (zend_hash_find(Z_OBJPROP_P(getThis()), name, sizeof(name), 
(void **) name) == FAILURE) {
+   RETURN_FALSE;
+   }
+   if (Z_TYPE_PP(name) == IS_STRING 
+   (colon = zend_memrchr(Z_STRVAL_PP(name), ':', Z_STRLEN_PP(name))) 
+   colon  Z_STRVAL_PP(name)  *(colon-1) == ':') {
+   RETURN_STRINGL(Z_STRVAL_PP(name), colon - Z_STRVAL_PP(name) - 
1, 1);
+}
+   RETURN_EMPTY_STRING();
+}
+/* }}} */
+
+/* {{{ proto public string ReflectionFunction::getShortName()
+   Returns the short name of the function (without namespace part) */
+ZEND_METHOD(reflection_function, getShortName)
+{
+   zval **name;
+   char *colon;
+
+   METHOD_NOTSTATIC_NUMPARAMS(reflection_function_abstract_ptr, 0);
+   if (zend_hash_find(Z_OBJPROP_P(getThis()), name, sizeof(name), 
(void **) name) == FAILURE) {
+   RETURN_FALSE;
+   }
+   if (Z_TYPE_PP(name) == IS_STRING 
+   (colon = zend_memrchr(Z_STRVAL_PP(name), ':', Z_STRLEN_PP(name))) 
+   colon  Z_STRVAL_PP(name)  *(colon-1) == ':') {
+   RETURN_STRINGL(colon + 1, Z_STRLEN_PP(name) - (colon - 
Z_STRVAL_PP(name) + 1), 1);
+}
+RETURN_ZVAL(*name, 1, 0);
+}
+/* }}} */
+
 /* {{{ proto public bool ReflectionMethod::isConstructor()
Returns whether this method is the constructor */
 ZEND_METHOD(reflection_method, isConstructor)
@@ -3760,6 +3820,66 @@
 }
 /* }}} */
 
+/* {{{ proto public bool ReflectionClass::inNamespace()
+   Returns whether this class is defined in namespace */
+ZEND_METHOD(reflection_class, inNamespace)
+{
+   zval **name;
+   char *colon;
+
+   METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
+   if (zend_hash_find(Z_OBJPROP_P(getThis()), name, sizeof(name), 
(void **) name) == FAILURE) {
+   RETURN_FALSE;
+   }
+   if (Z_TYPE_PP(name) == IS_STRING 
+   (colon = zend_memrchr(Z_STRVAL_PP(name), ':', Z_STRLEN_PP(name))) 
+   colon  Z_STRVAL_PP(name)  *(colon-1) == ':') {
+   RETURN_TRUE;
+}
+   RETURN_FALSE;
+}
+/* }}} */
+
+/* {{{ proto public string ReflectionClass::getNamespaceName()
+   Returns the name of namespace where this class is defined */
+ZEND_METHOD(reflection_class, getNamespaceName)
+{
+   zval **name;
+   char *colon;
+
+   METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
+   if (zend_hash_find(Z_OBJPROP_P(getThis()), name, sizeof(name), 
(void **) name) == FAILURE) {
+   RETURN_FALSE;
+   }
+   if (Z_TYPE_PP(name) == IS_STRING 
+   (colon = zend_memrchr(Z_STRVAL_PP(name), ':', Z_STRLEN_PP(name))) 
+   colon  Z_STRVAL_PP(name)  *(colon-1) == ':') {
+   

Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/reflection php_reflection.c /ext/reflection/tests ReflectionFunction_getNamespaceName.phpt reflectionClass_getNamespaceName.phpt

2008-06-25 Thread Lars Strojny
Thank you very much!

Am Mittwoch, den 25.06.2008, 12:33 + schrieb Dmitry Stogov:
 dmitryWed Jun 25 12:33:46 2008 UTC
 
   Added files: (Branch: PHP_5_3)
 /php-src/ext/reflection/tests 
   
 ReflectionFunction_getNamespaceName.phpt 
   reflectionClass_getNamespaceName.phpt 
 
   Modified files:  
 /php-src/ext/reflection   php_reflection.c 
   Log:
   Added support for namespaces
   
   
 http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.164.2.33.2.45.2.16r2=1.164.2.33.2.45.2.17diff_format=u
 Index: php-src/ext/reflection/php_reflection.c
 diff -u php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.16 
 php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.17
 --- php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.16  Sat Jun 
 21 02:41:27 2008
 +++ php-src/ext/reflection/php_reflection.c   Wed Jun 25 12:33:46 2008
 @@ -20,7 +20,7 @@
 +--+
  */
  
 -/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.16 2008/06/21 02:41:27 felipe 
 Exp $ */
 +/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.17 2008/06/25 12:33:46 dmitry 
 Exp $ */
  
  #ifdef HAVE_CONFIG_H
  #include config.h
 @@ -2550,6 +2550,66 @@
  }
  /* }}} */
  
 +/* {{{ proto public bool ReflectionFunction::inNamespace()
 +   Returns whether this function is defined in namespace */
 +ZEND_METHOD(reflection_function, inNamespace)
 +{
 + zval **name;
 + char *colon;
 +
 + METHOD_NOTSTATIC_NUMPARAMS(reflection_function_abstract_ptr, 0);
 + if (zend_hash_find(Z_OBJPROP_P(getThis()), name, sizeof(name), 
 (void **) name) == FAILURE) {
 + RETURN_FALSE;
 + }
 + if (Z_TYPE_PP(name) == IS_STRING 
 + (colon = zend_memrchr(Z_STRVAL_PP(name), ':', Z_STRLEN_PP(name))) 
 + colon  Z_STRVAL_PP(name)  *(colon-1) == ':') {
 + RETURN_TRUE;
 +}
 + RETURN_FALSE;
 +}
 +/* }}} */
 +
 +/* {{{ proto public string ReflectionFunction::getNamespaceName()
 +   Returns the name of namespace where this function is defined */
 +ZEND_METHOD(reflection_function, getNamespaceName)
 +{
 + zval **name;
 + char *colon;
 +
 + METHOD_NOTSTATIC_NUMPARAMS(reflection_function_abstract_ptr, 0);
 + if (zend_hash_find(Z_OBJPROP_P(getThis()), name, sizeof(name), 
 (void **) name) == FAILURE) {
 + RETURN_FALSE;
 + }
 + if (Z_TYPE_PP(name) == IS_STRING 
 + (colon = zend_memrchr(Z_STRVAL_PP(name), ':', Z_STRLEN_PP(name))) 
 + colon  Z_STRVAL_PP(name)  *(colon-1) == ':') {
 + RETURN_STRINGL(Z_STRVAL_PP(name), colon - Z_STRVAL_PP(name) - 
 1, 1);
 +}
 + RETURN_EMPTY_STRING();
 +}
 +/* }}} */
 +
 +/* {{{ proto public string ReflectionFunction::getShortName()
 +   Returns the short name of the function (without namespace part) */
 +ZEND_METHOD(reflection_function, getShortName)
 +{
 + zval **name;
 + char *colon;
 +
 + METHOD_NOTSTATIC_NUMPARAMS(reflection_function_abstract_ptr, 0);
 + if (zend_hash_find(Z_OBJPROP_P(getThis()), name, sizeof(name), 
 (void **) name) == FAILURE) {
 + RETURN_FALSE;
 + }
 + if (Z_TYPE_PP(name) == IS_STRING 
 + (colon = zend_memrchr(Z_STRVAL_PP(name), ':', Z_STRLEN_PP(name))) 
 + colon  Z_STRVAL_PP(name)  *(colon-1) == ':') {
 + RETURN_STRINGL(colon + 1, Z_STRLEN_PP(name) - (colon - 
 Z_STRVAL_PP(name) + 1), 1);
 +}
 +RETURN_ZVAL(*name, 1, 0);
 +}
 +/* }}} */
 +
  /* {{{ proto public bool ReflectionMethod::isConstructor()
 Returns whether this method is the constructor */
  ZEND_METHOD(reflection_method, isConstructor)
 @@ -3760,6 +3820,66 @@
  }
  /* }}} */
  
 +/* {{{ proto public bool ReflectionClass::inNamespace()
 +   Returns whether this class is defined in namespace */
 +ZEND_METHOD(reflection_class, inNamespace)
 +{
 + zval **name;
 + char *colon;
 +
 + METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
 + if (zend_hash_find(Z_OBJPROP_P(getThis()), name, sizeof(name), 
 (void **) name) == FAILURE) {
 + RETURN_FALSE;
 + }
 + if (Z_TYPE_PP(name) == IS_STRING 
 + (colon = zend_memrchr(Z_STRVAL_PP(name), ':', Z_STRLEN_PP(name))) 
 + colon  Z_STRVAL_PP(name)  *(colon-1) == ':') {
 + RETURN_TRUE;
 +}
 + RETURN_FALSE;
 +}
 +/* }}} */
 +
 +/* {{{ proto public string ReflectionClass::getNamespaceName()
 +   Returns the name of namespace where this class is defined */
 +ZEND_METHOD(reflection_class, getNamespaceName)
 +{
 + zval **name;
 + char *colon;
 +
 + METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
 + if (zend_hash_find(Z_OBJPROP_P(getThis()), name, sizeof(name), 
 (void **) name) == FAILURE) {
 + RETURN_FALSE;
 + }
 + if (Z_TYPE_PP(name) == IS_STRING 
 + (colon = zend_memrchr(Z_STRVAL_PP(name), 

[PHP-CVS] cvs: php-src(PHP_5_3) /ext/reflection php_reflection.c /ext/reflection/tests ReflectionMethod_invoke_basic.phpt /main main.c

2008-06-20 Thread Felipe Pena
felipe  Sat Jun 21 02:41:27 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/reflection php_reflection.c 
/php-src/ext/reflection/tests   ReflectionMethod_invoke_basic.phpt 
/php-src/main   main.c 
  Log:
  - New parameter parsing API
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.164.2.33.2.45.2.15r2=1.164.2.33.2.45.2.16diff_format=u
Index: php-src/ext/reflection/php_reflection.c
diff -u php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.15 
php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.16
--- php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.15Sun Jun 
 1 03:11:37 2008
+++ php-src/ext/reflection/php_reflection.c Sat Jun 21 02:41:27 2008
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.15 2008/06/01 03:11:37 felipe Exp 
$ */
+/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.16 2008/06/21 02:41:27 felipe Exp 
$ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -1567,9 +1567,8 @@
 ZEND_METHOD(reflection_function, invoke)
 {
zval *retval_ptr;
-   zval ***params;
-   int result;
-   int argc = ZEND_NUM_ARGS();
+   zval ***params = NULL;
+   int result, num_args = 0;
zend_fcall_info fci;
zend_fcall_info_cache fcc;
reflection_object *intern;
@@ -1578,10 +1577,8 @@
METHOD_NOTSTATIC(reflection_function_ptr);
GET_REFLECTION_OBJECT_PTR(fptr);
 
-   params = safe_emalloc(sizeof(zval **), argc, 0);
-   if (zend_get_parameters_array_ex(argc, params) == FAILURE) {
-   efree(params);
-   RETURN_FALSE;
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, +, params, 
num_args) == FAILURE) {
+   return;
}
 
fci.size = sizeof(fci);
@@ -1590,7 +1587,7 @@
fci.symbol_table = NULL;
fci.object_pp = NULL;
fci.retval_ptr_ptr = retval_ptr;
-   fci.param_count = argc;
+   fci.param_count = num_args;
fci.params = params;
fci.no_separation = 1;
 
@@ -2298,23 +2295,17 @@
 ZEND_METHOD(reflection_method, invoke)
 {
zval *retval_ptr;
-   zval ***params;
+   zval ***params = NULL;
zval **object_pp;
reflection_object *intern;
zend_function *mptr;
-   int argc = ZEND_NUM_ARGS();
-   int result;
+   int result, num_args = 0;
zend_fcall_info fci;
zend_fcall_info_cache fcc;
zend_class_entry *obj_ce;

METHOD_NOTSTATIC(reflection_method_ptr);
 
-   if (argc  1) {
-   zend_error(E_WARNING, Invoke() expects at least one parameter, 
none given);
-   RETURN_FALSE;
-   }
-   
GET_REFLECTION_OBJECT_PTR(mptr);
 
if (!(mptr-common.fn_flags  ZEND_ACC_PUBLIC) ||
@@ -2333,10 +2324,8 @@
return;
}
 
-   params = safe_emalloc(sizeof(zval **), argc, 0);
-   if (zend_get_parameters_array_ex(argc, params) == FAILURE) {
-   efree(params);
-   RETURN_FALSE;
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, +, params, 
num_args) == FAILURE) {
+   return;
}

/* In case this is a static method, we should'nt pass an object_pp
@@ -2349,15 +2338,18 @@
object_pp = NULL;
obj_ce = NULL;
} else {
-   if ((Z_TYPE_PP(params[0]) != IS_OBJECT)) {
+   if (Z_TYPE_PP(params[0]) != IS_OBJECT) {
efree(params);
_DO_THROW(Non-object passed to Invoke());
/* Returns from this function */
}
+
obj_ce = Z_OBJCE_PP(params[0]);
 
if (!instanceof_function(obj_ce, mptr-common.scope TSRMLS_CC)) 
{
-   efree(params);
+   if (params) {
+   efree(params);
+   }
_DO_THROW(Given object is not an instance of the class 
this method was declared in);
/* Returns from this function */
}
@@ -2371,8 +2363,8 @@
fci.symbol_table = NULL;
fci.object_pp = object_pp;
fci.retval_ptr_ptr = retval_ptr;
-   fci.param_count = argc-1;
-   fci.params = params+1;
+   fci.param_count = num_args - 1;
+   fci.params = params + 1;
fci.no_separation = 1;
 
fcc.initialized = 1;
@@ -2382,7 +2374,9 @@
 
result = zend_call_function(fci, fcc TSRMLS_CC);

-   efree(params);
+   if (params) {
+   efree(params);
+   }
 
if (result == FAILURE) {
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, 
@@ -3416,14 +3410,14 @@
zval *retval_ptr = NULL;
reflection_object *intern;
zend_class_entry *ce;
-   int argc = 

[PHP-CVS] cvs: php-src(PHP_5_3) /ext/reflection php_reflection.c /ext/reflection/tests bug45139.phpt

2008-05-31 Thread Felipe Pena
felipe  Sun Jun  1 03:11:38 2008 UTC

  Added files: (Branch: PHP_5_3)
/php-src/ext/reflection/tests   bug45139.phpt 

  Modified files:  
/php-src/ext/reflection php_reflection.c 
  Log:
  - MFB: Fixed bug #45139 (ReflectionProperty returns incorrect declaring class)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.164.2.33.2.45.2.14r2=1.164.2.33.2.45.2.15diff_format=u
Index: php-src/ext/reflection/php_reflection.c
diff -u php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.14 
php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.15
--- php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.14Mon Feb 
18 14:30:44 2008
+++ php-src/ext/reflection/php_reflection.c Sun Jun  1 03:11:37 2008
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.14 2008/02/18 14:30:44 dmitry Exp 
$ */
+/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.15 2008/06/01 03:11:37 felipe Exp 
$ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -4092,7 +4092,7 @@
prop_name_len = strlen(prop_name);
ce = tmp_ce = ref-ce;
while (tmp_ce  zend_hash_find(tmp_ce-properties_info, prop_name, 
prop_name_len + 1, (void **) tmp_info) == SUCCESS) {
-   if (tmp_info-flags  ZEND_ACC_PRIVATE) {
+   if (tmp_info-flags  ZEND_ACC_PRIVATE || tmp_info-flags  
ZEND_ACC_SHADOW) {
/* it's a private property, so it can't be inherited */
break;
}
@@ -4944,7 +4944,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.45.2.14 2008/02/18 14:30:44 dmitry Exp $);
+   php_info_print_table_row(2, Version, $Id: php_reflection.c,v 
1.164.2.33.2.45.2.15 2008/06/01 03:11:37 felipe Exp $);
 
php_info_print_table_end();
 } /* }}} */

http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug45139.phpt?view=markuprev=1.1
Index: php-src/ext/reflection/tests/bug45139.phpt
+++ php-src/ext/reflection/tests/bug45139.phpt



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



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/reflection php_reflection.c

2008-02-18 Thread Dmitry Stogov
dmitry  Mon Feb 18 14:30:44 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/reflection php_reflection.c 
  Log:
  Made code opcode-cache friendly. (It is disallowed to change code during 
execution)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.164.2.33.2.45.2.13r2=1.164.2.33.2.45.2.14diff_format=u
Index: php-src/ext/reflection/php_reflection.c
diff -u php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.13 
php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.14
--- php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.13Fri Feb 
15 12:48:13 2008
+++ php-src/ext/reflection/php_reflection.c Mon Feb 18 14:30:44 2008
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.13 2008/02/15 12:48:13 derick Exp 
$ */
+/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.14 2008/02/18 14:30:44 dmitry Exp 
$ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -2151,7 +2151,6 @@
reflection_object *intern;
parameter_reference *param;
zend_op *precv;
-   zval *zv, zv_copy;
 
METHOD_NOTSTATIC_NUMPARAMS(reflection_parameter_ptr, 0);
GET_REFLECTION_OBJECT_PTR(param);
@@ -2171,10 +2170,12 @@
return;
}
 
-   zv_copy = precv-op2.u.constant;
-   zv = zv_copy;
-   zval_update_constant_ex(zv, (void*)0, param-fptr-common.scope 
TSRMLS_CC);
-   RETURN_ZVAL(zv, 1, 1);
+   *return_value = precv-op2.u.constant;
+   INIT_PZVAL(return_value);
+   if (Z_TYPE_P(return_value) != IS_CONSTANT) {
+   zval_copy_ctor(return_value);
+   }
+   zval_update_constant_ex(return_value, (void*)0, 
param-fptr-common.scope TSRMLS_CC);
 }
 /* }}} */
 
@@ -4943,7 +4944,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.45.2.13 2008/02/15 12:48:13 derick Exp $);
+   php_info_print_table_row(2, Version, $Id: php_reflection.c,v 
1.164.2.33.2.45.2.14 2008/02/18 14:30:44 dmitry Exp $);
 
php_info_print_table_end();
 } /* }}} */

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



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/reflection php_reflection.c

2008-01-30 Thread Felipe Pena
felipe  Wed Jan 30 13:42:01 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/reflection php_reflection.c 
  Log:
  Fix the fix (isInstance - order of parameters)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.164.2.33.2.45.2.9r2=1.164.2.33.2.45.2.10diff_format=u
Index: php-src/ext/reflection/php_reflection.c
diff -u php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.9 
php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.10
--- php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.9 Wed Jan 30 
12:50:59 2008
+++ php-src/ext/reflection/php_reflection.c Wed Jan 30 13:42:01 2008
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.9 2008/01/30 12:50:59 tony2001 
Exp $ */
+/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.10 2008/01/30 13:42:01 felipe Exp 
$ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -3402,7 +3402,7 @@
return;
}
GET_REFLECTION_OBJECT_PTR(ce);  
-   RETURN_BOOL(HAS_CLASS_ENTRY(*object)  
instanceof_function(Z_OBJCE_P(object), ce TSRMLS_CC));
+   RETURN_BOOL(HAS_CLASS_ENTRY(*object)  instanceof_function(ce, 
Z_OBJCE_P(object) TSRMLS_CC));
 }
 /* }}} */
 
@@ -4913,7 +4913,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.45.2.9 2008/01/30 12:50:59 tony2001 Exp $);
+   php_info_print_table_row(2, Version, $Id: php_reflection.c,v 
1.164.2.33.2.45.2.10 2008/01/30 13:42:01 felipe Exp $);
 
php_info_print_table_end();
 } /* }}} */

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



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/reflection php_reflection.c

2008-01-30 Thread Felipe Pena
felipe  Wed Jan 30 14:45:20 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/reflection php_reflection.c 
  Log:
  Revert
  
http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.164.2.33.2.45.2.10r2=1.164.2.33.2.45.2.11diff_format=u
Index: php-src/ext/reflection/php_reflection.c
diff -u php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.10 
php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.11
--- php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.10Wed Jan 
30 13:42:01 2008
+++ php-src/ext/reflection/php_reflection.c Wed Jan 30 14:45:20 2008
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.10 2008/01/30 13:42:01 felipe Exp 
$ */
+/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.11 2008/01/30 14:45:20 felipe Exp 
$ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -3402,7 +3402,7 @@
return;
}
GET_REFLECTION_OBJECT_PTR(ce);  
-   RETURN_BOOL(HAS_CLASS_ENTRY(*object)  instanceof_function(ce, 
Z_OBJCE_P(object) TSRMLS_CC));
+   RETURN_BOOL(HAS_CLASS_ENTRY(*object)  
instanceof_function(Z_OBJCE_P(object), ce TSRMLS_CC));
 }
 /* }}} */
 
@@ -4913,7 +4913,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.45.2.10 2008/01/30 13:42:01 felipe Exp $);
+   php_info_print_table_row(2, Version, $Id: php_reflection.c,v 
1.164.2.33.2.45.2.11 2008/01/30 14:45:20 felipe Exp $);
 
php_info_print_table_end();
 } /* }}} */

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



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/reflection php_reflection.c /ext/reflection/tests bug42976.phpt

2007-10-28 Thread Ilia Alshanetsky
iliaa   Sun Oct 28 13:42:24 2007 UTC

  Added files: (Branch: PHP_5_3)
/php-src/ext/reflection/tests   bug42976.phpt 

  Modified files:  
/php-src/ext/reflection php_reflection.c 
  Log:
  Fixed bug #42976 (Crash when constructor for newInstance() or 
  newInstanceArgs() fails)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.164.2.33.2.45.2.3r2=1.164.2.33.2.45.2.4diff_format=u
Index: php-src/ext/reflection/php_reflection.c
diff -u php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.3 
php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.4
--- php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.3 Sun Oct  7 
05:22:05 2007
+++ php-src/ext/reflection/php_reflection.c Sun Oct 28 13:42:24 2007
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.3 2007/10/07 05:22:05 davidw Exp 
$ */
+/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.4 2007/10/28 13:42:24 iliaa Exp $ 
*/
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -3405,7 +3405,7 @@
Returns an instance of this class */
 ZEND_METHOD(reflection_class, newInstance)
 {
-   zval *retval_ptr;
+   zval *retval_ptr = NULL;
reflection_object *intern;
zend_class_entry *ce;
int argc = ZEND_NUM_ARGS();
@@ -3449,7 +3449,9 @@
 
if (zend_call_function(fci, fcc TSRMLS_CC) == FAILURE) {
efree(params);
-   zval_ptr_dtor(retval_ptr);
+   if (retval_ptr) {
+   zval_ptr_dtor(retval_ptr);
+   }
zend_error(E_WARNING, Invocation of %s's constructor 
failed, ce-name);
RETURN_NULL();
}
@@ -3469,7 +3471,7 @@
Returns an instance of this class */
 ZEND_METHOD(reflection_class, newInstanceArgs)
 {
-   zval *retval_ptr;
+   zval *retval_ptr = NULL;
reflection_object *intern;
zend_class_entry *ce;
int argc = 0;
@@ -3524,7 +3526,9 @@
if (params) {
efree(params);
}
-   zval_ptr_dtor(retval_ptr);
+   if (retval_ptr) {
+   zval_ptr_dtor(retval_ptr);
+   }
zend_error(E_WARNING, Invocation of %s's constructor 
failed, ce-name);
RETURN_NULL();
}
@@ -4903,7 +4907,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.45.2.3 2007/10/07 05:22:05 davidw Exp $);
+   php_info_print_table_row(2, Version, $Id: php_reflection.c,v 
1.164.2.33.2.45.2.4 2007/10/28 13:42:24 iliaa Exp $);
 
php_info_print_table_end();
 } /* }}} */

http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/tests/bug42976.phpt?view=markuprev=1.1
Index: php-src/ext/reflection/tests/bug42976.phpt
+++ php-src/ext/reflection/tests/bug42976.phpt

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



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/reflection php_reflection.c

2007-09-27 Thread Antony Dovgal
tony2001Thu Sep 27 09:15:10 2007 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/reflection php_reflection.c 
  Log:
  MFH: fix coverity issue #411
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.164.2.33.2.45r2=1.164.2.33.2.45.2.1diff_format=u
Index: php-src/ext/reflection/php_reflection.c
diff -u php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45 
php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45.2.1
--- php-src/ext/reflection/php_reflection.c:1.164.2.33.2.45 Mon Aug 20 
17:01:22 2007
+++ php-src/ext/reflection/php_reflection.c Thu Sep 27 09:15:09 2007
@@ -20,7 +20,7 @@
+--+
 */
 
-/* $Id: php_reflection.c,v 1.164.2.33.2.45 2007/08/20 17:01:22 sebastian Exp $ 
*/
+/* $Id: php_reflection.c,v 1.164.2.33.2.45.2.1 2007/09/27 09:15:09 tony2001 
Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -1992,7 +1992,7 @@
 {
reflection_object *intern;
parameter_reference *param;
-   zend_class_entry **pce;
+   zend_class_entry **pce, *ce;
 
METHOD_NOTSTATIC_NUMPARAMS(reflection_parameter_ptr, 0);
GET_REFLECTION_OBJECT_PTR(param);
@@ -2011,7 +2011,7 @@
 * lint-mode.
 */
if (0 == strncmp(param-arg_info-class_name, self, 
sizeof(self)- 1)) {
-   zend_class_entry *ce= param-fptr-common.scope;
+   ce = param-fptr-common.scope;
if (!ce) {
   zend_throw_exception_ex(reflection_exception_ptr, 0 
TSRMLS_CC, 
   Parameter uses 'self' as type hint but 
function is not a class member!);
@@ -2019,7 +2019,7 @@
}
pce= ce;
} else if (0 == strncmp(param-arg_info-class_name, parent, 
sizeof(parent)- 1)) {
-   zend_class_entry *ce= param-fptr-common.scope;
+   ce = param-fptr-common.scope;
if (!ce) {
   zend_throw_exception_ex(reflection_exception_ptr, 0 
TSRMLS_CC, 
   Parameter uses 'parent' as type hint but 
function is not a class member!);
@@ -4903,7 +4903,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.45 2007/08/20 17:01:22 sebastian Exp $);
+   php_info_print_table_row(2, Version, $Id: php_reflection.c,v 
1.164.2.33.2.45.2.1 2007/09/27 09:15:09 tony2001 Exp $);
 
php_info_print_table_end();
 } /* }}} */

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