Skip to content

Conversation

@BuslikDrev
Copy link
Contributor

No description provided.

@bsweeney
Copy link
Member

I'm not receiving any deprecation notices about the return type, what's triggering the notice for you? Is this from static analysis?

Regardless, wouldn't it make more sense to specify the return types as we did for the Dompdf iterator (dompdf/dompdf@981c1b9)?

@BuslikDrev
Copy link
Contributor Author

BuslikDrev commented Dec 19, 2024

I'm not receiving any deprecation notices about the return type, what's triggering the notice for you? Is this from static analysis?

Regardless, wouldn't it make more sense to specify the return types as we did for the Dompdf iterator (dompdf/dompdf@981c1b9)?

php 8.1 OpenServer
ini_set("display_errors", 1);
ini_set("display_startup_errors", 1);
ini_set('error_reporting', E_ALL);

@bsweeney
Copy link
Member

bsweeney commented Dec 20, 2024

Yes, I have those settings as noted but still do not get the warnings. Unit tests also don't generate anything. I'd like to be able to ensure warnings like these are displayed on my system so I can catch them earlier.

@bsweeney bsweeney added this to the 1.0.2 milestone Dec 20, 2024
@BuslikDrev BuslikDrev closed this Dec 22, 2024
@BuslikDrev BuslikDrev reopened this Dec 22, 2024
@BuslikDrev
Copy link
Contributor Author

Yes, I have those settings as noted but still do not get the warnings. Unit tests also don't generate anything. I'd like to be able to ensure warnings like these are displayed on my system so I can catch them earlier.

К сожалению я не могу сказать из-за чего у вас не показывает. Всё зависит от программ которые используете. Возможно они выключают уровень уведомления об устаревании функции php.

image

			foreach (glob(DIR_SYSTEM . 'library/bus_cache/FontLib/*.php', GLOB_BRACE) as $f) {
				include_once($f);
			}

			include_once(DIR_SYSTEM . 'library/bus_cache/FontLib/Table/DirectoryEntry.php');
			include_once(DIR_SYSTEM . 'library/bus_cache/FontLib/TrueType/TableDirectoryEntry.php');
			include_once(DIR_SYSTEM . 'library/bus_cache/FontLib/TrueType/File.php');
			include_once(DIR_SYSTEM . 'library/bus_cache/FontLib/TrueType/Header.php');

			foreach (glob(DIR_SYSTEM . 'library/bus_cache/FontLib/*{/*,/*/*}.php', GLOB_BRACE) as $f) {
				include_once($f);
			}

			$ajax['success_file'] = array();

			$files = array(
				//'view/theme/disco/stylesheet/font-awesome/5.15.1/webfonts/fa-brands-400.eot',
				//'view/theme/disco/stylesheet/font-awesome/5.15.1/webfonts/fa-brands-400.svg',
				//'view/theme/disco/stylesheet/font-awesome/5.15.1/webfonts/fa-brands-400.ttf',
				'view/theme/disco/stylesheet/font-awesome/5.15.1/webfonts/fa-brands-400.woff',
				//'view/theme/disco/stylesheet/font-awesome/5.15.1/webfonts/fa-brands-400.woff2',
				//'view/theme/disco/stylesheet/font-awesome/5.15.1/webfonts/3333.ttf'
			);

			foreach ($files as $file) {
				$file = DIR_CATALOG . $file;

				if (is_file($file)) {
					$file_new = str_replace(array('.eot', '.svg', '.ttf', '.woff', '.woff2'), array('-bus_cache.eot', '-bus_cache.svg', '-bus_cache.ttf', '-bus_cache.woff', '-bus_cache.woff2'), $file);

					// создаём копию оригинала, чтобы не навредить
					copy($file, $file_new);

					// открываем для чтения копию оригинала
					$font = (new FontLib\Font())->load($file_new);
				}
			}

			// чистим временные файлы
			foreach (glob(sys_get_temp_dir() . '/*') as $file) {
				if (is_file($file) && substr(basename($file), 0, 3) == 'fnt') {
					unlink($file);
				}
			}

@bsweeney
Copy link
Member

bsweeney commented Jan 1, 2026

I am able to reproduce the warnings. Possible I neglected to test with a font collection previously in which case 🤦.

I am still inclined to conform to the implementation rather than suppress errors by annotating a change to the return type.

@bsweeney
Copy link
Member

bsweeney commented Jan 18, 2026

See the changes in #156 as an alternative. Now that I think about it, perhaps I should just apply those changes on top of yours in this PR rather than do this as a completely separate PR. Or maybe use this for 1.0.2 and the interface compatibility change for 2.0.0.

@BuslikDrev
Copy link
Contributor Author

Or maybe use this for 1.0.2 and the interface compatibility change for 2.0.0.

Решать вам. Я для широкой совместимости php 5.4-8.4 просто подавляю сообщения. Вы можете идти в ногу со временем и писать код для php 8+. Исходите от статистики сайтов, которые используют ту или иную версию PHP. Звучит хорошо, если для версии 2.0.0 будет минимальная поддержка php8+, а также будете поддерживать 1.0.2 (php 5.4 - 7.4) пока их используют сайты до определённого момента вашего решения о прекращении поддержки библиотеки 1.0.2.

@bsweeney
Copy link
Member

SvgLib already specified a lower limit of PHP 7.1. Possible it works on versions below that, but I don't bother testing anymore. I think I'll release with this change now and the updated return type hinting in a future release. Thanks for your help/thoughts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants