hsluoyz commented on issue #154:
URL: 
https://github.com/apache/casbin-lua-casbin/issues/154#issuecomment-5205182358

   Fixed in: 
https://github.com/apache/casbin-lua-casbin/commit/711cb48cdaeb2730304fad7cc5b41d06869111d0
   
   Thanks for the report, this was a real bug. `keyMatch4()` translated Go's 
`FindStringSubmatch` incorrectly: in Lua, `string.match()` returns the whole 
match when the pattern has no captures, so any `p.obj` without a `{token}` 
(like `data1`) ended up with 0 tokens vs. 1 "value" and threw `KeyMatch4: 
number of tokens is not equal to number of values`. That error was then masked 
by `err.message` being `nil`, which is the confusing traceback you saw.
   
   `keyMatch4()` now anchors the pattern and handles the no-token case, 
evaluation errors are reported correctly whether they come from luaxp or from a 
matcher function, and `keyMatch5` (which was wired to `keyMatch4Func` by 
mistake) now points at its own implementation. Regression tests plus a 
`rbac_with_keymatch4_model.conf` example were added.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to