Files
crm.clientright.ru/suppress_ghostscript_errors.php

30 lines
1.0 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
/**
* Скрипт для подавления ошибок Ghostscript
* Подключается в начале основных скриптов
*/
// Функция для подавления ошибок Ghostscript
function suppressGhostscriptErrors($errno, $errstr, $errfile, $errline) {
// Подавляем только ошибки Ghostscript
if (strpos($errstr, 'GPL Ghostscript') !== false &&
strpos($errstr, 'Unrecoverable error') !== false) {
return true; // Подавляем ошибку
}
// Остальные ошибки обрабатываем как обычно
return false;
}
// Устанавливаем обработчик ошибок
set_error_handler('suppressGhostscriptErrors');
// Также подавляем stderr для процессов Ghostscript
if (function_exists('proc_open')) {
// Перенаправляем stderr в /dev/null для команд с gs
ini_set('log_errors', 1);
ini_set('error_log', '/dev/null');
}
?>