Skip to content

Static property access pointcut does not trigger on a static property read or write join point and advice is not executed #91

@tonix-tuft

Description

@tonix-tuft

Hi,

In the following PHP code:

class Developper
{
    public $preferences;    
    public static $staticVar;   
}

aop_add_before('Developper::staticVar', function() { echo "ACCESS"; });

$developer = new Developper();
$developer::$staticVar = "value"; // as of PHP 5.3.0
Developper::$staticVar = "new value";

The expected output should be:

ACCESS
ACCESS

However, the advice doesn't get executed in any of the two cases.

Neither the following code works:

                                             // using '->' instead of '::'
aop_add_before('Developper->staticVar', function() { echo "ACCESS"; });

$developer = new Developper();
$developer::$staticVar = "value"; // as of PHP 5.3.0
Developper::$staticVar = "new value";

Have you encountered this static property access, read, write issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions