mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 18:46:17 +00:00
Fixed Set::merge warning when calling it from a static function
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6709 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
5321ce98ec
commit
586bcb8f28
2 changed files with 8 additions and 4 deletions
|
@ -76,7 +76,7 @@ class Set extends Object {
|
|||
function merge($arr1, $arr2 = null) {
|
||||
$args = func_get_args();
|
||||
|
||||
if (is_a($this, 'set')) {
|
||||
if (isset($this) && is_a($this, 'set')) {
|
||||
$backtrace = debug_backtrace();
|
||||
$previousCall = strtolower($backtrace[1]['class'].'::'.$backtrace[1]['function']);
|
||||
if ($previousCall != 'set::merge') {
|
||||
|
|
|
@ -41,8 +41,7 @@ class SetTest extends UnitTestCase {
|
|||
$this->assertIdentical(Set::diff($data, Set::extract($data, '{n}')), array('plugin' => null, 'controller' => '', 'action' => ''));
|
||||
}
|
||||
|
||||
function testEnum()
|
||||
{
|
||||
function testEnum() {
|
||||
$result = Set::enum(1, 'one, two');
|
||||
$this->assertIdentical($result, 'two');
|
||||
$result = Set::enum(2, 'one, two');
|
||||
|
@ -126,6 +125,11 @@ class SetTest extends UnitTestCase {
|
|||
$r = Set::merge('foo', 'bar');
|
||||
$this->assertIdentical($r, array('foo', 'bar'));
|
||||
|
||||
if (substr(phpversion(), 0, 1) >= 5) {
|
||||
$r = eval('class StaticSetCaller{static function merge($a, $b){return Set::merge($a, $b);}} return StaticSetCaller::merge("foo", "bar");');
|
||||
$this->assertIdentical($r, array('foo', 'bar'));
|
||||
}
|
||||
|
||||
$r = Set::merge('foo', array('user' => 'bob', 'no-bar'), 'bar');
|
||||
$this->assertIdentical($r, array('foo', 'user' => 'bob', 'no-bar', 'bar'));
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue