Skip to content

Commit

Permalink
set_error_handler $array_context deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesHeinrich committed Dec 3, 2020
1 parent d869456 commit a331342
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion getid3/getid3.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ class getID3
*/
protected $startup_warning = '';

const VERSION = '1.9.20-202010211809';
const VERSION = '1.9.20-202012031023';
const FREAD_BUFFER_SIZE = 32768;

const ATTACHMENTS_NONE = false;
Expand Down
7 changes: 2 additions & 5 deletions getid3/module.graphic.jpg.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,14 @@ public function Analyze() {
if (substr($imageinfo['APP1'], 0, 4) == 'Exif') {
//$this->warning('known issue: https://bugs.php.net/bug.php?id=62523');
//return false;
set_error_handler(function($errno, $errstr, $errfile, $errline, array $errcontext) {
set_error_handler(function($errno, $errstr, $errfile, $errline) { // https://github.com/JamesHeinrich/getID3/issues/275
if (!(error_reporting() & $errno)) {
// error is not specified in the error_reporting setting, so we ignore it
return false;
}

$errcontext['info']['warning'][] = 'Error parsing EXIF data ('.$errstr.')';
$this->warning('Error parsing EXIF data ('.$errstr.')');
});

$info['jpg']['exif'] = exif_read_data($info['filenamepath'], null, true, false);

restore_error_handler();
} else {
$this->warning('exif_read_data() cannot parse non-EXIF data in APP1 (expected "Exif", found "'.substr($imageinfo['APP1'], 0, 4).'")');
Expand Down

0 comments on commit a331342

Please sign in to comment.