MFB: Added missing format validator to unpack() function

This commit is contained in:
Ilia Alshanetsky 2007-06-06 22:04:47 +00:00
parent 6a67784d22
commit 60a7d31254
2 changed files with 17 additions and 0 deletions

View File

@ -613,6 +613,12 @@ PHP_FUNCTION(unpack)
case 'd':
size = sizeof(double);
break;
default:
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid format type %c", type);
zval_dtor(return_value);
RETURN_FALSE;
break;
}
/* Do actual unpacking */

View File

@ -0,0 +1,11 @@
--TEST--
Invalid format type validation
--FILE--
<?php
var_dump(unpack("-2222", 1));
echo "Done\n";
?>
--EXPECTF--
Warning: unpack(): Invalid format type - in %s/unpack.php on line %d
bool(false)
Done