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

preg_match warning thrown if xdebug.scream=1 #50

Closed
robertbasic opened this issue Jan 28, 2012 · 2 comments
Closed

preg_match warning thrown if xdebug.scream=1 #50

robertbasic opened this issue Jan 28, 2012 · 2 comments

Comments

@robertbasic
Copy link
Collaborator

Hello!

If one has xdebug.scream turned on, preg_match in some cases can throw a warning.

A test for this can be found at robertbasic@d9d8dfa

Now, I know that I'm expecting "bar" and "baz" there, and providing "spam" and "ham" instead, but, the problem is that the preg_match warning masks the real error: "Mockery\Exception: No matching handler found for ...", which produces a lot of head-scratching to figure out what is going on.

The offending preg_match is in Mockery\Expectation::_matchArg, around line 278.

@robertbasic
Copy link
Collaborator Author

This was added by @padraic in this commit 5230537 so I'm closing this one.

@SammyK
Copy link

SammyK commented Mar 22, 2014

Not to kick a two-year-old-dead horse, but! :) I just spent 8 hours of my life trying to figure out why my unit tests were kicking out a:

ErrorException: preg_match(): Delimiter must not be alphanumeric or backslash

The final solution was to turn off xdebug's scream option.

So... is there a better way to handle the preg_match()'s in the Expectation class without using the nasty @ error suppressor? Maybe just some simple strpos() checks for the required regex delimiters or something? Sorry, I'm not familiar with the code enough to know if this is just an impossibility.

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

No branches or pull requests

2 participants