From:             scottmacvicar at ntlworld dot com
Operating system: All
PHP version:      4CVS-2004-01-14 (stable)
PHP Bug Type:     Scripting Engine problem
Bug description:  strlen returns values for non string types

Description:
------------
strlen will return a value for boolean types as well as a consitent value
of 5 for an array.

Reproduce code:
---------------
<?php

var_dump(strlen('foo')); // 3
var_dump(strlen(true)); // 1
var_dump(strlen(false)); // 0
var_dump(strlen(array('foo', 'bar'))); // 5

?>

Expected result:
----------------
string foo = int(3)
bool true = int(-1)
bool false = int(-1)
array('foo', 'bar') = int(-1)

Actual result:
--------------
string foo = int(3)
bool true = int(1)
bool false = int(0)
array('foo', 'bar') = int(5)

-- 
Edit bug report at http://bugs.php.net/?id=26906&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=26906&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=26906&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=26906&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=26906&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=26906&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=26906&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=26906&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=26906&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=26906&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=26906&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=26906&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=26906&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26906&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=26906&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=26906&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=26906&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=26906&r=float

Reply via email to