Skip to content
This repository has been archived by the owner on Dec 16, 2019. It is now read-only.

Allow Volatile::extend() to work as expected #874

Merged
merged 1 commit into from
Aug 31, 2018
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion classes/threaded.h
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ PHP_METHOD(Threaded, extend) {
if (is_final)
ce->ce_flags = ce->ce_flags &~ ZEND_ACC_FINAL;

parent = zend_get_executed_scope();
parent = zend_get_called_scope(EG(current_execute_data));

zend_do_inheritance(ce, parent);

Expand Down
23 changes: 23 additions & 0 deletions tests/runtime-inheritance-volatile.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
--TEST--
Test runtime extension of Volatile
--DESCRIPTION--
This test verifies that extend() applies the scope it was called in, not executed in
--FILE--
<?php
class Other {}

class Test extends Other {
public function one() {}
}

/* force zend to declare Other extends Volatile */
Volatile::extend("Other");

$test = new Test();

var_dump($test instanceof Volatile,
$test instanceof Other);
?>
--EXPECT--
bool(true)
bool(true)