Moin Marcus!
Marcus Boerger schrieb:
to be honest this is the wrong way. The correct way of fixing this is to
have PHP 6 name it correct: string and binary. And to have b for binary
prefix rather then u for unicode. Or did PHP 6 change in the meanwhile and
we support u"Nonsense" besides b"Binary"?
I'm not sure if a change to PHP would help solving the original question
on portable tests which I raised on the QA list. I asked for a way to
write "portable" tests. That is a test which can be run on both PHP 5
and PHP 6 -- one file for both PHP 5 and PHP 6 (like in early PHP 6 days
with UEXPECTF), not two versions that need to be kept in sync (like
nowadays).
Currently we have:
PHP 5
var_dump("PHP" . chr(0) . " rocks!") --> string(9) "PHProcks"
var_dump((binary)"PHP" . chr(0) . " rocks!") --> string(9) "PHProcks"
PHP 6
var_dump("PHP" . chr(0) . " rocks!") --> unicode(9) "PHProcks"
var_dump((binary)"PHP" . chr(0) . " rocks!") --> unicode(9) "PHProcks"
The patch to run-tests.php allows you to use in your EXPECTF or
EXPECTREGEXP section:
%unicode|string%(9) "PHProcks"
With PHP 5, run-tests.php will search for string(9) "PHProcks" and with
PHP 6 it will search for unicode(9) "PHProcks": one EXPECTF section, one
test file for both PHP 5 and PHP 6.
If I get you right, you suggest that it should read as follows in PHP 6:
var_dump("PHP" . chr(0) . " rocks!") --> string(9) "PHProcks"
var_dump((binary)"PHP" . chr(0) . " rocks!") --> binary(9) "PHProcks"
This may be correct and desired. However, if you change it, I'm back to
my question: is there a way to write a "portable" test?
Ulf
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php