Skip to content

[RFC] Renaming the stdClass to StdClass #4641

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion Zend/tests/008.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ var_dump(define("test const", 3));
var_dump(define("test const", 3));
var_dump(define("test", array(1)));
var_dump(define("test1", fopen(__FILE__, 'r')));
var_dump(define("test2", new stdclass));
var_dump(define("test2", new StdClass));

var_dump(constant(" "));
var_dump(constant("[[["));
Expand Down
2 changes: 1 addition & 1 deletion Zend/tests/010.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ var_dump(get_parent_class("i"));
var_dump(get_parent_class(""));
var_dump(get_parent_class("[[[["));
var_dump(get_parent_class(" "));
var_dump(get_parent_class(new stdclass));
var_dump(get_parent_class(new StdClass));
var_dump(get_parent_class(array()));
var_dump(get_parent_class(1));

Expand Down
4 changes: 2 additions & 2 deletions Zend/tests/012.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ var_dump(class_exists(""));
var_dump(class_exists("test", false));
var_dump(class_exists("foo", false));
var_dump(class_exists("foo"));
var_dump(class_exists("stdClass", false));
var_dump(class_exists("stdClass"));
var_dump(class_exists("StdClass", false));
var_dump(class_exists("StdClass"));

echo "Done\n";
?>
Expand Down
4 changes: 2 additions & 2 deletions Zend/tests/013.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ var_dump(interface_exists(""));
var_dump(interface_exists("test", false));
var_dump(interface_exists("foo", false));
var_dump(interface_exists("foo"));
var_dump(interface_exists("stdClass", false));
var_dump(interface_exists("stdClass"));
var_dump(interface_exists("StdClass", false));
var_dump(interface_exists("StdClass"));

echo "Done\n";
?>
Expand Down
20 changes: 10 additions & 10 deletions Zend/tests/029.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Testing assign to property of an object in an array
--FILE--
<?php

$arr = array(new stdClass);
$arr = array(new StdClass);

$arr[0]->a = clone $arr[0];
var_dump($arr);
Expand All @@ -18,34 +18,34 @@ var_dump($arr);
--EXPECT--
array(1) {
[0]=>
object(stdClass)#1 (1) {
object(StdClass)#1 (1) {
["a"]=>
object(stdClass)#2 (0) {
object(StdClass)#2 (0) {
}
}
}
array(1) {
[0]=>
object(stdClass)#1 (2) {
object(StdClass)#1 (2) {
["a"]=>
object(stdClass)#2 (0) {
object(StdClass)#2 (0) {
}
["b"]=>
object(stdClass)#3 (0) {
object(StdClass)#3 (0) {
}
}
}
array(1) {
[0]=>
object(stdClass)#1 (3) {
object(StdClass)#1 (3) {
["a"]=>
object(stdClass)#2 (0) {
object(StdClass)#2 (0) {
}
["b"]=>
object(stdClass)#3 (0) {
object(StdClass)#3 (0) {
}
["c"]=>
object(stdClass)#2 (0) {
object(StdClass)#2 (0) {
}
}
}
6 changes: 3 additions & 3 deletions Zend/tests/add_002.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ adding objects to arrays

$a = array(1,2,3);

$o = new stdclass;
$o = new StdClass;
$o->prop = "value";

