From: miklcct at gmail dot com Operating system: Ubuntu 9.10 PHP version: 5.3.1 PHP Bug Type: Strings related Bug description: stripos returns FALSE for empty string used as needle
Description: ------------ The function stripos() returns FALSE when a empty string is used. Consider the example below, an empty string is used and it is found at position 0. It is misleading (at least theoretically) that an empty string is not found inside another string. Reproduce code: --------------- <?php var_dump(stripos('test', 'te')); var_dump(stripos('test', 't')); var_dump(stripos('test', '')); var_dump(stripos('test', 'es', 1)); var_dump(stripos('test', 'e', 1)); var_dump(stripos('test', '', 1)); var_dump(stripos('test', '', 2)); var_dump(stripos('', '')); ?> Expected result: ---------------- int(0) int(0) int(0) int(1) int(1) int(1) int(2) int(0) Actual result: -------------- int(0) int(0) bool(false) int(1) int(1) bool(false) bool(false) bool(false) -- Edit bug report at http://bugs.php.net/?id=50710&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=50710&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=50710&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=50710&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=50710&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=50710&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=50710&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=50710&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=50710&r=needscript Try newer version: http://bugs.php.net/fix.php?id=50710&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=50710&r=support Expected behavior: http://bugs.php.net/fix.php?id=50710&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=50710&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=50710&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=50710&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50710&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=50710&r=dst IIS Stability: http://bugs.php.net/fix.php?id=50710&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=50710&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=50710&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=50710&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=50710&r=mysqlcfg