neos / neos/flow-development-collection
AOP: JointPoint->hasMethodArgument does not recognize NULL
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 143
- Forks
- 191
- Avg merge
- 3d 12h
- Merged PRs (30d)
- 9
Description
Description
I created a aspect for tracking model changes (executing on every setter).
To assure that argument is passed, I check the jointPoint for the method-argument.
As the model attribute value has been changed from a value (e.g. object) to null, I would like to track that it changed. But: $joinPoint->isMethodArgument('propertyName') returns false. Although getArguments returns [propertyName => NULL]
The problem is here:
https://github.com/neos/flow-development-collection/blob/a2d086a2a38c369a455f2e7cb2449f7df4f09cb6/Neos.Flow/Classes/Aop/JoinPoint.php#L176
isset does return false, if value is set to NULL. Therfore, array_key_exists should be used:
public function isMethodArgument($argumentName)
{
return array_key_exists($argumentName, $this->methodArguments);
}
quickwin ;)
Expected behavior
JointPoint with arguments: ['myAttribute' => NULL]
Method isMethodArgument('myAttribute') should return true
Actual behavior
returns false
Affected Versions
Neos: latest (but code exists more than 2 years)
Flow: latest
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in Neos.Flow/Classes/Aop/JoinPoint.php at the isMethodArgument method and review how methodArguments is checked for a NULL value. Verify the reported case where getArguments contains myAttribute => NULL, and confirm that isMethodArgument('myAttribute') returns true afterward.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100