Permalink
Browse files

- Next step in namespaces, using / as namespace separator.

  • Loading branch information...
1 parent 6ca3ad3 commit 7126de4912d9d4c7499deb1f9239980400aa7ec7 Marcus Boerger committed Nov 4, 2008
Showing with 3,739 additions and 3,571 deletions.
  1. +1 −1 NEWS
  2. +5 −5 Zend/tests/bug42802.phpt
  3. +83 −65 Zend/tests/bug42819.phpt
  4. +10 −10 Zend/tests/bug42820.phpt
  5. +3 −3 Zend/tests/bug42859.phpt
  6. +2 −2 Zend/tests/bug43183.phpt
  7. +1 −1 Zend/tests/bug43332_1.phpt
  8. +2 −2 Zend/tests/bug43332_2.phpt
  9. +1 −1 Zend/tests/bug43343.phpt
  10. +1 −1 Zend/tests/bug43344_10.phpt
  11. +1 −1 Zend/tests/bug43344_11.phpt
  12. +1 −1 Zend/tests/bug43344_12.phpt
  13. +1 −1 Zend/tests/bug43344_13.phpt
  14. +1 −1 Zend/tests/bug43344_2.phpt
  15. +1 −1 Zend/tests/bug43344_3.phpt
  16. +1 −1 Zend/tests/bug43344_4.phpt
  17. +1 −1 Zend/tests/bug43344_5.phpt
  18. +2 −2 Zend/tests/bug43344_6.phpt
  19. +2 −2 Zend/tests/bug43344_7.phpt
  20. +2 −2 Zend/tests/bug43344_8.phpt
  21. +2 −2 Zend/tests/bug43344_9.phpt
  22. +13 −13 Zend/tests/bug43651.phpt
  23. +9 −5 Zend/tests/bug44653.phpt
  24. +8 −8 Zend/tests/class_alias_012.phpt
  25. +7 −7 Zend/tests/class_alias_013.phpt
  26. +3 −3 Zend/tests/class_alias_015.phpt
  27. +4 −4 Zend/tests/class_alias_016.phpt
  28. +2 −2 Zend/tests/class_alias_019.phpt
  29. +8 −8 Zend/tests/class_alias_020.phpt
  30. +7 −7 Zend/tests/class_alias_021.phpt
  31. +6 −6 Zend/tests/class_constants_004.phpt
  32. +4 −4 Zend/tests/class_exists_001.phpt
  33. +1 −1 Zend/tests/constants_003.phpt
  34. +1 −1 Zend/tests/constants_004.phpt
  35. +2 −2 Zend/tests/constants_006.phpt
  36. +5 −3 Zend/tests/constants_009.phpt
  37. +1 −1 Zend/tests/inter_02.phpt
  38. +2 −2 Zend/tests/interface_exists_002.phpt
  39. +2 −2 Zend/tests/lsb_014.phpt
  40. +9 −9 Zend/tests/ns_001.phpt
  41. +12 −12 Zend/tests/ns_002.phpt
  42. +2 −2 Zend/tests/ns_003.phpt
  43. +1 −1 Zend/tests/ns_004.phpt
  44. +2 −2 Zend/tests/ns_005.phpt
  45. +3 −3 Zend/tests/ns_006.phpt
  46. +1 −1 Zend/tests/ns_007.phpt
  47. +2 −2 Zend/tests/ns_008.phpt
  48. +1 −1 Zend/tests/ns_009.phpt
  49. +12 −12 Zend/tests/ns_010.phpt
  50. +7 −7 Zend/tests/ns_011.phpt
  51. +16 −16 Zend/tests/ns_012.phpt
  52. +2 −2 Zend/tests/ns_013.phpt
  53. +1 −1 Zend/tests/ns_014.phpt
  54. +2 −2 Zend/tests/ns_015.phpt
  55. +3 −3 Zend/tests/ns_016.phpt
  56. +1 −1 Zend/tests/ns_017.phpt
  57. +2 −2 Zend/tests/ns_018.phpt
  58. +1 −1 Zend/tests/ns_019.phpt
  59. +7 −7 Zend/tests/ns_020.phpt
  60. +5 −5 Zend/tests/ns_021.phpt
  61. +5 −5 Zend/tests/ns_022.phpt
  62. +3 −3 Zend/tests/ns_023.phpt
  63. +7 −7 Zend/tests/ns_025.phpt
  64. +13 −10 Zend/tests/ns_026.phpt
  65. +1 −1 Zend/tests/ns_027.inc
  66. +4 −4 Zend/tests/ns_027.phpt
  67. +8 −8 Zend/tests/ns_028.phpt
  68. +1 −1 Zend/tests/ns_029.phpt
  69. +2 −2 Zend/tests/ns_030.phpt
  70. +4 −4 Zend/tests/ns_031.phpt
  71. +2 −2 Zend/tests/ns_032.phpt
  72. +6 −6 Zend/tests/ns_034.phpt
  73. +2 −2 Zend/tests/ns_035.phpt
  74. +8 −8 Zend/tests/ns_036.phpt
  75. +12 −12 Zend/tests/ns_037.phpt
  76. +1 −1 Zend/tests/ns_038.phpt
  77. +6 −6 Zend/tests/ns_040.phpt
  78. +3 −3 Zend/tests/ns_041.phpt
  79. +6 −6 Zend/tests/ns_042.phpt
  80. +1 −1 Zend/tests/ns_043.phpt
  81. +1 −1 Zend/tests/ns_044.phpt
  82. +2 −2 Zend/tests/ns_045.phpt
  83. +2 −2 Zend/tests/ns_046.phpt
  84. +1 −1 Zend/tests/ns_047.phpt
  85. +2 −2 Zend/tests/ns_048.phpt
  86. +1 −1 Zend/tests/ns_049.phpt
  87. +1 −1 Zend/tests/ns_050.phpt
  88. +1 −1 Zend/tests/ns_051.phpt
  89. +2 −2 Zend/tests/ns_052.phpt
  90. +3 −3 Zend/tests/ns_053.phpt
  91. +4 −4 Zend/tests/ns_054.phpt
  92. +3 −3 Zend/tests/ns_055.phpt
  93. +1 −1 Zend/tests/ns_056.phpt
  94. +15 −15 Zend/tests/ns_057.phpt
  95. +13 −13 Zend/tests/ns_058.phpt
  96. +6 −6 Zend/tests/ns_060.phpt
  97. +1 −1 Zend/tests/ns_061.phpt
  98. +3 −3 Zend/tests/ns_062.phpt
  99. +1 −1 Zend/tests/ns_064.phpt
  100. +2 −2 Zend/tests/ns_065.inc
  101. +5 −5 Zend/tests/ns_065.phpt
  102. +2 −2 Zend/tests/ns_066.phpt
  103. +1 −1 Zend/tests/ns_067.inc
  104. +1 −1 Zend/tests/ns_067.phpt
  105. +7 −9 Zend/zend_API.c
  106. +1 −1 Zend/zend_API.h
  107. +284 −147 Zend/zend_compile.c
  108. +2 −1 Zend/zend_compile.h
  109. +60 −51 Zend/zend_constants.c
  110. +77 −33 Zend/zend_execute_API.c
  111. +28 −24 Zend/zend_language_parser.y
  112. +2,616 −2,606 Zend/zend_language_scanner.c
  113. +4 −0 Zend/zend_language_scanner.l
  114. +1 −1 Zend/zend_language_scanner_defs.h
  115. +38 −42 Zend/zend_vm_def.h
  116. +118 −180 Zend/zend_vm_execute.h
  117. +20 −20 ext/reflection/php_reflection.c
  118. +4 −4 ext/reflection/tests/ReflectionFunction_getNamespaceName.phpt
  119. +4 −4 ext/reflection/tests/reflectionClass_getNamespaceName.phpt
  120. +2 −2 ext/standard/credits.c
  121. +2 −2 ext/standard/var_unserializer.c
  122. +1 −1 ext/standard/var_unserializer.re
