Marcus Boerger wrote:
Hello Nuno,

Thursday, September 13, 2007, 9:20:51 PM, you wrote:

  now i get the issue. It grabbs more than one line! This means
run-tests.php has to be fixed. The whole thing is designed under
the assumption that %s catches no new lines and hence only one
line.
That would be the best answer but I think it's a difficult fix and whatever it was might break other tests. I think it would mean replacing %s with something other than .+?. I'll have a look tomorrow and see if I can find a regex that would do - one of the things that had me confused for a while was that I thought the ? (non-greedy qualifier) should guarentee the minimum match but it doesn't work quite like that.


OK, so basically it is impossible to fix the current regex to match what we want (I had a quick chat with the PCRE author and he thinks the same). I propose the following patch: http://web.ist.utl.pt/nuno.lopes/php_run_tests_%s.txt

The main changes are:
'%s' => '[^\r\n]+'

Nice patch! The only thing i wonder about is why you disallow /r. Shouldn't
we allow it to prevent problems? Or is it enough to take care of it only at
line endings, and if so where are we doing that?

best regards
marcus

It is a nice patch - but I'm seeing some errors that I don't understand yet when I use it - like this:

Warning: preg_match(): Compilation failed: missing terminating ] for character class at offset 5 in /home/zoe/BUILDS/php52/run-tests.php on line 1609

I'm not having the best afternoon :-( - so this is probably something I'm doing wrong - does anyone else see it?

Zoe
'%a' => '.+'

This means that some tests have to be fixed, but the majority passes. Most important is that with this patch I found some tests that had the expected output wrong.

So unless someone rejects this patch, I'll commit it (and update the http://qa.php.net/write-test.php page too). Anyway, I don't think that a function name should be replaced by %s. The expected output should be as stricter as possible.


Nuno



Best regards,
 Marcus



--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to