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

$rbac->EntityType->AddPath(): Would like to find alternative to assert() #5

Closed
jburns131 opened this issue Aug 21, 2013 · 3 comments
Closed
Assignees

Comments

@jburns131
Copy link
Collaborator

I would like to find an alternative error handler to the call to assert.

@abiusx
Copy link
Contributor

abiusx commented Aug 22, 2013

this assert should logically never fail. have you found a case?


Notice: This message is digitally signed, its source and integrity are verifiable.
If you mail client does not support S/MIME verification, it will display a file (smime.p7s), which includes the X.509 certificate and the signature body. Read more at Certified E-Mail with Comodo and Thunderbird in AbiusX.com

On Mordad 31, 1392, at 2:35 AM, Jesse Burns notifications@github.com wrote:

I would like to find an alternative error handler to the call to assert.


Reply to this email directly or view it on GitHub.

@jburns131
Copy link
Collaborator Author

If you pass a string that does not have a leading slash to the first argument of AddPath the assert fails and issues a php warning.

Example:

$rbac->Roles->AddPath('roles_1');

Result:

Warning: assert(): Assertion failed in /path/to/lib/rbac.php on line 210

My Thoughts/Proposed Solutions:

I think there are two ways we can go with this:

  • Add a leading slash if there is one missing and continue execution
  • Keep the "leading slash" requirement and replace the assert with production level error handling, i.e. throw an Exception that can be handled properly if so desired by PhpRbac users

@abiusx
Copy link
Contributor

abiusx commented Aug 23, 2013

its a good choice, throw the exception and update phpdoc


Notice: This message is digitally signed, its source and integrity are verifiable.
If you mail client does not support S/MIME verification, it will display a file (smime.p7s), which includes the X.509 certificate and the signature body. Read more at Certified E-Mail with Comodo and Thunderbird in AbiusX.com

On Shahrivar 1, 1392, at 7:55 AM, Jesse Burns notifications@github.com wrote:

If you pass a string that does not have a leading slash to the first argument of AddPath the assert fails and issues a php warning.

Example:

$rbac->Roles->AddPath('roles_1');
Result:

Warning: assert(): Assertion failed in /path/to/lib/rbac.php on line 210
My Thoughts/Proposed Solutions:

I think there are two ways we can go with this:

Add a leading slash if there is one missing and continue execution
Keep the "leading slash" requirement and replace the assert with production level error handling, i.e. throw an Exception that can be handled properly if so desired by PhpRbac users

Reply to this email directly or view it on GitHub.

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

No branches or pull requests

2 participants