git.cweiske.de
/
phorkie.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
f81da3d
)
Avoid leaking file descriptor when looking for binary files
author
Christophe Coevoet
<stof@notk.org>
Fri, 6 Nov 2015 09:23:40 +0000
(10:23 +0100)
committer
Christian Weiske
<cweiske@cweiske.de>
Tue, 10 Nov 2015 05:32:35 +0000
(06:32 +0100)
src/phorkie/File.php
patch
|
blob
|
history
diff --git
a/src/phorkie/File.php
b/src/phorkie/File.php
index cf5daae30ac89f99df85a98ebff366c9e8a40686..97ae47e934e14d974ab062d0882ec478a603bfd8 100644
(file)
--- a/
src/phorkie/File.php
+++ b/
src/phorkie/File.php
@@
-200,9
+200,12
@@
class File
while (false !== ($char = fgetc($fp)) && ++$pos < 100) {
$data .= $char;
if (!$hasMb && ord($char) > 128) {
while (false !== ($char = fgetc($fp)) && ++$pos < 100) {
$data .= $char;
if (!$hasMb && ord($char) > 128) {
+ fclose($fp);
return false;
}
}
return false;
}
}
+ fclose($fp);
+
if (!$hasMb) {
return true;
}
if (!$hasMb) {
return true;
}