Skip to content

PHP 7.1에서 오류를 유발하는 Context 클래스의 $this 사용 제거#1954

Merged
1 commit merged into
xpressengine:developfrom
kijin:fix/php-7.1
Sep 5, 2016
Merged

PHP 7.1에서 오류를 유발하는 Context 클래스의 $this 사용 제거#1954
1 commit merged into
xpressengine:developfrom
kijin:fix/php-7.1

Conversation

@kijin

@kijin kijin commented Sep 2, 2016

Copy link
Copy Markdown
Contributor

PHP 7.1 RC1에서 XE를 실행하면 아래와 같은 오류가 발생합니다.

Fatal Error: Uncaught Error: Using $this when not in object context in classes/context/Context.class.php:842

예전에는 static으로 호출한 메소드에서도 $this를 일반 변수처럼 사용할 수 있었지만, 이제는 $this라고 쓰기만 해도 치명적인 오류가 발생하도록 바뀌었네요.

참고: https://secure.php.net/manual/en/migration71.other-changes.php (Inconsistency Fixes to $this)

이 문제를 해결하기 위해 Context 클래스에서 아래와 같은 코드가 등장하는 51군데를

is_a($this, 'Context') ? $self = $this : $self = self::getInstance();

모두 아래와 같이 변경합니다.

$self = self::getInstance();

@ghost ghost self-assigned this Sep 2, 2016
@ghost ghost added this to the 1.8.25 milestone Sep 2, 2016
@ghost ghost added the type/bug label Sep 2, 2016
@ghost ghost merged commit 3af23be into xpressengine:develop Sep 5, 2016
@kijin kijin deleted the fix/php-7.1 branch September 5, 2016 08:35
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant