Skip to content

Commit 8483991

Browse files
author
cpriest
committed
Dissallow declaration of static property accessor
Fixes php#23
1 parent b04e5b0 commit 8483991

22 files changed

+247
-106
lines changed

Zend/tests/accessors/accessor_inherited_static.phpt

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,16 @@ base::$z = 5;
1818
echo base::$z."\r\n";
1919
echo sub::$z."\r\n";
2020

21-
echo "Done\n";
22-
?>
23-
--EXPECTF--
21+
/*********************************************************************************
22+
* Static accessors as a feature for first release was shelved, the lines below
23+
* are what this test should output when static accessors are written:
24+
*********************************************************************************
2425
5
2526
5
26-
Done
27+
==DONE==
28+
*/
29+
30+
?>
31+
==DONE==
32+
--EXPECTF--
33+
Fatal error: Cannot define static accessor %s, not supported at this time in %s on line %d

Zend/tests/accessors/accessor_static_basic.phpt

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,20 @@ ZE2 Tests that a static getter/setter function properly
1515
echo Shape::$Area."\r\n";
1616
Shape::$Area = 25;
1717
echo Shape::$Area."\r\n";
18-
19-
?>
20-
--EXPECTF--
18+
19+
20+
/*********************************************************************************
21+
* Static accessors as a feature for first release was shelved, the lines below
22+
* are what this test should output when static accessors are written:
23+
*********************************************************************************
2124
Shape::getArea()
2225
5
2326
Shape::setArea(25)
2427
Shape::getArea()
2528
25
29+
*/
30+
31+
32+
?>
33+
--EXPECTF--
34+
Fatal error: Cannot define static accessor %s, not supported at this time in %s on line %d

Zend/tests/accessors/accessor_static_get_autoimplement_basic.phpt

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,20 @@ AccessorTest::setStaticValue(5);
2626
echo "AccessorTest::setStaticValue(5);\n";
2727
echo "AccessorTest::\$b: ".AccessorTest::$b."\n";
2828
echo "Done\n";
29-
?>
30-
--EXPECTF--
29+
30+
31+
/*********************************************************************************
32+
* Static accessors as a feature for first release was shelved, the lines below
33+
* are what this test should output when static accessors are written:
34+
*********************************************************************************
3135
Protected static property: $__b exists.
3236
AccessorTest::$b:
3337
AccessorTest::setStaticValue(5);
3438
AccessorTest::$b: 5
3539
Done
40+
*/
41+
42+
43+
?>
44+
--EXPECTF--
45+
Fatal error: Cannot define static accessor %s, not supported at this time in %s on line %d