View
2 NEWS
@@ -157,7 +157,7 @@ PHP NEWS
. Improved syntax highlighting and consistency for variables in double-quoted
strings and literal text in HEREDOCs and backticks. (Matt)
. Added "?:" operator. (Marcus)
- . Added support for namespaces. (Dmitry, Stas, Gregory)
+ . Added support for namespaces. (Dmitry, Stas, Gregory, Marcus)
. Added support for Late Static Binding. (Dmitry, Etienne Kneuss)
. Added support for __callStatic() magic method. (Sara)
. Added forward_static_call(_array) to complete LSB. (Mike Lively)
View
@@ -11,19 +11,19 @@ function test1(bar $bar) {
echo "ok\n";
}
-function test2(foo::bar $bar) {
+function test2(\foo\bar $bar) {
echo "ok\n";
}
-function test3(::foo::bar $bar) {
+function test3(\foo\bar $bar) {
echo "ok\n";
}
-function test4(::Exception $e) {
+function test4(\Exception $e) {
echo "ok\n";
}
function test5(Exception $e) {
echo "ok\n";
}
-function test6(::bar $bar) {
+function test6(\bar $bar) {
echo "bug\n";
}
@@ -42,4 +42,4 @@ ok
ok
ok
-Catchable fatal error: Argument 1 passed to foo::test6() must be an instance of bar, instance of foo::bar given, called in %sbug42802.php on line 23
+Catchable fatal error: Argument 1 passed to foo\test6() must be an instance of bar, instance of foo\bar given, called in %sbug42802.php on line 23
View
@@ -4,88 +4,100 @@ Bug #42819 (namespaces in indexes of constant arrays)
<?php if (!extension_loaded("spl")) print "skip"; ?>
--FILE--
<?php
+namespace foo\foo;
+
+const C = "foo\\foo\\C\n";
+const I = 12;
+
+class foo {
+const I = 32;
+const C = "foo\\foo\\foo::C\n";
+}
+
namespace foo;
-const C = "foo::C\n";
+const C = "foo\\C\n";
const I = 11;
class foo {
- const C = "foo::foo::C\n";
+ const C = "foo\\foo::C\n";
const I = 22;
const C1 = C;
- const C2 = foo::C;
- const C3 = foo::foo::C;
- const C4 = ::foo::C;
- const C5 = ::foo::foo::C;
+ const C2 = foo\C;
+ const C3 = foo\foo::C;
+ const C4 = \foo\C;
+ const C5 = \foo\foo::C;
const C6 = ArrayObject::STD_PROP_LIST;
const C7 = E_ERROR;
}
class bar1 {
static $a1 = array(I => 0);
- static $a2 = array(foo::I => 0);
- static $a3 = array(foo::foo::I => 0);
- static $a4 = array(::foo::I => 0);
- static $a5 = array(::foo::foo::I => 0);
+ static $a2 = array(foo\I => 0);
+ static $a3 = array(foo\foo::I => 0);
+ static $a4 = array(\foo\I => 0);
+ static $a5 = array(\foo\foo::I => 0);
static $a6 = array(ArrayObject::STD_PROP_LIST => 0);
static $a7 = array(E_ERROR => 0);
}
class bar2 {
static $a1 = array(I => I);
- static $a2 = array(foo::I => I);
- static $a3 = array(foo::foo::I => I);
- static $a4 = array(::foo::I => I);
- static $a5 = array(::foo::foo::I => I);
+ static $a2 = array(foo\I => I);
+ static $a3 = array(foo\foo::I => I);
+ static $a4 = array(\foo\I => I);
+ static $a5 = array(\foo\foo::I => I);
static $a6 = array(ArrayObject::STD_PROP_LIST => I);
static $a7 = array(E_ERROR => I);
}
class bar3 {
- static $a1 = array(I => foo::I);
- static $a2 = array(foo::I => foo::I);
- static $a3 = array(foo::foo::I => foo::I);
- static $a4 = array(::foo::I => foo::I);
- static $a5 = array(::foo::foo::I => foo::I);
- static $a6 = array(ArrayObject::STD_PROP_LIST => foo::I);
- static $a7 = array(E_ERROR => foo::I);
+ static $a1 = array(I => foo\I);
+ static $a2 = array(foo\I => foo\I);
+ static $a3 = array(foo\foo::I => foo\I);
+ static $a4 = array(\foo\I => foo\I);
+ static $a5 = array(\foo\foo::I => foo\I);
+ static $a6 = array(ArrayObject::STD_PROP_LIST => foo\I);
+ static $a7 = array(E_ERROR => foo\I);
}
class bar4 {
static $a1 = array(I => ArrayObject::STD_PROP_LIST);
- static $a2 = array(foo::I => ArrayObject::STD_PROP_LIST);
- static $a3 = array(foo::foo::I => ArrayObject::STD_PROP_LIST);
- static $a4 = array(::foo::I => ArrayObject::STD_PROP_LIST);
- static $a5 = array(::foo::foo::I => ArrayObject::STD_PROP_LIST);
+ static $a2 = array(foo\I => ArrayObject::STD_PROP_LIST);
+ static $a3 = array(foo\foo::I => ArrayObject::STD_PROP_LIST);
+ static $a4 = array(\foo\I => ArrayObject::STD_PROP_LIST);
+ static $a5 = array(\foo\foo::I => ArrayObject::STD_PROP_LIST);
static $a6 = array(ArrayObject::STD_PROP_LIST => ArrayObject::STD_PROP_LIST);
static $a7 = array(E_ERROR => ArrayObject::STD_PROP_LIST);
}
class bar5 {
static $a1 = array(I => E_ERROR);
- static $a2 = array(foo::I => E_ERROR);
- static $a3 = array(foo::foo::I => E_ERROR);
- static $a4 = array(::foo::I => E_ERROR);
- static $a5 = array(::foo::foo::I => E_ERROR);
+ static $a2 = array(foo\I => E_ERROR);
+ static $a3 = array(foo\foo::I => E_ERROR);
+ static $a4 = array(\foo\I => E_ERROR);
+ static $a5 = array(\foo\foo::I => E_ERROR);
static $a6 = array(ArrayObject::STD_PROP_LIST => E_ERROR);
static $a7 = array(E_ERROR => E_ERROR);
}
+echo "first\n";
echo C;
+echo foo\C;
+echo foo\foo::C;
echo foo::C;
-echo foo::foo::C;
-echo ::foo::C;
-echo ::foo::foo::C;
+echo \foo\foo::C;
echo ArrayObject::STD_PROP_LIST . "\n";
echo E_ERROR . "\n";
-echo foo::foo::C1;
-echo foo::foo::C2;
-echo foo::foo::C3;
-echo foo::foo::C4;
-echo foo::foo::C5;
-echo foo::foo::C6 . "\n";
-echo foo::foo::C7 . "\n";
+echo "second\n";
+echo \foo\foo::C1;
+echo \foo\foo::C2;
+echo \foo\foo::C3;
+echo \foo\foo::C4;
+echo \foo\foo::C5;
+echo \foo\foo::C6 . "\n";
+echo \foo\foo::C7 . "\n";
print_r(bar1::$a1);
print_r(bar1::$a2);
@@ -126,20 +138,24 @@ print_r(bar5::$a4);
print_r(bar5::$a5);
print_r(bar5::$a6);
print_r(bar5::$a7);
+function oops($a = array(foo\unknown)){}
+oops();
?>
---EXPECT--
-foo::C
-foo::C
-foo::foo::C
-foo::C
-foo::foo::C
+--EXPECTF--
+first
+foo\C
+foo\foo\C
+foo\foo\foo::C
+foo\foo::C
+foo\foo::C
1
1
-foo::C
-foo::C
-foo::foo::C
-foo::C
-foo::foo::C
+second
+foo\C
+foo\foo\C
+foo\foo\foo::C
+foo\C
+foo\foo::C
1
1
Array
@@ -148,11 +164,11 @@ Array
)
Array
(
- [11] => 0
+ [12] => 0
)
Array
(
- [22] => 0
+ [32] => 0
)
Array
(
@@ -176,11 +192,11 @@ Array
)
Array
(
- [11] => 11
+ [12] => 11
)
Array
(
- [22] => 11
+ [32] => 11
)
Array
(
@@ -200,43 +216,43 @@ Array
)
Array
(
- [11] => 11
+ [11] => 12
)
Array
(
- [11] => 11
+ [12] => 12
)
Array
(
- [22] => 11
+ [32] => 12
)
Array
(
- [11] => 11
+ [11] => 12
)
Array
(
- [22] => 11
+ [22] => 12
)
Array
(
- [1] => 11
+ [1] => 12
)
Array
(
- [1] => 11
+ [1] => 12
)
Array
(
[11] => 1
)
Array
(
- [11] => 1
+ [12] => 1
)
Array
(
- [22] => 1
+ [32] => 1
)
Array
(
@@ -260,11 +276,11 @@ Array
)
Array
(
- [11] => 1
+ [12] => 1
)
Array
(
- [22] => 1
+ [32] => 1
)
Array
(
@@ -282,3 +298,5 @@ Array
(
[1] => 1
)
+
+Fatal error: Undefined constant 'foo\foo\unknown' in %sbug42819.php on line %d
View
@@ -7,16 +7,16 @@ const ok = 0;
class foo {
const ok = 0;
}
-var_dump(defined('ns::ok'));
-var_dump(defined('ns::bug'));
-var_dump(defined('::ns::ok'));
-var_dump(defined('::ns::bug'));
-var_dump(defined('ns::foo::ok'));
-var_dump(defined('ns::foo::bug'));
-var_dump(defined('::ns::foo::ok'));
-var_dump(defined('::ns::foo::bug'));
-var_dump(defined('ns::bar::bug'));
-var_dump(defined('::ns::bar::bug'));
+var_dump(defined('ns\\ok'));
+var_dump(defined('ns\\bug'));
+var_dump(defined('\\ns\\ok'));
+var_dump(defined('\\ns\\bug'));
+var_dump(defined('ns\\foo::ok'));
+var_dump(defined('ns\\foo::bug'));
+var_dump(defined('\\ns\\foo::ok'));
+var_dump(defined('\\ns\\foo::bug'));
+var_dump(defined('ns\\bar::bug'));
+var_dump(defined('\\ns\\bar::bug'));
--EXPECT--
bool(true)
bool(false)
View
@@ -5,8 +5,8 @@ Bug #42859 (import always conflicts with internal classes)
namespace Foo;
class Ex {}
-use Blah::Exception;
-use Blah::Ex;
+use Blah\Exception;
+use Blah\Ex;
?>
--EXPECTF--
-Fatal error: Cannot use Blah::Ex as Ex because the name is already in use in %sbug42859.php on line 6
+Fatal error: Cannot use Blah\Ex as Ex because the name is already in use in %sbug42859.php on line 6
View
@@ -3,10 +3,10 @@ Bug #43183 ("use" of the same class in difference scripts results in a fatal err
--FILE--
<?php
namespace Test;
-use Test::Foo;
+use Test\Foo;
class Foo {}
class Bar {}
-use Test::Bar;
+use Test\Bar;
echo "ok\n";
--EXPECT--
ok
@@ -12,4 +12,4 @@ $foo = new foo;
$foo->bar($foo); // Ok!
$foo->bar(new stdclass); // Error, ok!
--EXPECTF--
-Catchable fatal error: Argument 1 passed to foobar::foo::bar() must be an instance of foobar::foo, instance of stdClass given, called in %sbug43332_1.php on line 10 and defined in %sbug43332_1.php on line 5
+Catchable fatal error: Argument 1 passed to foobar\foo::bar() must be an instance of foobar\foo, instance of stdClass given, called in %sbug43332_1.php on line 10 and defined in %sbug43332_1.php on line 5
@@ -5,11 +5,11 @@ Bug #43332.2 (self and parent as type hint in namespace)
namespace foobar;
class foo {
- public function bar(::self $a) { }
+ public function bar(\self $a) { }
}
$foo = new foo;
$foo->bar($foo); // Ok!
$foo->bar(new stdclass); // Error, ok!
--EXPECTF--
-Fatal error: '::self' is a wrong class name in %sbug43332_2.php on line 5
+Fatal error: 'self' is an invalid class name in %sbug43332_2.php on line 5
View
@@ -8,4 +8,4 @@ $foo = 'bar';
var_dump(new namespace::$foo);
?>
--EXPECTF--
-Fatal error: Cannot use 'namespace' as a class name in %sbug43343.php on line 5
+Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM, expecting T_NS_SEPARATOR in %sbug43343.php on line 5
Oops, something went wrong.

0 comments on commit 7126de4

Please sign in to comment.