Repository navigation
OC\Files\Stream\Encryption::loadContext($name) should be compatible with Icewind\Streams\Wrapper::loadContext #26464
Description
Activity
- added0. Needs triagePending check for reproducibility or if it fits our roadmapPending check for reproducibility or if it fits our roadmap
on Apr 8, 2021 AndyXheli commented
on Apr 8, 2021 on Apr 8, 2021 · Hidden as off-topicAuthorshow commentMore actionsThe problem is that the method of the
Encryptionclass has a different signature (arguments) than the arguments of the same methodwrapSourcein the parent classesWrapperandWrapperHandler.- changed the title
[-]Nextcloud 20.0.9 OC\Files\Stream\Encryption::loadContext($name) should be compatible with Icewind\Streams\Wrapper::loadContext($name = NULL) at /var/www/nextcloud/lib/private/Files/Stream/Encryption.php#224[/-][+]Nextcloud 20.0.9 & Nextcloud 21.0.1 OC\Files\Stream\Encryption::loadContext($name) should be compatible with Icewind\Streams\Wrapper::loadContext($name = NULL) at /var/www/nextcloud/lib/private/Files/Stream/Encryption.php#224[/+]on Apr 9, 2021 This also seems to happen on Nextcloud 21.0.1
Reacted by Pascal, Arno Mühren, Zaxooy, mre-gi, Tristan and Xavier P@jknockaert You asked in #24966 to get tagged for this. 🙂
- changed the title
[-]Nextcloud 20.0.9 & Nextcloud 21.0.1 OC\Files\Stream\Encryption::loadContext($name) should be compatible with Icewind\Streams\Wrapper::loadContext($name = NULL) at /var/www/nextcloud/lib/private/Files/Stream/Encryption.php#224[/-][+]OC\Files\Stream\Encryption::loadContext($name) should be compatible with Icewind\Streams\Wrapper::loadContext[/+]on Apr 13, 2021 @jknockaert did you have anytime to look into this :)
Yes. Error 3 is a duplicate of #26473. For the other two errors I can't yet make sense of it. I'd rather first have a better understanding of what we see happening in some other recent errors which may be wrapper related.
Thank you! @jknockaert is there anything you need on my end ? more logs ?
Are you actually using SMB storage for your files?
Nope everything is local i dont use SMB storage
OK let's keep this one open for now.
Okay sounds good!
@AndyXheli Today I decided to switch off encryption on my NC server, so I will no longer investigate any issues relating to its sloppy implementation.
AndyXheli commented
on Apr 19, 2021 on Apr 19, 2021 · Hidden as off-topicAuthorshow commentMore actions@vitormattos anyway you could help with this please? :)
This issue is referenced as solution on NC's forum, though:
I upgraded to NC 21.0.2 RC1 and the upload fails are still there:
[PHP] Error: Error: Undefined index: encryptedVersion at /var/www/nextcloud/lib/private/Files/Storage/Wrapper/Encryption.php#669 at <<closure>> 0. /var/www/nextcloud/lib/private/Files/Storage/Wrapper/Encryption.php line 669 OC\Log\ErrorHandler::onError(8, "Undefined index: encryptedVersion", "/var/www/nextcl ... p", 669, {sourceStorage: ... }}) 1. /var/www/nextcloud/lib/private/Files/Storage/Wrapper/Encryption.php line 767 OC\Files\Storage\Wrapper\Encryption->updateEncryptedVersion("*** sensitive parameters replaced ***") 2. /var/www/nextcloud/lib/private/Files/Storage/Wrapper/Encryption.php line 623 OC\Files\Storage\Wrapper\Encryption->copyBetweenStorage("*** sensitive parameter replaced ***", "*** sensitive parameter replaced ***", "*** sensitive parameter replaced ***", "*** sensitive parameter replaced ***", "*** sensitive parameter replaced ***") 3. /var/www/nextcloud/apps/files_trashbin/lib/Storage.php line 240 OC\Files\Storage\Wrapper\Encryption->moveFromStorage("*** sensitive parameter replaced ***", "*** sensitive parameter replaced ***", "*** sensitive parameter replaced ***") 4. /var/www/nextcloud/apps/dav/lib/Connector/Sabre/File.php line 292 OCA\Files_Trashbin\Storage->moveFromStorage("*** sensitive parameter replaced ***", "*** sensitive parameter replaced ***", "*** sensitive parameter replaced ***") 5. /var/www/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php line 156 OCA\DAV\Connector\Sabre\File->put(null) 6. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 1098 OCA\DAV\Connector\Sabre\Directory->createFile("logo stop covid 2.jpg", null) 7. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php line 504 Sabre\DAV\Server->createFile("files/Romain J/ ... g", null, null) 8. /var/www/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php line 89 Sabre\DAV\CorePlugin->httpPut(Sabre\HTTP\Request {}, Sabre\HTTP\Response {}) 9. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 472 Sabre\DAV\Server->emit("method:PUT", [Sabre\HTTP\Requ ... }]) 10. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 253 Sabre\DAV\Server->invokeMethod(Sabre\HTTP\Request {}, Sabre\HTTP\Response {}) 11. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 321 Sabre\DAV\Server->start() 12. /var/www/nextcloud/apps/dav/lib/Server.php line 332 Sabre\DAV\Server->exec() 13. /var/www/nextcloud/apps/dav/appinfo/v2/remote.php line 35 OCA\DAV\Server->exec() 14. /var/www/nextcloud/remote.php line 167 require_once("/var/www/nextcl ... p") PUT /remote.php/dav/files/*sensitive*.jpg from XXXXXXXX by XXXXX at 2021-05-17T11:31:52+02:00Still an issue on Nextcloud 20.0.10
@juliushaertl @rullzer im really sorry to bother you I was just wondering do you have any feedback on this?
Pushed a fix to icewind1991/Streams#15
I believe, that the base problem is that different Icewind/Streams implementations are available under ./3rdparty/icewind and ./apps/files_external/3rdparty/icewind, as i see in my 20.0.9 installation. In my former nextcloud version 19.0.9 the files under the 2 paths were equal (for nextcloud 19.0.9 with files_external app version 1.10.0)
If the files_external app (in version 1.11.1 on 20.0.x) is activated, there are conflicts between both and the ClassLoader seems to take the last one, which requires because of the derivation from the WrapperHandler class that the Wrapper class has the wrapSource function without mode argument.
Nethertheless the adaptation of the WrapperHandler class should work, but @AndyXheli has also found the problem that there are 2 paths which are providing the WrapperHandler class (icewind1991/Streams#15 (comment)).This issue is referenced as solution on NC's forum, though:
I upgraded to NC 21.0.2 RC1 and the upload fails are still there:
[PHP] Error: Error: Undefined index: encryptedVersion at /var/www/nextcloud/lib/private/Files/Storage/Wrapper/Encryption.php#669 at <<closure>> 0. /var/www/nextcloud/lib/private/Files/Storage/Wrapper/Encryption.php line 669 OC\Log\ErrorHandler::onError(8, "Undefined index: encryptedVersion", "/var/www/nextcl ... p", 669, {sourceStorage: ... }}) 1. /var/www/nextcloud/lib/private/Files/Storage/Wrapper/Encryption.php line 767 OC\Files\Storage\Wrapper\Encryption->updateEncryptedVersion("*** sensitive parameters replaced ***") 2. /var/www/nextcloud/lib/private/Files/Storage/Wrapper/Encryption.php line 623 OC\Files\Storage\Wrapper\Encryption->copyBetweenStorage("*** sensitive parameter replaced ***", "*** sensitive parameter replaced ***", "*** sensitive parameter replaced ***", "*** sensitive parameter replaced ***", "*** sensitive parameter replaced ***") 3. /var/www/nextcloud/apps/files_trashbin/lib/Storage.php line 240 OC\Files\Storage\Wrapper\Encryption->moveFromStorage("*** sensitive parameter replaced ***", "*** sensitive parameter replaced ***", "*** sensitive parameter replaced ***") 4. /var/www/nextcloud/apps/dav/lib/Connector/Sabre/File.php line 292 OCA\Files_Trashbin\Storage->moveFromStorage("*** sensitive parameter replaced ***", "*** sensitive parameter replaced ***", "*** sensitive parameter replaced ***") 5. /var/www/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php line 156 OCA\DAV\Connector\Sabre\File->put(null) 6. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 1098 OCA\DAV\Connector\Sabre\Directory->createFile("logo stop covid 2.jpg", null) 7. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php line 504 Sabre\DAV\Server->createFile("files/Romain J/ ... g", null, null) 8. /var/www/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php line 89 Sabre\DAV\CorePlugin->httpPut(Sabre\HTTP\Request {}, Sabre\HTTP\Response {}) 9. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 472 Sabre\DAV\Server->emit("method:PUT", [Sabre\HTTP\Requ ... }]) 10. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 253 Sabre\DAV\Server->invokeMethod(Sabre\HTTP\Request {}, Sabre\HTTP\Response {}) 11. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 321 Sabre\DAV\Server->start() 12. /var/www/nextcloud/apps/dav/lib/Server.php line 332 Sabre\DAV\Server->exec() 13. /var/www/nextcloud/apps/dav/appinfo/v2/remote.php line 35 OCA\DAV\Server->exec() 14. /var/www/nextcloud/remote.php line 167 require_once("/var/www/nextcl ... p") PUT /remote.php/dav/files/*sensitive*.jpg from XXXXXXXX by XXXXX at 2021-05-17T11:31:52+02:00This is another problem. I have seen this also on a 20.0.10 version during file upload, but the files are ok afterwards.
I don't know why the array does not contain the key 'encryptedVersion', but a simple check could be a workround:
Instead$encryptedVersion = $sourceStorage->getCache()->get($sourceInternalPath)['encryptedVersion'];
the following code does a check after the key
$encryptedVersion = 0; $sourceInfo = $sourceStorage->getCache()->get($sourceInternalPath); if (array_key_exists('encryptedVersion',$sourceInfo)) { $encryptedVersion = $sourceInfo['encryptedVersion']; }icewind1991/Streams#15 dose fix the issue on NC 21 but not on NC 20.0.10. For more info please see icewind1991/Streams#15
Reacted by keilthe correct solution should be to clarify, which Icewind/Streams implementations either ./3rdparty/icewind/streams or ./apps/files_external/3rdparty/icewind/streams should be used. Different classes with the same namespaces should be avoided. Until the 20er version (i don't know which minor version has changed this) both Icewind/Streams paths are providing the same version.
I can confirm that deactivating the files_external app is a workaround for those who don't need this app.I have version 21.0.2.1 stable and I have the same error.
Error: Undefined index: encryptedVersion at /var/www/html/lib/private/Files/Storage/Wrapper/Encryption.php#669
{"reqId":"zq1vVhRg7dTooTiW19is","level":3,"time":"2021-06-27T22:53:57+00:00","remoteAddr":"198.xx.xx.xx","user":"admin","app":"PHP","method":"PUT","url":"/remote.php/dav/files/admin/aaa/Readme.md","message":{"Exception":"Error","Message":"Undefined index: encryptedVersion at /var/www/html/lib/private/Files/Storage/Wrapper/Encryption.php#669","Code":0,"Trace":[{"file":"/var/www/html/lib/private/Files/Storage/Wrapper/Encryption.php","line":669,"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::","args":[8,"Undefined index: encryptedVersion","/var/www/html/lib/private/Files/Storage/Wrapper/Encryption.php",669,{"0":"And 2 more entries, set log level to debug to see all entries","sourceStorage":"*** sensitive parameter replaced ***","sourceInternalPath":"*** sensitive parameter replaced ***","targetInternalPath":"*** sensitive parameter replaced ***","isRename":"*** sensitive parameter replaced ***","keepEncryptionVersion":"*** sensitive parameter replaced ***"}]},{"file":"/var/www/html/lib/private/Files/Storage/Wrapper/Encryption.php","line":767,"function":"updateEncryptedVersion","class":"OC\\Files\\Storage\\Wrapper\\Encryption","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/lib/private/Files/Storage/Wrapper/Encryption.php","line":623,"function":"copyBetweenStorage","class":"OC\\Files\\Storage\\Wrapper\\Encryption","type":"->","args":["*** sensitive parameter replaced ***","*** sensitive parameter replaced ***","*** sensitive parameter replaced ***","*** sensitive parameter replaced ***","*** sensitive parameter replaced ***"]},{"file":"/var/www/html/apps/files_trashbin/lib/Storage.php","line":240,"function":"moveFromStorage","class":"OC\\Files\\Storage\\Wrapper\\Encryption","type":"->","args":["*** sensitive parameter replaced ***","*** sensitive parameter replaced ***","*** sensitive parameter replaced ***"]},{"file":"/var/www/html/apps/dav/lib/Connector/Sabre/File.php","line":292,"function":"moveFromStorage","class":"OCA\\Files_Trashbin\\Storage","type":"->","args":["*** sensitive parameter replaced ***","*** sensitive parameter replaced ***","*** sensitive parameter replaced ***"]},{"file":"/var/www/html/apps/dav/lib/Connector/Sabre/Directory.php","line":156,"function":"put","class":"OCA\\DAV\\Connector\\Sabre\\File","type":"->","args":[null]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php","line":1098,"function":"createFile","class":"OCA\\DAV\\Connector\\Sabre\\Directory","type":"->","args":["Readme.md",null]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/CorePlugin.php","line":504,"function":"createFile","class":"Sabre\\DAV\\Server","type":"->","args":["files/admin/aaa/Readme.md",null,null]},{"file":"/var/www/html/3rdparty/sabre/event/lib/WildcardEmitterTrait.php","line":89,"function":"httpPut","class":"Sabre\\DAV\\CorePlugin","type":"->","args":[{"__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php","line":472,"function":"emit","class":"Sabre\\DAV\\Server","type":"->","args":["method:PUT",[{"__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php","line":253,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->","args":[{"__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php","line":321,"function":"start","class":"Sabre\\DAV\\Server","type":"->","args":[]},{"file":"/var/www/html/apps/dav/lib/Server.php","line":332,"function":"exec","class":"Sabre\\DAV\\Server","type":"->","args":[]},{"file":"/var/www/html/apps/dav/appinfo/v2/remote.php","line":35,"function":"exec","class":"OCA\\DAV\\Server","type":"->","args":[]},{"file":"/var/www/html/remote.php","line":167,"args":["/var/www/html/apps/dav/appinfo/v2/remote.php"],"function":"require_once"}],"File":"/var/www/html/lib/private/Log/ErrorHandler.php","Line":92,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36","version":"21.0.2.1","id":"60d9018cdb6fe"}Reacted by KarlKeu00Issue fixed in 21.0.3
Reacted by Vitor Mattos and Michael Keck
@vitormattos
Getting the followung error once updated to NC 20.0.9 everytime i open a file or scroll throw the photos app or files
Nextcloud Error 1 (data/nextcloud.log)
Error: Declaration of OC\Files\Stream\Encryption::wrapSource($source, $context, $protocol, $class, $mode = 'r+') should be compatible with Icewind\Streams\WrapperHandler::wrapSource($source, $context = Array, $protocol = NULL, $class = NULL) at /var/www/nextcloud/lib/private/Files/Stream/Encryption.php#201
Nextcloud Error 2 (data/nextcloud.log)
Error: Declaration of OC\Files\Stream\Encryption::loadContext($name) should be compatible with Icewind\Streams\Wrapper::loadContext($name = NULL) at /var/www/nextcloud/lib/private/Files/Stream/Encryption.php#224 --