From liam.gretton at leicester.ac.uk Thu May 23 15:12:07 2024 From: liam.gretton at leicester.ac.uk (Gretton, Liam) Date: Thu, 23 May 2024 14:12:07 +0000 Subject: [ZendTo] Max subject length problem in dropoff requests References: Message-ID: Hi, When creating a dropoff request, if the subject is greater than $maxSubjectLength characters in length, ZendTo will crash with a 500 server error, and the following report: [23-May-2024 13:35:46 UTC] PHP Warning: Undefined variable $d in /local/www/ZendTo-6.13-3/lib/Req.php on line 343 [23-May-2024 13:35:46 UTC] PHP Warning: Undefined variable $d in /local/www/ZendTo-6.13-3/lib/Req.php on line 343 [23-May-2024 13:35:46 UTC] PHP Fatal error: Uncaught ValueError: Unknown format specifier " " in /local/www/ZendTo-6.13-3/lib/Req.php:343 Stack trace: #0 /local/www/ZendTo-6.13-3/lib/Req.php(343): sprintf('Your subject li...', 145, 100) #1 /local/www/ZendTo-6.13-3/lib/Req.php(85): Req->initWithFormData('me at example.com') #2 /local/www/ZendTo-6.13-3/www/req.php(370): Req->__construct(Object(NSSDropbox), 'me at example.com') #3 {main} thrown in /local/www/ZendTo-6.13-3/lib/Req.php on line 343 The culprit is line 343 of Req.php: if ($subjectlength>$maxlen) { return sprintf(gettext("Your subject line to the recipients is %1$d characters long. It must be less than %2$d."), $subjectlength, $maxlen).' '.$BACKBUTTON; } Firstly it seems that the double-quotes around the string causes the printf format specifiers to fail. Change those to single quotes and the problem changes. The page no longer causes a 500 error but reports a friendlier 'Request Error' without actually explaining what the problem is. The 'Your subject line to the recipients ... is too long' message is not included. Removing the check altogether allows the request to complete, so it doesn't appear that the max character subject limit is necessarily a problem. I've only been testing with a max length of about 100 characters though. Not a show stopper, I've just bumped up the value of $maxSubjectLength in preferences.php from 100 to 200 in our case. My installation is running ZendTO 6.13-3 on CentOS 7 with our own build of PHP 8.2. Regards, Liam Liam Gretton Research Technology Services Manager Digital Services, University of Leicester | University Road | Leicester| LE1 7RH | UK t: +44 116 252 2254 e: liam.gretton at leicester.ac.uk w: www.le.ac.uk [cid:image001.png at 01DAAD21.89265E10] Follow us on Twitter or visit our Facebook page -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image001.png Type: image/png Size: 9235 bytes Desc: image001.png URL: