-
Notifications
You must be signed in to change notification settings - Fork 7.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test to function zlib_get_coding_type(void); #1815
Conversation
was add new coverage test to module zlib;
This test doesn't seem to be very useful if it's always returning false. |
Looks like this function is supposed to be used in conjunction with |
@smalyshev thanks for your comments!!! |
marcosptf - <marcosptf@yahoo.com.br> - @phpsp - sao paulo - br | ||
--SKIPIF-- | ||
<?php | ||
if (phpversion() < "5.3.0") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do not even support PHP 5.3, so this SKIPIF should not be there. Active branches are: 5.6, 7.0, 7.1 and master (7.2)
Hi PHP Masters!!! i've fixed this code like you suggest, its correct ? Thanks |
print($codingType); | ||
?> | ||
--CLEAN-- | ||
<?php |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The --CLEAN-- section is not needed for variable unsets, its a separate generated file after the phpt is executed. It is commonly used to remove temporary files and similar
--CREDITS-- | ||
marcosptf - <marcosptf@yahoo.com.br> - @phpsp - sao paulo - br | ||
--SKIPIF-- | ||
<?php |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
zlib_get_coding_type() is available as of PHP 4.3.2, so the --SKIPIF-- section should be changed to reflect whether or not the zlib extension is loaded e.g.:
if (!extension_loaded('zlib')) {
print 'skip: zlib extension not available';
}
or similar
$compressionCoding = zlib_get_coding_type(); | ||
$codingType = "get zlib type error"; | ||
|
||
if((!$compressionCoding) || ("gzip" == $compressionCoding) || ("deflate" == $compressionCoding)){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems a little odd to check for all 3 return values here? Since the suite is executed on CLI, then this value will always be false unless otherwise defined by a HTTP request header which do not occur when using make test (and zlib.compression must be set to On in php.ini).
Since make test only supports --POST-- variables to be sent, but not modifications of $_SERVER variables, meaning we cannot really get a meaningful value of testing this function unless we somehow can modify $_SERVER. The zlib extension will initialize ZLIBG(compression_coding) at RINIT, which zlib_get_coding_type() uses, meaning we cannot override $_SERVER before calling zlib_get_coding_type(), so the result will always be false.
I added some inline comments. The TL;DR version is that I don't think it makes much sense since the return value we get is always false, and only really makes sense to commit if we are going for gcov coverage |
if (phpversion() < "5.6.0") { | ||
die('SKIP php version so lower.'); | ||
} | ||
if(!extension_loaded('zlib')) die('skip, zlib not loader'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ITYM not loaded
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@smalyshev
fixed!
Consensus seems to be that this is not a worth while test, so closing this PR. If the test can be written to add value, please take this action as encouragement to do so. |
was add new coverage test to module zlib;