Skip to content

Remove XFAIL from sibling method call test #8482

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

Merged
merged 1 commit into from
May 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 46 additions & 7 deletions Zend/tests/access_modifiers_008.phpt
Original file line number Diff line number Diff line change
@@ -1,21 +1,60 @@
--TEST--
Inconsistencies when accessing protected members
--XFAIL--
Discussion: http://marc.info/?l=php-internals&m=120221184420957&w=2
--FILE--
<?php

class A {
static protected function f() {return 'A::f()';}
static protected function ma() {
return 'A::ma()';
}

static private function mp() {
return 'A::mp()';
}
}

class B1 extends A {
static protected function f() {return 'B1::f()';}
static protected function ma() {
return 'B1::ma()';
}

static protected function mp() {
return 'B1::mp()';
}

static protected function mb() {
return 'B1::mb()';
}
}

class B2 extends A {
static public function test() {echo B1::f();}
static public function test() {
echo A::ma() . "\n";
try {
echo A::mp() . "\n";
} catch (\Throwable $e) {
echo $e->getMessage() . "\n";
}
echo B1::ma() . "\n"; // protected method defined also in A
try {
echo B1::mp() . "\n"; // protected method defined also in A but as private
} catch (\Throwable $e) {
echo $e->getMessage() . "\n";
}
try {
echo B1::mb() . "\n";
} catch (\Throwable $e) {
echo $e->getMessage() . "\n";
}
}
}

B2::test();

?>
--EXPECTF--
Fatal error: Call to protected method B1::f() from scope B2 in %s on line %d
--EXPECT--
A::ma()
Call to private method A::mp() from scope B2
B1::ma()
Call to protected method B1::mp() from scope B2
Call to protected method B1::mb() from scope B2
52 changes: 42 additions & 10 deletions Zend/tests/access_modifiers_009.phpt
Original file line number Diff line number Diff line change
@@ -1,26 +1,58 @@
--TEST--
Inconsistencies when accessing protected members - 2
--XFAIL--
Discussion: http://marc.info/?l=php-internals&m=120221184420957&w=2
Inconsistencies when accessing protected members - is_callable
--FILE--
<?php

class A {
static protected function f() {return 'A::f()';}
static protected function ma() {
return 'A::ma()';
}

static private function mp() {
return 'A::mp()';
}
}

class B1 extends A {
static protected function f() {return 'B1::f()';}
static protected function ma() {
return 'B1::ma()';
}

static protected function mp() {
return 'B1::mp()';
}

static protected function mb() {
return 'B1::mb()';
}
}

class B2 extends A {
static public function test() {
var_dump(is_callable('B1::f'));
B1::f();
var_dump(is_callable('A::ma'));
var_dump(is_callable('A::mp'));
var_dump(is_callable('B1::ma')); // protected method defined also in A
var_dump(is_callable('B1::mp')); // protected method defined also in A but as private
var_dump(is_callable('B1::mb'));
}
}

var_dump(is_callable('B2::ma'));
var_dump(is_callable('B2::mp'));
var_dump(is_callable('B2::mb'));
var_dump(is_callable('B2::test'));
echo '----' . "\n";
B2::test();

?>
--EXPECTF--
--EXPECT--
bool(false)
bool(false)
bool(false)
bool(true)
----
bool(true)
bool(false)
bool(true)
bool(false)
bool(false)

Fatal error: Call to protected method B1::f() from scope B2 in %s on line %d