Advertisement
Guest User

nesting.patch

a guest
Sep 23rd, 2013
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.66 KB | None | 0 0
  1. diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
  2. index 5296128..572a0e9 100644
  3. --- a/Zend/zend_compile.c
  4. +++ b/Zend/zend_compile.c
  5. @@ -4979,18 +4979,44 @@ void zend_do_begin_class_declaration(znode *class_token, znode *class_name, cons
  6. error = 1;
  7. }
  8.  
  9. - if (CG(current_namespace)) {
  10. - /* Prefix class name with name of current namespace */
  11. - znode tmp;
  12. -
  13. - tmp.op_type = IS_CONST;
  14. - tmp.u.constant = *CG(current_namespace);
  15. - zval_copy_ctor(&tmp.u.constant);
  16. - zend_do_build_namespace_name(&tmp, &tmp, class_name TSRMLS_CC);
  17. - *class_name = tmp;
  18. - efree(lcname);
  19. - lcname = zend_str_tolower_dup(Z_STRVAL(class_name->u.constant), Z_STRLEN(class_name->u.constant));
  20. - }
  21. + if (CG(active_class_entry)) {
  22. + /* prefix class name with the name of current class */
  23. + znode ns;
  24. + znode active;
  25. +
  26. + if (CG(current_namespace)) {
  27. + ns.op_type = IS_CONST;
  28. + ns.u.constant = *CG(current_namespace);
  29. + zval_copy_ctor(&ns.u.constant);
  30. + } else {
  31. + ns.op_type = IS_CONST;
  32. + ZVAL_STRINGL(
  33. + &ns.u.constant,
  34. + CG(active_class_entry)->name, CG(active_class_entry)->name_length, 1);
  35. + }
  36. +
  37. + zend_do_build_namespace_name(
  38. + &ns, &ns, class_name TSRMLS_CC);
  39. + *class_name = ns;
  40. +
  41. + efree(lcname);
  42. + lcname = zend_str_tolower_dup(Z_STRVAL(class_name->u.constant), Z_STRLEN(class_name->u.constant));
  43. +
  44. + } else {
  45. + if (CG(current_namespace)) {
  46. + /* Prefix class name with name of current namespace */
  47. + znode tmp;
  48. +
  49. + tmp.op_type = IS_CONST;
  50. + tmp.u.constant = *CG(current_namespace);
  51. + zval_copy_ctor(&tmp.u.constant);
  52. + zend_do_build_namespace_name(&tmp, &tmp, class_name TSRMLS_CC);
  53. + *class_name = tmp;
  54. + efree(lcname);
  55. + lcname = zend_str_tolower_dup(Z_STRVAL(class_name->u.constant), Z_STRLEN(class_name->u.constant));
  56. + php_printf("%s\n", lcname);
  57. + }
  58. + }
  59.  
  60. if (error) {
  61. char *tmp = zend_str_tolower_dup(Z_STRVAL_PP(ns_name), Z_STRLEN_PP(ns_name));
  62. diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y
  63. index 3a94955..424f5f7 100644
  64. --- a/Zend/zend_language_parser.y
  65. +++ b/Zend/zend_language_parser.y
  66. @@ -589,6 +589,7 @@ class_statement_list:
  67. class_statement:
  68. variable_modifiers { CG(access_type) = Z_LVAL($1.u.constant); } class_variable_declaration ';'
  69. | class_constant_declaration ';'
  70. + | unticked_class_declaration_statement
  71. | trait_use_statement
  72. | method_modifiers function is_reference T_STRING { zend_do_begin_function_declaration(&$2, &$4, 1, $3.op_type, &$1 TSRMLS_CC); }
  73. '(' parameter_list ')'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement