All add-ons currently require PHP 7.4 or greater.

On July 4th 2024 PHP 8.2 will be the new minimum requirement for all add-ons. Expect any add-on released after that date to require 8.2 or greater. Some releases may not immediately take advantage of 8.x specific features in PHP, which means you might, be able to continue using new releases in PHP 7.4, however, if you experience an error the first thing you should do is update to PHP 8.2 then create a support ticket if the error persists.

Publisher does not support the Fluid field type. Please do not contact asking when support will be available.

If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.

Ticket: vsprintf deprecated AbstractController

Status Resolved
Add-on / Version Publisher Lite 3.10.3
Severity
EE Version 7.3.14

Ben Houghton

Dec 07, 2023

Using php 8.1

When I save any Publisher lite settings in the control panel I am greeted with a white page with a Deprecated error (see image attached). It points to line 547 in the AbstractController.php file which is:

->addToBody(vsprintf($callbackResponse->getSaveSuccessBody(), $callbackResponse->getMessageParameters() ?? []))

I don’t know if the bug is the fact that $callbackResponse->getSaveSuccessBody() is null in the first place but when I add a check as you have done for the second argument it all “seems” to work fine.

$callbackResponse->getSaveSuccessBody() ?? ''

If the null coalescing check is all that is needed could you please add this to your next release. If it is an issue where success body should never be null could you point me in the direction of a possible cause please.

Update: I have also come across a similar issue when uninstalling the add on: user/addons/publisher/Service/Session.php, line 1049. Setting null as the default value as null for the second argument of the setcookie call.

setcookie($this->prefix.$cookieName, null, -1);

causing: setcookie(): Passing null to parameter #2 ($value) of type string is deprecated  

 

#1

BoldMinded (Brian)

Comment has been marked private.

#2

Ben Houghton

Any settings in the control panel related to publisher, it is in the handleSubmit function. Is it that it is just failing silently for you? If we are both on php 8.x we should be seeing the same .

dev@87005b912505:/var/www/html$ php -v
PHP 8.1.26 (cli) (built: Nov 27 2023 23:13:04) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.26, Copyright (c) Zend Technologies
dev@87005b912505:/var/www/html$ php -r 'var_dump(vsprintf(null, []));'

Deprecated: vsprintf(): Passing null to parameter #1 ($format) of type string is deprecated in Command line code on line 1
string(0) ""
#3

BoldMinded (Brian)

Are you able to replicate this in a clean EE environment with only Publisher installed? Based on your other ticket it sounds like you have some custom stuff going on, and I just saved several settings pages without any errors.

#4

Ben Houghton

Hi Brain

Clean install of EE 7.3.14 with nothing but an admin account, clean install of Publisher Lite only (default add-ons untouched) and the problem remains unfortunately.

I am thinking it is a difference with php error level perhaps. If you run php -r ‘var_dump(vsprintf(null, []));’ in your cli do you see the same deprecated warning?

It is just the fact that this halts execution in the CMS and not just logging the error is the problem.

#5

BoldMinded (Brian)

I just switched to 8.1 and Publisher Lite and saved several settings pages without error. I don’t like making blind code changes without understanding the reason. I get the same deprecated warning if I run that php command, but why are you getting that when saving any settings page and I’m not? I also haven’t had similar reports, and when I don’t get multiple reports of the same thing and I’m unable to replicate it, it usually indicates something unique in the customers environment that I’m not privy to.

#6

BoldMinded (Brian)

I’m making the change to the vsprintf() call that you mentioned in the next release.

Login to reply