?? ??? 2009, PHP 5.2.11
- Added missing sanity checks around exif processing (Ilia)
+- Fixed zlib.deflate compress filter to actually accpet level parameter. (Jani)
- Fixed leak on error in popen/exec (and related functions on Windows. (Pierre)
- Fixed bug #49361 (wordwrap() wraps incorrectly on end of line boundaries).
--- /dev/null
+--TEST--
+zlib.deflate (with level parameter set)
+--SKIPIF--
+<?php if (!extension_loaded("zlib")) print "skip"; ?>
+--FILE--
+<?php
+$text = 'I am the very model of a modern major general, I\'ve information vegetable, animal, and mineral.';
+
+$fp = fopen('php://stdout', 'w');
+stream_filter_append($fp, 'zlib.deflate', STREAM_FILTER_WRITE, array('level' => 9));
+fwrite($fp, $text);
+fclose($fp);
+
+?>
+--EXPECT--
+\1dËA\ e\80 \fDÑ«ÌÎ\8dñ\1e\1c£\86\ 11´M\1aBâíUv\7fñ_\82(ÆELÆ\ 3õÌ\ e/\90\95aP¹=Pi\fé;Ò6\89fÅCe4·\8fU\ e9;w\885ý\1f±\fm\v\1c/
if (filterparams) {
- zval **tmpzval;
+ zval **tmpzval, tmp;
/* filterparams can either be a scalar value to indicate compression level (shortcut method)
Or can be a hash containing one or more of 'window', 'memory', and/or 'level' members. */
case IS_ARRAY:
case IS_OBJECT:
if (zend_hash_find(HASH_OF(filterparams), "memory", sizeof("memory"), (void**) &tmpzval) == SUCCESS) {
- zval tmp;
-
tmp = **tmpzval;
zval_copy_ctor(&tmp);
convert_to_long(&tmp);
}
if (zend_hash_find(HASH_OF(filterparams), "window", sizeof("window"), (void**) &tmpzval) == SUCCESS) {
- zval tmp;
-
tmp = **tmpzval;
zval_copy_ctor(&tmp);
convert_to_long(&tmp);
}
if (zend_hash_find(HASH_OF(filterparams), "level", sizeof("level"), (void**) &tmpzval) == SUCCESS) {
+ tmp = **tmpzval;
+
/* Psuedo pass through to catch level validating code */
goto factory_setlevel;
}
case IS_STRING:
case IS_DOUBLE:
case IS_LONG:
- {
- zval tmp;
-
- tmp = *filterparams;
- zval_copy_ctor(&tmp);
- convert_to_long(&tmp);
+ tmp = *filterparams;
factory_setlevel:
- /* Set compression level within reason (-1 == default, 0 == none, 1-9 == least to most compression */
- if (Z_LVAL(tmp) < -1 || Z_LVAL(tmp) > 9) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid compression level specified. (%ld)", Z_LVAL(tmp));
- } else {
- level = Z_LVAL(tmp);
- }
+ zval_copy_ctor(&tmp);
+ convert_to_long(&tmp);
+
+ /* Set compression level within reason (-1 == default, 0 == none, 1-9 == least to most compression */
+ if (Z_LVAL(tmp) < -1 || Z_LVAL(tmp) > 9) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid compression level specified. (%ld)", Z_LVAL(tmp));
+ } else {
+ level = Z_LVAL(tmp);
}
break;
default: