Skip to content

Commit

Permalink
Fixing deprecated usage - adding cast to string and tags size check
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanviduka committed May 13, 2024
1 parent 0ed56f1 commit 37969c8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Model/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ public function uploadSnippet($version, array $snippet)
if (isset($snippet['content'])) {
$adminUrl = $this->vcl->getAdminFrontName();
$adminPathTimeout = $this->config->getAdminPathTimeout();
$ignoredUrlParameters = $this->config->getIgnoredUrlParameters();
$ignoredUrlParameters = (string)$this->config->getIgnoredUrlParameters();

if ($ignoredUrlParameters === "") {
$queryParameters = '&';
Expand Down
5 changes: 4 additions & 1 deletion Model/ResponsePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@ public function aroundSetHeader(Http $subject, callable $proceed, $name, $value,
// Make the necessary adjustment
$value = $this->cacheTags->convertCacheTags(str_replace(',', ' ', $value));
$tagsSize = $this->config->getXMagentoTagsSize();
if (strlen($value) > $tagsSize) {

if ($tagsSize === 0) {
$value = "";
} else if (strlen($value) > $tagsSize) {
$trimmedArgs = substr($value, 0, $tagsSize);
$value = substr($trimmedArgs, 0, strrpos($trimmedArgs, ' ', -1));
}
Expand Down

0 comments on commit 37969c8

Please sign in to comment.