After upgrade to Pydio v8.0.2, user fails to upload files

OS Info:
Ubuntu 14.04.5 LTS (GNU/Linux 4.4.0-104-generic x86_64)
Linux pydio 4.4.0-104-generic #127~14.04.1-Ubuntu SMP Mon Dec 11 12:44:15 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

Diagnostic Results:-

Client : Mozilla/5.0 (Windows NT 6.1; rv:38.0) Gecko/20100101 Firefox/38.0
Command Line Available : Yes
DOM Enabled : Yes
Exif Enabled : Yes
GD Enabled : Yes
Upload Max Size : 128M
Memory Limit : 128M
Max execution time : 30
Safe Mode : 0
Safe Mode GID : 0
Xml parser enabled : 1
MCrypt Enabled : Yes
Server OS : Linux
Session Save Path : /var/lib/php5
Session Save Path Writeable : Yes
PHP Version : 5.5.9-1ubuntu4.19
Locale : C
Directory Separator : /
PHP APC extension loaded : No
PHP INTL extension loaded : Yes
PHP Output Buffer disabled : Yes
PHP File Uploads enabled : Yes
Magic quotes disabled : Yes
Upload Tmp Dir Writeable : Yes
PHP Upload Max Size : 134217728
PHP Post Max Size : 134217728
Users enabled : Yes
Guest enabled : No
Writeable Folders : [<b>cache</b>:true,<br> <b>data</b>:true]
Zlib Enabled : Yes

Apache Log when error occurs at file upload

[Tue Jan 09 10:40:59.960733 2018] [:error] [pid 17601] [client 192.23.10.104:41572] PHP Parse error:  syntax error, unexpected '.', expecting ']' in /usr/share/pydio/core/vendor/zendframework/zend-diactoros/src/UploadedFile.php on line 21, referer: xxx

Therefore I tried to change the code as below

class UploadedFile implements UploadedFileInterface
{
    //const  ERROR_MESSAGES = [ //Remarked for debugging
    ERROR_MESSAGES = [
        UPLOAD_ERR_OK         => 'There is no error, the file uploaded with success',
        UPLOAD_ERR_INI_SIZE   => 'The uploaded file exceeds the upload_max_filesize directive in php.ini',
        UPLOAD_ERR_FORM_SIZE  => 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form',
        UPLOAD_ERR_PARTIAL    => 'The uploaded file was only partially uploaded',
        UPLOAD_ERR_NO_FILE    => 'No file was uploaded',
        UPLOAD_ERR_NO_TMP_DIR => 'Missing a temporary folder',
        UPLOAD_ERR_CANT_WRITE => 'Failed to write file to disk',
        UPLOAD_ERR_EXTENSION  => 'A PHP extension stopped the file upload.',
    ];

I tried to fix it but failed, and finally got the following error.

[Tue Jan 09 10:57:39.115139 2018] [:error] [pid 23869] [client 172.23.11.204:43294] PHP Parse error:  syntax error,
unexpected 'ERROR_MESSAGES' (T_STRING), expecting function (T_FUNCTION) in /usr/share/pydio/core/vendor/zendframewor
k/zend-diactoros/src/UploadedFile.php on line 17, referer: xxx

Hi, it’s very strange that you had a php error in this external lib. Maybe the file was not correctly downloaded update, what was the exact code before you tried to fix it?
-c

I have the same issue.

The error is:

PHP Parse error: syntax error, unexpected ‘.’, expecting ‘]’ in /opt/pydio/core/vendor/zendframework/zend-diactoros/src/UploadedFile.php on line 21

I am also running Ubuntu 14.04.5 LTS.

Yes. It is the original error I had hit. So I amend the script.

I also tried upgrade the os to Ubuntu 16. But after upgrade and install pydio and php7 it comes out blank page, with connect database error exception. I will capture the error details next time.

The original string breaks down into two parts and add by "."
i.e. something like below

    const ERROR_MESSAGES = [
        UPLOAD_ERR_OK         => 'There is no error, the file uploaded with success',
        UPLOAD_ERR_INI_SIZE   => 'The uploaded file exceeds the upload_max_filesize directive in php.ini',
        UPLOAD_ERR_FORM_SIZE  => 'The uploaded file exceeds the MAX_FILE_SIZE directive that was '
            . 'specified in the HTML form',
        UPLOAD_ERR_PARTIAL    => 'The uploaded file was only partially uploaded',
        UPLOAD_ERR_NO_FILE    => 'No file was uploaded',
        UPLOAD_ERR_NO_TMP_DIR => 'Missing a temporary folder',
        UPLOAD_ERR_CANT_WRITE => 'Failed to write file to disk',
        UPLOAD_ERR_EXTENSION  => 'A PHP extension stopped the file upload.',
    ];

But after removal of “.”, it says the var cannot be const so I remove const

details of this file can see from https://github.com/zendframework/zend-diactoros/blob/master/src/UploadedFile.php

Restore it to original will have the following error

[Thu Jan 11 19:40:54.476393 2018] [:error] [pid 1466] [client 123.123.123.123:58692] PHP Parse error:  syntax error, unexpected '.', expecting ']' in /usr/share
/pydio/core/vendor/zendframework/zend-diactoros/src/UploadedFile.php on line 21, referer: https://pydio-server/pydio/ws-my-files/
00] /var/log/apache2/error.log

I tried install php7.0 but when I try to enable it, it prompts the following warning

root@pydio:~# a2enmod php7.0
Considering dependency mpm_prefork for php7.0:
Considering conflict mpm_event for mpm_prefork:
Considering conflict mpm_worker for mpm_prefork:
Module mpm_prefork already enabled
Considering conflict php5 for php7.0:
Enabling module php7.0.
To activate the new configuration, you need to run:
  service apache2 restart

Enable it will have the following error

[Thu Jan 11 19:55:32.188855 2018] [:error] [pid 12733] [client 123.123.123.123:59106] Exception was caught but could not be logged properly: There was an error
trying to connect to your database! Did you change any configuration for the core connection? Or maybe your database is down? in /usr/share/pydio/plugins/conf
.sql/SqlConfDriver.php on line 112, referer: https://flexhk.sky-computers.com/pydio/ws-my-files/
[Thu Jan 11 19:55:32.189178 2018] [:error] [pid 12733] [client 123.123.123.123:59106]  ===> Exception details : /usr/share/pydio/plugins/conf.sql/SqlConfDriver.
php on line 112 #0 /usr/share/pydio/core/src/pydio/Core/PluginFramework/PluginsService.php(568): Pydio\\Conf\\Sql\\SqlConfDriver->init(Object(Pydio\\Core\\Mod
el\\Context), Array)\n#1 /usr/share/pydio/core/src/pydio/Core/Services/ConfService.php(192): Pydio\\Core\\PluginFramework\\PluginsService->softLoad('conf.sql'
, Array)\n#2 /usr/share/pydio/plugins/core.conf/CoreConfLoader.php(54): Pydio\\Core\\Services\\ConfService::instanciatePluginFromGlobalParams(Array, 'Pydio\\\
\Conf\\\\Core...', Object(Pydio\\Core\\PluginFramework\\PluginsService))\n#3 /usr/share/pydio/core/src/pydio/Core/Services/ConfService.php(251): Pydio\\Conf\\
Core\\CoreConfLoader->getImplementation()\n#4 /usr/share/pydio/core/src/pydio/Core/Services/ConfService.php(116): Pydio\\Core\\Services\\ConfService::getConfS
torageImpl()\n#5 /usr/share/pydio/core/src/pydio/Core/Services/ConfService.php(102): Pydio\\Core\\Services\\ConfService->startInst()\n#6 /usr/share/pydio/core
/src/pydio/Core/Http/Base.php(72): Pydio\\Core\\Services\\ConfService::start()\n#7 [internal function]: Pydio\\Core\\Http\\Base::handleRoute('/pydio', '/', Ar
ray)\n#8 /usr/share/pydio/core/src/pydio/Core/Http/TopLevelRouter.php(139): call_user_func(Array, '/pydio', '/', Array)\n#9 /usr/share/pydio/index.php(30): Py
dio\\Core\\Http\\TopLevelRouter->route()\n#10 {main}, 

I also tried in-place upgrade OS to Ubuntu 16 and use apt to install pydio, pydio-all but there is error in pydio

[Thu Jan 11 19:19:19.682656 2018] [:error] [pid 7772] [client 123.123.123.123:58062] PHP Fatal error:  Uncaught Pydio\\Core\\Exception\\PydioException: Severe e
rror while loading plugins registry : There was an error trying to connect to your database! Did you change any configuration for the core connection? Or mayb
e your database is down? in /usr/share/pydio/core/src/pydio/Core/PluginFramework/PluginsService.php:819\nStack trace:\n#0 /usr/share/pydio/core/src/pydio/Core
/PluginFramework/PluginsService.php(203): Pydio\\Core\\PluginFramework\\PluginsService->getDetectedPlugins()\n#1 /usr/share/pydio/core/src/pydio/Core/Services
/ConfService.php(392): Pydio\\Core\\PluginFramework\\PluginsService::getInstance(Object(Pydio\\Core\\Model\\Context))\n#2 /usr/share/pydio/core/src/pydio/Core
/Http/Base.php(62): Pydio\\Core\\Services\\ConfService::getGlobalConf('ADMIN_URI')\n#3 [internal function]: Pydio\\Core\\Http\\Base::handleRoute('/pydio', '/'
, Array)\n#4 /usr/share/pydio/core/src/pydio/Core/Http/TopLevelRouter.php(139): call_user_func(Array, '/pydio', '/', Array)\n#5 /usr/share/pydio/index.php(30)
: Pydio\\Core\\Http\\TopLevelRouter->route()\n#6 in /usr/share/pydio/core/src/pydio/Core/PluginFramework/PluginsService.php on line 819, referer: ...

I have upgraded to PHP 7.2 and the error remains. I am not seeing MySQL errors.

Ok. I did get the MySQL error as well PHP7 broke many things. Is it possible to roll back the update?

This is a production server and we are into two days with uploads not functioning. Thanks.

I had the same Problem with our Pydio Cloud on Ubuntu 14.04.

To make the upload work I made a backup of the UploadedFile.php and removed the array that contains the error messages.
There are only two calls for that Array inside the php so I removed the two calls, the error message is now a static output.
Now the upload is working again.
If there will be a fix for that bug I can restore the original file again.

3 Likes

That is helpful for when I apply the upgrade again. Thanks for the details. In the meantime, due to demands for the service, I rolled back to 8.0.1 from a backup. Uploads are working.

We also have this issue after upgrade to 8.0.2 (PHP 5.5)
I’ve used the fix of boomrider but it’ll be better to have a real solution.
Do you have news with that @charles ?

we have to make a new release for that - probably not possible before a couple of weeks sorry

Hi All,

Got in the same situation (Ubuntu 14.04.5 LTS) after the upgrade to 8.0.2…

The syntax used to declare the constant array was introduced in PHP 5.6.

At the time the task of setting the Pydio installation to use PHP5.6 instead of the default PHP5.5.9 appeared easier. I was not keen on the idea of searching the whole codebase for other instances using the same feature.

For reference I have used the ondrej/php PPA repo to install PHP5.6

Regards,
George

Hi,

Could you please install php extension apcu and upgrade to 7.1 >= PHP version >= 5.6
Then in pydio setting, enable Cache server with apc

Hey guys,
I read trough the previous comments, because I have the same problem.
Is there an update yet? Is it ok to change the uploadedfile.php, if so, where is it located on Debian 3.2.89?
Thanks for your help!

Hi, i’ve got the same error too. Waiting for the patch …

Hey guys, can anyone tell me where the pre4vious mentioned UploadedFile.php is located?

UDPATE:

@Charles, any news on this?!

argh not yet. I did not reproduce it locally and I’m a bit lost on which version of php the error occurs ?

Ubuntu 14.04.5
PHP 5.5.9-1ubuntu4.23)

Same Problem here. Any news on that? Some kind of official patch available?