Bug #28638

Signals can't be defined in abstract classes

Added by Bastian Waidelich about 10 years ago. Updated about 10 years ago.

Status:
Resolved
Priority:
Should have
Assignee:
Category:
AOP
Start date:
2011-08-01
Due date:
% Done:

100%

Estimated time:
PHP Version:
Has patch:
Complexity:

Description

The AOP ProxyClassBuilder produces invalid code when signals are defined in an abstract class.

Steps to reproduce:

AbstractSignalTest.php
<?php
namespace Foo\Bar;
abstract class AbstractSignalTest {

    public function testSignal() {
        $this->emitTestSignal();
    }

    /**
     * @signal
     */
    public function emitTestSignal() {}
}

?>

SignalTest.php
<?php namespace Foo\Bar; class SignalTest extends AbstractSignalTest { } ?>
In some controller:
$signalTest = new \Foo\Bar\SignalTest(); $signalTest->testSignal();

Result:

#1: Notice: Undefined index: emitTestSignal in Development\Cache\Code\FLOW3_Object_Classes\Foo_Bar_AbstractSignalTest.php line 98

The problem is, that the proxy code tries to access $this->FLOW3_AOP_Proxy_targetMethodsAndGroupedAdvices which is declared private.

Also available in: Atom PDF