From: Ilia Alshanetsky Date: Wed, 6 Jun 2007 22:04:47 +0000 (+0000) Subject: MFB: Added missing format validator to unpack() function X-Git-Tag: BEFORE_IMPORT_OF_MYSQLND~502 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=60a7d31254b3d9b95fbf262524058124b82e1327;p=php MFB: Added missing format validator to unpack() function --- diff --git a/ext/standard/pack.c b/ext/standard/pack.c index a70c5f8ebe..1065a46ac5 100644 --- a/ext/standard/pack.c +++ b/ext/standard/pack.c @@ -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 */ diff --git a/ext/standard/tests/strings/unpack.phpt b/ext/standard/tests/strings/unpack.phpt new file mode 100644 index 0000000000..f843dab878 --- /dev/null +++ b/ext/standard/tests/strings/unpack.phpt @@ -0,0 +1,11 @@ +--TEST-- +Invalid format type validation +--FILE-- + +--EXPECTF-- +Warning: unpack(): Invalid format type - in %s/unpack.php on line %d +bool(false) +Done \ No newline at end of file