try {
Expand All @@ -20,11 +20,11 @@ var_dump($c);
echo "Done\n";
?>
--EXPECTF--
Notice: Object of class stdClass could not be converted to number in %sadd_002.php on line %d
Notice: Object of class StdClass could not be converted to number in %sadd_002.php on line %d

Exception: Unsupported operand types

Notice: Object of class stdClass could not be converted to number in %s on line %d
Notice: Object of class StdClass could not be converted to number in %s on line %d

Fatal error: Uncaught Error: Unsupported operand types in %s:%d
Stack trace:
Expand Down
6 changes: 3 additions & 3 deletions Zend/tests/add_003.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ adding arrays to objects

$a = array(1,2,3);

$o = new stdclass;
$o = new StdClass;
$o->prop = "value";

try {
Expand All @@ -20,11 +20,11 @@ var_dump($c);
echo "Done\n";
?>
--EXPECTF--
Notice: Object of class stdClass could not be converted to number in %sadd_003.php on line %d
Notice: Object of class StdClass could not be converted to number in %sadd_003.php on line %d

Exception: Unsupported operand types

Notice: Object of class stdClass could not be converted to number in %s on line %d
Notice: Object of class StdClass could not be converted to number in %s on line %d

Fatal error: Uncaught Error: Unsupported operand types in %s:%d
Stack trace:
Expand Down
2 changes: 1 addition & 1 deletion Zend/tests/arg_unpack/invalid_type.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function test(...$args) {

test(...null);
test(...42);
test(...new stdClass);
test(...new StdClass);

test(1, 2, 3, ..."foo", ...[4, 5]);
test(1, 2, 3, ...new StdClass, ...3.14, ...[4, 5]);
Expand Down
2 changes: 1 addition & 1 deletion Zend/tests/array_literal_next_element_error.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Next free element may overflow in array literals
<?php

$i = PHP_INT_MAX;
$array = [$i => 42, new stdClass];
$array = [$i => 42, new StdClass];
var_dump($array);

const FOO = [PHP_INT_MAX => 42, "foo"];
Expand Down
12 changes: 6 additions & 6 deletions Zend/tests/assert/bug70528.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ namespace Foo;
class Bar {}

$bar = "Bar";
assert(new \stdClass instanceof $bar);
assert(new \stdClass instanceof Bar);
assert(new \stdClass instanceof \Foo\Bar);
assert(new \StdClass instanceof $bar);
assert(new \StdClass instanceof Bar);
assert(new \StdClass instanceof \Foo\Bar);
?>
--EXPECTF--
Warning: assert(): assert(new \stdClass() instanceof $bar) failed in %sbug70528.php on line %d
Warning: assert(): assert(new \StdClass() instanceof $bar) failed in %sbug70528.php on line %d

Warning: assert(): assert(new \stdClass() instanceof Bar) failed in %sbug70528.php on line %d
Warning: assert(): assert(new \StdClass() instanceof Bar) failed in %sbug70528.php on line %d

Warning: assert(): assert(new \stdClass() instanceof \Foo\Bar) failed in %sbug70528.php on line %d
Warning: assert(): assert(new \StdClass() instanceof \Foo\Bar) failed in %sbug70528.php on line %d
8 changes: 4 additions & 4 deletions Zend/tests/assign_coalesce_001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ $ary[id($bar)] ??= $foo;
var_dump($ary);

echo "\nObjects:\n";
$obj = new stdClass;
$obj = new StdClass;
$obj->foo ??= 123;
$obj->$foo ??= $bar;
$obj->$bar ??= $foo;
var_dump($obj);

$obj = new stdClass;
$obj = new StdClass;
$obj->{id($foo)} ??= 123;
$obj->{id($foo)} ??= $bar;
$obj->{id($bar)} ??= $foo;
Expand Down Expand Up @@ -101,7 +101,7 @@ array(2) {
}

Objects:
object(stdClass)#1 (2) {
object(StdClass)#1 (2) {
["foo"]=>
int(123)
["bar"]=>
Expand All @@ -110,7 +110,7 @@ object(stdClass)#1 (2) {
id(foo)
id(foo)
id(bar)
object(stdClass)#2 (2) {
object(StdClass)#2 (2) {
["foo"]=>
int(123)
["bar"]=>
Expand Down
4 changes: 2 additions & 2 deletions Zend/tests/assign_dim_obj_null_return.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ function test() {

var_dump($array[] = 123);
var_dump($array[[]] = 123);
var_dump($array[new stdClass] = 123);
var_dump($array[new StdClass] = 123);
var_dump($true[123] = 456);

var_dump($array[] += 123);
var_dump($array[[]] += 123);
var_dump($array[new stdClass] += 123);
var_dump($array[new StdClass] += 123);
var_dump($true[123] += 456);

var_dump($true->foo = 123);
Expand Down
4 changes: 2 additions & 2 deletions Zend/tests/assign_obj_ref_byval_function.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ function notRef() {
return null;
}

$obj = new stdClass;
$obj = new StdClass;
$obj->prop =& notRef();
var_dump($obj);

?>
--EXPECTF--
Notice: Only variables should be assigned by reference in %s on line %d
object(stdClass)#1 (1) {
object(StdClass)#1 (1) {
["prop"]=>
NULL
}
2 changes: 1 addition & 1 deletion Zend/tests/assign_to_obj_002.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Assign to $this leaks when $this not defined
<?php

try {
$this->a = new stdClass;
$this->a = new StdClass;
} catch (Error $e) { echo $e->getMessage(), "\n"; }

?>
Expand Down
4 changes: 2 additions & 2 deletions Zend/tests/bug29015.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
Bug #29015 (Incorrect behavior of member vars(non string ones)-numeric mem vars und others)
--FILE--
<?php
$a = new stdClass();
$a = new StdClass();
$x = "";
$a->$x = "string('')";
var_dump($a);
$a->{"\0"} = 42;
var_dump($a);
?>
--EXPECTF--
object(stdClass)#1 (1) {
object(StdClass)#1 (1) {
[""]=>
string(10) "string('')"
}
Expand Down
4 changes: 2 additions & 2 deletions Zend/tests/bug30080.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ class foo {
}
}

new foo(array(new stdClass));
new foo(array(new StdClass));
?>
--EXPECTF--
array(1) {
[0]=>
object(stdClass)#%d (0) {
object(StdClass)#%d (0) {
}
}
4 changes: 2 additions & 2 deletions Zend/tests/bug35163_3.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Bug #35163.3 (Array elements can lose references)
--FILE--
<?php
$a = new stdClass;
$a = new StdClass;
$a->b = array(1);
$a->b[] =& $a->b;
$a->b[] =& $a->b;
Expand All @@ -12,7 +12,7 @@ $a->b = null;
$a = null;
?>
--EXPECTF--
object(stdClass)#%d (1) {
object(StdClass)#%d (1) {
["b"]=>
&array(3) {
[0]=>
Expand Down
8 changes: 4 additions & 4 deletions Zend/tests/bug35239.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
Bug #35239 (Objects can lose references)
--FILE--
<?php
$a = new stdClass;
$a->x0 = new stdClass;
$a = new StdClass;
$a->x0 = new StdClass;
$a->x0->y0 = 'a';
$a->x0->y1 =& $a->x0;
$a->x0->y2 =& $a->x0;
Expand All @@ -13,9 +13,9 @@ $a->x0->y1 = "ok\n";
echo $a->x0;
?>
--EXPECTF--
object(stdClass)#%d (1) {
object(StdClass)#%d (1) {
["x0"]=>
&object(stdClass)#%d (3) {
&object(StdClass)#%d (3) {
["y0"]=>
string(1) "b"
["y1"]=>
Expand Down
2 changes: 1 addition & 1 deletion Zend/tests/bug37144.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Bug #37144 (PHP crashes trying to assign into property of dead object)
--FILE--
<?php
function foo() {
$x = new stdClass();
$x = new StdClass();
$x->bar = array(1);
return $x;
}
Expand Down
2 changes: 1 addition & 1 deletion Zend/tests/bug37811.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class TestClass

define("Bar",new TestClass);
var_dump(Bar);
define("Baz",new stdClass);
define("Baz",new StdClass);
var_dump(Baz);

?>
Expand Down
2 changes: 1 addition & 1 deletion Zend/tests/bug39602.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ error_reporting=0
--FILE--
<?php
ini_set("session.save_handler","files");
$x = new stdClass();
$x = new StdClass();
echo "ok";
?>
--EXPECT--
Expand Down
6 changes: 3 additions & 3 deletions Zend/tests/bug43332_1.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ class foo {

$foo = new foo;
$foo->bar($foo); // Ok!
$foo->bar(new \stdclass); // Error, ok!
$foo->bar(new \StdClass); // Error, ok!
--EXPECTF--
Fatal error: Uncaught TypeError: 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:5
Fatal error: Uncaught TypeError: 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:5
Stack trace:
#0 %s(%d): foobar\foo->bar(Object(stdClass))
#0 %s(%d): foobar\foo->bar(Object(StdClass))
#1 {main}
thrown in %sbug43332_1.php on line 5
2 changes: 1 addition & 1 deletion Zend/tests/bug43332_2.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ class foo {

$foo = new foo;
$foo->bar($foo); // Ok!
$foo->bar(new stdclass); // Error, ok!
$foo->bar(new StdClass); // Error, ok!
--EXPECTF--
Fatal error: '\self' is an invalid class name in %sbug43332_2.php on line 5
2 changes: 1 addition & 1 deletion Zend/tests/bug47353.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class A
if(!isset($myArray[$i]))
$myArray[$i] = array();
$ref = & $myArray[$i];
$ref[] = new stdClass();
$ref[] = new StdClass();
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Zend/tests/bug48004.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ set_error_handler("error_handler");
test();
?>
--EXPECT--
stdClass Object
StdClass Object
(
[id] => 1
)
Loading