You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CI4: Return of an undefined variable in Token_customer model class #3454
It's an abstract public function that is declared in Token.php and implemented in each of the child classes including Token_customer.php
It's called in the replace_token() function in Token.php but replace_token is never called in the code.
It's called in the Token_lib parse() function
It's also called in the Token_lib resolve_token() function.
It only gets to that return statement (return $value;) in one of the below scenarios:
There's no customer assigned at the time of function call
customer_info is not empty
Both
Seems to me that if the customer_info is not empty we should return that value. If the customer_id is -1 we should return '';
Ok thanks for listing all this here @objecttothis .
I guess the implementation will only kick in once a user uses the variable that resolves to this token. We did not have any bug reports on this but this is obviously broken. I think the solution is as you suggest.
Activity
jekkos commentedon Apr 2, 2022
I wonder if the method is even used then?
objecttothis commentedon Apr 4, 2022
It's an abstract public function that is declared in Token.php and implemented in each of the child classes including Token_customer.php
It's called in the replace_token() function in Token.php but replace_token is never called in the code.
It's called in the Token_lib parse() function
It's also called in the Token_lib resolve_token() function.
It only gets to that return statement (
return $value;) in one of the below scenarios:Seems to me that if the customer_info is not empty we should return that value. If the customer_id is -1 we should
return '';jekkos commentedon Apr 5, 2022
Ok thanks for listing all this here @objecttothis .
I guess the implementation will only kick in once a user uses the variable that resolves to this token. We did not have any bug reports on this but this is obviously broken. I think the solution is as you suggest.
objecttothis commentedon Apr 12, 2022
Fixed in #3271
Add missing return value from #3454