Edit report at https://bugs.php.net/bug.php?id=55092&edit=1
ID: 55092 Updated by: [email protected] Reported by: brent_hathaway at yahoo dot com Summary: settype bug -Status: Open +Status: Bogus Type: Bug Package: Unknown/Other Function Operating System: Linux PHP Version: 5.3.6 Block user comment: N Private report: N New Comment: settype() returns true or false, not the modified variable: it takes the given variable by reference and modifies it in-place. As a result, you're testing the return value (which is expected to be boolean) and not the modified $z, which is overwritten. Previous Comments: ------------------------------------------------------------------------ [2011-06-30 17:11:26] brent_hathaway at yahoo dot com Description: ------------ --- >From manual page: http://www.php.net/function.settype --- The version is actually 5.3.5 but is not in the dropdown When using settype on an integer it will not respond as an integer in is_int. Test script: --------------- $z = 5; //int by default $z = settype($z,"int"); //unneeded but shows bug if (is_int($z)) { echo "int"; } else { echo "not int"; } //output: not int use instead: $z = intval($z); //output: int Expected result: ---------------- int Actual result: -------------- not int ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=55092&edit=1
