Arquivos
hhvm/hphp/test/quick/strlen_non_integer.php
T
Jordan DeLong 19562faabc Translator analyze assumed strlen($x) is always an int
This was leading to people getting (int)&some_null_variant as
the result of strlen.  I think this came about when we implemented the
5.4 strlen semantics (we stopped returning 5 for strlen(array()),
etc.)
2013-05-15 13:05:04 -07:00

35 linhas
476 B
PHP

<?php
function none() {}
set_error_handler('none');
class Foo {
}
function asdf($pattern) {
$len = strlen($pattern);
$len--;
echo $len;
echo "\n";
}
function main() {
$foo = new Foo();
for ($i=0; $i<100; $i++) {
asdf(new Foo());
asdf(array());
}
}
main();
main();
function main2() {
echo "foo: " .strlen($x)."\n";
echo "foo: " .strlen(true)."\n";
echo "foo: " .strlen(NULL)."\n";
echo "foo: " .strlen(false)."\n";
}
main2();
echo "done\n";