Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

--TEST-- Bug #77853: Inconsistent substr_compare behaviour with empty haystack --FILE-- <?..

Decoded Output download

--TEST--
Bug #77853: Inconsistent substr_compare behaviour with empty haystack
--FILE--
<?php

var_dump(substr_compare('', '', 0, 0));
var_dump(substr_compare('', '', 0));

var_dump(substr_compare('abc', '', 3, 0));
var_dump(substr_compare('abc', '', 3));

var_dump(substr_compare('abc', "", 3));

?>
--EXPECT--
int(0)
int(0)
int(0)
int(0)
int(-1)

Did this file decode correctly?

Original Code

--TEST--
Bug #77853: Inconsistent substr_compare behaviour with empty haystack
--FILE--
<?php

var_dump(substr_compare('', '', 0, 0));
var_dump(substr_compare('', '', 0));

var_dump(substr_compare('abc', '', 3, 0));
var_dump(substr_compare('abc', '', 3));

var_dump(substr_compare('abc', "\0", 3));

?>
--EXPECT--
int(0)
int(0)
int(0)
int(0)
int(-1)

Function Calls

substr_compare 1

Variables

None

Stats

MD5 2e5dd0a19d97950628617ce48e2610bf
Eval Count 0
Decode Time 85 ms