Просмотр исходного кода

version_compare raise exception if param is not a string (#6155)

* in file "metadata.json" it's possible that the data of version is not a string. in this case the check of the version raise an exception.

* Apply suggestions from code review

---------

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
Clemens Neubauer 2 лет назад
Родитель
Сommit
9711f1477d
1 измененных файлов с 2 добавлено и 2 удалено
  1. 2 2
      app/views/extension/index.phtml

+ 2 - 2
app/views/extension/index.phtml

@@ -61,11 +61,11 @@
 						<td>
 							<?= $ext['description'] ?>
 							<?php if (isset($this->extensions_installed[$ext['name']])) { ?>
-								<?php if (version_compare($this->extensions_installed[$ext['name']], $ext['version']) >= 0) { ?>
+								<?php if (version_compare(strval($this->extensions_installed[$ext['name']]), strval($ext['version'])) >= 0) { ?>
 									<span class="alert alert-success">
 										<?= _t('admin.extensions.latest') ?>
 									</span>
-								<?php } elseif ($this->extensions_installed[$ext['name']] != $ext['version']) { ?>
+								<?php } elseif (strval($this->extensions_installed[$ext['name']]) !== strval($ext['version'])) { ?>
 									<span class="alert alert-warn">
 										<?= _t('admin.extensions.update') ?>
 									</span>