Zend/tests/accessors/accessor_static_get_defined_basic.phpt

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,18 @@ class AccessorTest {
1414

1515
echo "AccessorTest::\$b: ".AccessorTest::$b."\n";
1616
echo "Done\n";
17-
?>
18-
--EXPECTF--
17+
18+
19+
/*********************************************************************************
20+
* Static accessors as a feature for first release was shelved, the lines below
21+
* are what this test should output when static accessors are written:
22+
*********************************************************************************
1923
get AccessorTest::$b Called.
2024
AccessorTest::$b: 5
2125
Done
26+
*/
27+
28+
29+
?>
30+
--EXPECTF--
31+
Fatal error: Cannot define static accessor %s, not supported at this time in %s on line %d

Zend/tests/accessors/accessor_static_get_undefined_error.phpt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@ class AccessorTest {
1010
}
1111

1212
echo "AccessorTest::\$b: ".AccessorTest::$b."\n";
13+
14+
15+
/*********************************************************************************
16+
* Static accessors as a feature for first release was shelved, the lines below
17+
* are what this test should output when static accessors are written:
18+
*********************************************************************************
19+
Fatal error: Cannot get property AccessorTest::$b, no getter defined. in %s on line %d
20+
*/
21+
22+
1323
?>
1424
--EXPECTF--
15-
Fatal error: Cannot get property AccessorTest::$b, no getter defined. in %s on line %d
25+
Fatal error: Cannot define static accessor %s, not supported at this time in %s on line %d

Zend/tests/accessors/accessor_static_get_undefined_isset_called_error.phpt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@ class AccessorTest {
1010
}
1111

1212
echo "isset(AccessorTest::\$b) = ".(int)isset(AccessorTest::$b)."\n";
13+
14+
15+
/*********************************************************************************
16+
* Static accessors as a feature for first release was shelved, the lines below
17+
* are what this test should output when static accessors are written:
18+
*********************************************************************************
19+
Fatal error: Cannot isset property AccessorTest::$b, no getter defined. in %s on line %d
20+
*/
21+
22+
1323
?>
1424
--EXPECTF--
15-
Fatal error: Cannot isset property AccessorTest::$b, no getter defined. in %s on line %d
25+
Fatal error: Cannot define static accessor %s, not supported at this time in %s on line %d

Zend/tests/accessors/accessor_static_isset_autoimplement_basic.phpt

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,21 @@ AccessorTest::setStaticValue(NULL);
2222
echo "AccessorTest::setStaticValue(NULL);\n";
2323
echo "isset(AccessorTest::\$b) = ".(int)isset(AccessorTest::$b)."\n";
2424
echo "Done";
25-
?>
26-
--EXPECTF--
25+
26+
27+
/*********************************************************************************
28+
* Static accessors as a feature for first release was shelved, the lines below
29+
* are what this test should output when static accessors are written:
30+
*********************************************************************************
2731
isset(AccessorTest::$b) = 0
2832
AccessorTest::setStaticValue(10);
2933
isset(AccessorTest::$b) = 1
3034
AccessorTest::setStaticValue(NULL);
3135
isset(AccessorTest::$b) = 0
32-
Done
36+
Done
37+
*/
38+
39+
40+
?>
41+
--EXPECTF--
42+
Fatal error: Cannot define static accessor %s, not supported at this time in %s on line %d

Zend/tests/accessors/accessor_static_isset_defined_basic.phpt

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,12 @@ AccessorTest::$b = NULL;
2222
echo "AccessorTest::\$b = NULL;\n";
2323
echo "isset(AccessorTest::\$b) = ".(int)isset(AccessorTest::$b)."\n";
2424
echo "Done";
25-
?>
26-
--EXPECTF--
25+
26+
27+
/*********************************************************************************
28+
* Static accessors as a feature for first release was shelved, the lines below
29+
* are what this test should output when static accessors are written:
30+
*********************************************************************************
2731
static isset AccessorTest::$b Called.
2832
isset(AccessorTest::$b) = 0
2933
AccessorTest::$b = 10;
@@ -32,4 +36,10 @@ isset(AccessorTest::$b) = 1
3236
AccessorTest::$b = NULL;
3337
static isset AccessorTest::$b Called.
3438
isset(AccessorTest::$b) = 0
35-
Done
39+
Done
40+
*/
41+
42+
43+
?>
44+
--EXPECTF--
45+
Fatal error: Cannot define static accessor %s, not supported at this time in %s on line %d

Zend/tests/accessors/accessor_static_isset_undefined_basic.phpt

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,21 @@ AccessorTest::setStaticValue(NULL);
2121
echo "AccessorTest::setStaticValue(NULL);\n";
2222
echo "isset(AccessorTest::\$b) = ".(int)isset(AccessorTest::$b)."\n";
2323
echo "Done";
24-
?>
25-
--EXPECTF--
24+
25+
26+
/*********************************************************************************
27+
* Static accessors as a feature for first release was shelved, the lines below
28+
* are what this test should output when static accessors are written:
29+
*********************************************************************************
2630
isset(AccessorTest::$b) = 0
2731
AccessorTest::setStaticValue(10);
2832
isset(AccessorTest::$b) = 1
2933
AccessorTest::setStaticValue(NULL);
3034
isset(AccessorTest::$b) = 0
31-
Done
35+
Done
36+
*/
37+
38+
39+
?>
40+
--EXPECTF--
41+
Fatal error: Cannot define static accessor %s, not supported at this time in %s on line %d

Zend/tests/accessors/accessor_static_parent_basic.phpt

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,23 @@ ZE2 Tests that a static getter/setter function properly through parent accessors
2323
Shape2::$Area = 25;
2424
echo Shape2::$Area."\r\n";
2525

26-
?>
27-
--EXPECTF--
26+
27+
28+
/*********************************************************************************
29+
* Static accessors as a feature for first release was shelved, the lines below
30+
* are what this test should output when static accessors are written:
31+
*********************************************************************************
2832
Static Shape2::getArea()
2933
Static Shape::getArea()
3034
5
3135
Static Shape2::setArea(25)
3236
Static Shape::setArea(25)
3337
Static Shape2::getArea()
3438
Static Shape::getArea()
35-
25
39+
25
40+
*/
41+
42+
43+
?>
44+
--EXPECTF--
45+
Fatal error: Cannot define static accessor %s, not supported at this time in %s on line %d

Zend/tests/accessors/accessor_static_set_autoimplement_basic.phpt

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,20 @@ AccessorTest::$b = 10;
2626
echo "AccessorTest::\$b = 10;\n";
2727
echo "AccessorTest::\$b: ".AccessorTest::getStaticValue()."\n";
2828
echo "Done\n";
29-
?>
30-
--EXPECTF--
29+
30+
31+
/*********************************************************************************
32+
* Static accessors as a feature for first release was shelved, the lines below
33+
* are what this test should output when static accessors are written:
34+
*********************************************************************************
3135
Protected static property: $__b exists.
3236
AccessorTest::$b:
3337
AccessorTest::$b = 10;
3438
AccessorTest::$b: 10
3539
Done
40+
*/
41+
42+
43+
?>
44+
--EXPECTF--
45+
Fatal error: Cannot define static accessor %s, not supported at this time in %s on line %d

Zend/tests/accessors/accessor_static_set_defined_basic.phpt

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,18 @@ class AccessorTest {
1414
echo "AccessorTest::\$b = 12;\n";
1515
AccessorTest::$b = 12;
1616
echo "Done\n";
17-
?>
18-
--EXPECTF--
17+
18+
19+
/*********************************************************************************
20+
* Static accessors as a feature for first release was shelved, the lines below
21+
* are what this test should output when static accessors are written:
22+
*********************************************************************************
1923
AccessorTest::$b = 12;
2024
set AccessorTest::$b Called $value = 12.
2125
Done
26+
*/
27+
28+
29+
?>
30+
--EXPECTF--
31+
Fatal error: Cannot define static accessor %s, not supported at this time in %s on line %d

Zend/tests/accessors/accessor_static_set_defined_get_called_error.phpt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,16 @@ class AccessorTest {
1212
}
1313

1414
echo AccessorTest::$b;
15+
16+
17+
/*********************************************************************************
18+
* Static accessors as a feature for first release was shelved, the lines below
19+
* are what this test should output when static accessors are written:
20+
*********************************************************************************
21+
Fatal error: Cannot get property AccessorTest::$b, no getter defined. in %s on line %d
22+
*/
23+
24+
1525
?>
1626
--EXPECTF--
17-
Fatal error: Cannot get property AccessorTest::$b, no getter defined. in %s on line %d
27+
Fatal error: Cannot define static accessor %s, not supported at this time in %s on line %d

Zend/tests/accessors/accessor_static_set_defined_parent_get_called_error.phpt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,16 @@ class AccessorTest extends ParentAccessorTest {
2424
}
2525

2626
echo AccessorTest::$b;
27+
28+
29+
/*********************************************************************************
30+
* Static accessors as a feature for first release was shelved, the lines below
31+
* are what this test should output when static accessors are written:
32+
*********************************************************************************
33+
Fatal error: Cannot get property parent::$a, no getter defined. in %s on line %d
34+
*/
35+
36+
2737
?>
2838
--EXPECTF--
29-
Fatal error: Cannot get property parent::$a, no getter defined. in %s on line %d
39+
Fatal error: Cannot define static accessor %s, not supported at this time in %s on line %d

Zend/tests/accessors/accessor_static_set_defined_self_get_called_error.phpt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@ class AccessorTest {
1616
}
1717

1818
echo AccessorTest::$b;
19+
20+
21+
/*********************************************************************************
22+
* Static accessors as a feature for first release was shelved, the lines below
23+
* are what this test should output when static accessors are written:
24+
*********************************************************************************
25+
Fatal error: Cannot get property self::$a, no getter defined. in %s on line %d
26+
*/
27+
28+
1929
?>
2030
--EXPECTF--
21-
Fatal error: Cannot get property self::$a, no getter defined. in %s on line %d
31+
Fatal error: Cannot define static accessor %s, not supported at this time in %s on line %d

Zend/tests/accessors/accessor_static_set_undefined_error.phpt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@ class AccessorTest {
1010
}
1111

1212
AccessorTest::$b = 12;
13+
14+
15+
/*********************************************************************************
16+
* Static accessors as a feature for first release was shelved, the lines below
17+
* are what this test should output when static accessors are written:
18+
*********************************************************************************
19+
Fatal error: Cannot set property AccessorTest::$b, no setter defined. in %s on line %d
20+
*/
21+
22+
1323
?>
1424
--EXPECTF--
15-
Fatal error: Cannot set property AccessorTest::$b, no setter defined. in %s on line %d
25+
Fatal error: Cannot define static accessor %s, not supported at this time in %s on line %d

Zend/tests/accessors/accessor_static_set_undefined_unset_called_error.phpt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@ class AccessorTest {
1010
}
1111

1212
unset(AccessorTest::$b);
13+
14+
15+
/*********************************************************************************
16+
* Static accessors as a feature for first release was shelved, the lines below
17+
* are what this test should output when static accessors are written:
18+
*********************************************************************************
19+
Fatal error: Cannot unset property AccessorTest::$b, no setter defined. in %s on line %d
20+
*/
21+
22+
1323
?>
1424
--EXPECTF--
15-
Fatal error: Cannot unset property AccessorTest::$b, no setter defined. in %s on line %d
25+
Fatal error: Cannot define static accessor %s, not supported at this time in %s on line %d

0 commit comments

Comments
 (0)