Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notice: Indirect modification of overloaded property ... has no effect #54

Closed
alexkag opened this issue May 18, 2013 · 1 comment
Closed
Milestone

Comments

@alexkag
Copy link

alexkag commented May 18, 2013

There is a class with protected property $tasks which is an array:

class TaskManager {

    protected $tasks = array();
}

There is also an advice which intercepts an access to this property:

    /**
     * Access interceptor
     * @param FieldAccess $property Joinpoint
     *
     * @Around("access(protected TaskManager->tasks)")
     * @return mixed
     */
    public function tasksChangeWatcher(FieldAccess $property) {
        static $tasksCount = 0;
        $value = $property->proceed();
        $tasksCnt = count($value);
        if ($tasksCount != $tasksCnt) {
            $tasksCount = $tasksCnt;
            Logger::getInstance()->addInfo("Number of tasks in the queue: $tasksCount");
        }
        return $value;
    }

During changing the value of this property in the application source code, php raises a warning:

Notice: Indirect modification of overloaded property TaskManager::$tasks has no effect in ...TaskManager.class.php on line 80

So if an advice applied to the private/protected property which is an array, then main source code cannot change it indirectly.

lisachenko added a commit that referenced this issue May 3, 2016
* origin/1.x:
  Fix spacing
  Rewrote property interceptors to be by reference and use trait for general logic, resolves #54, #232
@lisachenko
Copy link
Member

Implemented in #281

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants