Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add encryption version fix command #115

Merged
merged 2 commits into from
Apr 9, 2019
Merged

Conversation

sharidas
Copy link
Contributor

@sharidas sharidas commented Apr 3, 2019

Add a new command to fix the encryption
version. This would help the admin to
fix the issues related to encryption version
mismatch for the files.

Signed-off-by: Sujith H [email protected]

Note: "backport" to core stable10 is PR owncloud/core#35000

related issue: https://github.com/owncloud/enterprise/issues/3194

@sharidas sharidas self-assigned this Apr 3, 2019
@sharidas sharidas added this to the development milestone Apr 3, 2019
@sharidas
Copy link
Contributor Author

sharidas commented Apr 3, 2019

  • Improve the script
  • Add unit tests

@codecov
Copy link

codecov bot commented Apr 4, 2019

Codecov Report

Merging #115 into master will increase coverage by 5.48%.
The diff coverage is 93.5%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #115      +/-   ##
============================================
+ Coverage     64.28%   69.76%   +5.48%     
- Complexity      598      619      +21     
============================================
  Files            33       34       +1     
  Lines          2212     2289      +77     
============================================
+ Hits           1422     1597     +175     
+ Misses          790      692      -98
Impacted Files Coverage Δ Complexity Δ
lib/Command/FixEncryptedVersion.php 93.5% <93.5%> (ø) 21 <21> (?)
lib/Hooks/UserHooks.php 75% <0%> (+2.17%) 36% <0%> (ø) ⬇️
lib/KeyManager.php 77.14% <0%> (+4.08%) 83% <0%> (ø) ⬇️
lib/AppInfo/Application.php 6.5% <0%> (+6.5%) 25% <0%> (ø) ⬇️
lib/Crypto/Encryption.php 82.42% <0%> (+12.72%) 55% <0%> (ø) ⬇️
lib/Crypto/Crypt.php 79.16% <0%> (+24.58%) 67% <0%> (ø) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d06aca0...4f2d98d. Read the comment docs.

@sharidas sharidas force-pushed the fix-encryption-version-command branch from 85207e0 to c96a10c Compare April 4, 2019 12:44
@sharidas
Copy link
Contributor Author

sharidas commented Apr 4, 2019

This error https://drone.owncloud.com/owncloud/encryption/599/150 is not reproducible in my local instance.
Here is the output captured from my instance:

sujith@sujith-ownCloud  ~/test/owncloud3/apps/encryption   fix-encryption-version-command  php  ../../lib/composer/bin/phpunit --configuration ./phpunit.xml tests/unit/Command/FixEncryptedVersionTest.php
Cannot load Xdebug - it was already loaded
PHPUnit 6.5.14 by Sebastian Bergmann and contributors.

Runtime:       PHP 7.2.16-1+ubuntu18.04.1+deb.sury.org+1 with Xdebug 2.7.0
Configuration: /home/sujith/test/owncloud3/apps/encryption/phpunit.xml

PHP Warning:  Cannot modify header information - headers already sent by (output started at /home/sujith/test/owncloud3/lib/composer/phpunit/phpunit/src/Util/Printer.php:112) in /home/sujith/test/owncloud3/lib/private/User/Session.php on line 1113
PHP Stack trace:
PHP   1. {main}() /home/sujith/test/owncloud3/lib/composer/phpunit/phpunit/phpunit:0
PHP   2. PHPUnit\TextUI\Command::main($exit = *uninitialized*) /home/sujith/test/owncloud3/lib/composer/phpunit/phpunit/phpunit:53
PHP   3. PHPUnit\TextUI\Command->run($argv = array (0 => '../../lib/composer/bin/phpunit', 1 => '--configuration', 2 => './phpunit.xml', 3 => 'tests/unit/Command/FixEncryptedVersionTest.php'), $exit = TRUE) /home/sujith/test/owncloud3/lib/composer/phpunit/phpunit/src/TextUI/Command.php:148
PHP   4. PHPUnit\TextUI\TestRunner->doRun($suite = class PHPUnit\Framework\TestSuite { private $cachedNumTests = 2; protected $backupGlobals = NULL; protected $backupStaticAttributes = NULL; private $beStrictAboutChangesToGlobalState = NULL; protected $runTestInSeparateProcess = FALSE; protected $name = 'OCA\\Encryption\\Tests\\Command\\FixEncryptedVersionTest'; protected $groups = array ('DB' => array (...)); protected $tests = array (0 => class OCA\Encryption\Tests\Command\FixEncryptedVersionTest { ... }, 1 => class OCA\Encryption\Tests\Command\FixEncryptedVersionTest { ... }); protected $numTests = -1; protected $testCase = TRUE; protected $foundClasses = array (); private $iteratorFilter = NULL; private $declaredClasses = array (0 => 'stdClass', 1 => 'Exception', 2 => 'ErrorException', 3 => 'Error', 4 => 'ParseError', 5 => 'TypeError', 6 => 'ArgumentCountError', 7 => 'ArithmeticError', 8 => 'DivisionByZeroError', 9 => 'Closure', 10 => 'Generator', 11 => 'ClosedGeneratorException', 12 => 'DateTime', 13 => 'DateTimeImmutable', 14 => 'DateTimeZone', 15 => 'DateInterval', 16 => 'DatePeriod', 17 => 'LibXMLError', 18 => 'HashContext', 19 => 'ReflectionException', 20 => 'Reflection', 21 => 'ReflectionFunctionAbstract', 22 => 'ReflectionFunction', 23 => 'ReflectionGenerator', 24 => 'ReflectionParameter', 25 => 'ReflectionType', 26 => 'ReflectionNamedType', 27 => 'ReflectionMethod', 28 => 'ReflectionClass', 29 => 'ReflectionObject', 30 => 'ReflectionProperty', 31 => 'ReflectionClassConstant', 32 => 'ReflectionExtension', 33 => 'ReflectionZendExtension', 34 => 'LogicException', 35 => 'BadFunctionCallException', 36 => 'BadMethodCallException', 37 => 'DomainException', 38 => 'InvalidArgumentException', 39 => 'LengthException', 40 => 'OutOfRangeException', 41 => 'RuntimeException', 42 => 'OutOfBoundsException', 43 => 'OverflowException', 44 => 'RangeException', 45 => 'UnderflowException', 46 => 'UnexpectedValueException', 47 => 'RecursiveIteratorIterator', 48 => 'IteratorIterator', 49 => 'FilterIterator', 50 => 'RecursiveFilterIterator', 51 => 'CallbackFilterIterator', 52 => 'RecursiveCallbackFilterIterator', 53 => 'ParentIterator', 54 => 'LimitIterator', 55 => 'CachingIterator', 56 => 'RecursiveCachingIterator', 57 => 'NoRewindIterator', 58 => 'AppendIterator', 59 => 'InfiniteIterator', 60 => 'RegexIterator', 61 => 'RecursiveRegexIterator', 62 => 'EmptyIterator', 63 => 'RecursiveTreeIterator', 64 => 'ArrayObject', 65 => 'ArrayIterator', 66 => 'RecursiveArrayIterator', 67 => 'SplFileInfo', 68 => 'DirectoryIterator', 69 => 'FilesystemIterator', 70 => 'RecursiveDirectoryIterator', 71 => 'GlobIterator', 72 => 'SplFileObject', 73 => 'SplTempFileObject', 74 => 'SplDoublyLinkedList', 75 => 'SplQueue', 76 => 'SplStack', 77 => 'SplHeap', 78 => 'SplMinHeap', 79 => 'SplMaxHeap', 80 => 'SplPriorityQueue', 81 => 'SplFixedArray', 82 => 'SplObjectStorage', 83 => 'MultipleIterator', 84 => 'SodiumException', 85 => 'SessionHandler', 86 => '__PHP_Incomplete_Class', 87 => 'php_user_filter', 88 => 'Directory', 89 => 'AssertionError', 90 => 'PDOException', 91 => 'PDO', 92 => 'PDOStatement', 93 => 'PDORow', 94 => 'CURLFile', 95 => 'DOMException', 96 => 'DOMStringList', 97 => 'DOMNameList', 98 => 'DOMImplementationList', 99 => 'DOMImplementationSource', 100 => 'DOMImplementation', 101 => 'DOMNode', 102 => 'DOMNameSpaceNode', 103 => 'DOMDocumentFragment', 104 => 'DOMDocument', 105 => 'DOMNodeList', 106 => 'DOMNamedNodeMap', 107 => 'DOMCharacterData', 108 => 'DOMAttr', 109 => 'DOMElement', 110 => 'DOMText', 111 => 'DOMComment', 112 => 'DOMTypeinfo', 113 => 'DOMUserDataHandler', 114 => 'DOMDomError', 115 => 'DOMErrorHandler', 116 => 'DOMLocator', 117 => 'DOMConfiguration', 118 => 'DOMCdataSection', 119 => 'DOMDocumentType', 120 => 'DOMNotation', 121 => 'DOMEntity', 122 => 'DOMEntityReference', 123 => 'DOMProcessingInstruction', 124 => 'DOMStringExtend', 125 => 'DOMXPath', 126 => 'finfo', 127 => 'Collator', ...) }, $arguments = array ('listGroups' => FALSE, 'listSuites' => FALSE, 'listTests' => FALSE, 'listTestsXml' => FALSE, 'loader' => NULL, 'useDefaultConfiguration' => TRUE, 'loadedExtensions' => array (), 'notLoadedExtensions' => array (), 'configuration' => './phpunit.xml', 'testSuffixes' => array (0 => 'Test.php', 1 => '.phpt')), $exit = TRUE) /home/sujith/test/owncloud3/lib/composer/phpunit/phpunit/src/TextUI/Command.php:195
PHP   5. PHPUnit\Framework\TestSuite->run($result = class PHPUnit\Framework\TestResult { protected $passed = array (); protected $errors = array (); protected $failures = array (); protected $warnings = array (); protected $notImplemented = array (); protected $risky = array (); protected $skipped = array (); protected $listeners = array (0 => class PHPUnit\TextUI\ResultPrinter { ... }); protected $runTests = 0; protected $time = 0; protected $topTestSuite = class PHPUnit\Framework\TestSuite { private $cachedNumTests = 2; protected $backupGlobals = NULL; protected $backupStaticAttributes = NULL; private $beStrictAboutChangesToGlobalState = NULL; protected $runTestInSeparateProcess = FALSE; protected $name = 'OCA\\Encryption\\Tests\\Command\\FixEncryptedVersionTest'; protected $groups = array (...); protected $tests = array (...); protected $numTests = -1; protected $testCase = TRUE; protected $foundClasses = array (...); private $iteratorFilter = NULL; private $declaredClasses = array (...) }; protected $codeCoverage = class SebastianBergmann\CodeCoverage\CodeCoverage { private $driver = class SebastianBergmann\CodeCoverage\Driver\Xdebug { ... }; private $filter = class SebastianBergmann\CodeCoverage\Filter { ... }; private $wizard = class SebastianBergmann\CodeUnitReverseLookup\Wizard { ... }; private $cacheTokens = FALSE; private $checkForUnintentionallyCoveredCode = FALSE; private $forceCoversAnnotation = FALSE; private $checkForUnexecutedCoveredCode = FALSE; private $checkForMissingCoversAnnotation = FALSE; private $addUncoveredFilesFromWhitelist = TRUE; private $processUncoveredFilesFromWhitelist = FALSE; private $ignoreDeprecatedCode = FALSE; private $currentId = NULL; private $data = array (...); private $ignoredLines = array (...); private $disableIgnoredLines = FALSE; private $tests = array (...); private $unintentionallyCoveredSubclassesWhitelist = array (...); private $isInitialized = FALSE; private $shouldCheckForDeadAndUnused = TRUE; private $report = NULL }; protected $convertErrorsToExceptions = TRUE; protected $stop = FALSE; protected $stopOnError = FALSE; protected $stopOnFailure = FALSE; protected $stopOnWarning = FALSE; protected $beStrictAboutTestsThatDoNotTestAnything = TRUE; protected $beStrictAboutOutputDuringTests = FALSE; protected $beStrictAboutTodoAnnotatedTests = FALSE; protected $beStrictAboutResourceUsageDuringSmallTests = FALSE; protected $enforceTimeLimit = FALSE; protected $timeoutForSmallTests = 900; protected $timeoutForMediumTests = 900; protected $timeoutForLargeTests = 900; protected $stopOnRisky = FALSE; protected $stopOnIncomplete = FALSE; protected $stopOnSkipped = FALSE; protected $lastTestFailed = FALSE; private $registerMockObjectsFromTestArgumentsRecursively = FALSE }) /home/sujith/test/owncloud3/lib/composer/phpunit/phpunit/src/TextUI/TestRunner.php:545
PHP   6. OCA\Encryption\Tests\Command\FixEncryptedVersionTest::setUpBeforeClass() /home/sujith/test/owncloud3/lib/composer/phpunit/phpunit/src/Framework/TestSuite.php:702
PHP   7. OC\User\Session->logout() /home/sujith/test/owncloud3/apps/encryption/tests/unit/Command/FixEncryptedVersionTest.php:66
PHP   8. OC\User\Session->emittingCall($fn = class Closure { public $this = class OC\User\Session { private $manager = class OC\User\Manager { ... }; private $session = class OC\Session\Memory { ... }; private $timeFactory = class OC\AppFramework\Utility\TimeFactory { ... }; private $tokenProvider = class OC\Authentication\Token\DefaultTokenProvider { ... }; private $config = class OC\AllConfig { ... }; private $logger = class OC\Log { ... }; protected $activeUser = NULL; private $serviceLoader = class OC\Server { ... }; protected $userSyncService = class OC\User\SyncService { ... }; protected $eventDispatcher = class Symfony\Component\EventDispatcher\EventDispatcher { ... } } }, $arguments = array ('before' => array ('uid' => ''), 'after' => array ('uid' => '')), $class = 'user', $eventName = 'logout') /home/sujith/test/owncloud3/lib/private/User/Session.php:1087
PHP   9. OC\User\Session->OC\User\{closure:/home/sujith/test/owncloud3/lib/private/User/Session.php:1062-1087}(array ('uid' => '')) /home/sujith/test/owncloud3/lib/public/Events/EventEmitterTrait.php:50
PHP  10. OC\User\Session->unsetMagicInCookie() /home/sujith/test/owncloud3/lib/private/User/Session.php:1083
PHP  11. setcookie('oc_username', '', 1554381736, '', '', FALSE, TRUE) /home/sujith/test/owncloud3/lib/private/User/Session.php:1113
PHP Warning:  Cannot modify header information - headers already sent by (output started at /home/sujith/test/owncloud3/lib/composer/phpunit/phpunit/src/Util/Printer.php:112) in /home/sujith/test/owncloud3/lib/private/User/Session.php on line 1114
PHP Stack trace:
PHP   1. {main}() /home/sujith/test/owncloud3/lib/composer/phpunit/phpunit/phpunit:0
PHP   2. PHPUnit\TextUI\Command::main($exit = *uninitialized*) /home/sujith/test/owncloud3/lib/composer/phpunit/phpunit/phpunit:53
PHP   3. PHPUnit\TextUI\Command->run($argv = array (0 => '../../lib/composer/bin/phpunit', 1 => '--configuration', 2 => './phpunit.xml', 3 => 'tests/unit/Command/FixEncryptedVersionTest.php'), $exit = TRUE) /home/sujith/test/owncloud3/lib/composer/phpunit/phpunit/src/TextUI/Command.php:148
PHP   4. PHPUnit\TextUI\TestRunner->doRun($suite = class PHPUnit\Framework\TestSuite { private $cachedNumTests = 2; protected $backupGlobals = NULL; protected $backupStaticAttributes = NULL; private $beStrictAboutChangesToGlobalState = NULL; protected $runTestInSeparateProcess = FALSE; protected $name = 'OCA\\Encryption\\Tests\\Command\\FixEncryptedVersionTest'; protected $groups = array ('DB' => array (...)); protected $tests = array (0 => class OCA\Encryption\Tests\Command\FixEncryptedVersionTest { ... }, 1 => class OCA\Encryption\Tests\Command\FixEncryptedVersionTest { ... }); protected $numTests = -1; protected $testCase = TRUE; protected $foundClasses = array (); private $iteratorFilter = NULL; private $declaredClasses = array (0 => 'stdClass', 1 => 'Exception', 2 => 'ErrorException', 3 => 'Error', 4 => 'ParseError', 5 => 'TypeError', 6 => 'ArgumentCountError', 7 => 'ArithmeticError', 8 => 'DivisionByZeroError', 9 => 'Closure', 10 => 'Generator', 11 => 'ClosedGeneratorException', 12 => 'DateTime', 13 => 'DateTimeImmutable', 14 => 'DateTimeZone', 15 => 'DateInterval', 16 => 'DatePeriod', 17 => 'LibXMLError', 18 => 'HashContext', 19 => 'ReflectionException', 20 => 'Reflection', 21 => 'ReflectionFunctionAbstract', 22 => 'ReflectionFunction', 23 => 'ReflectionGenerator', 24 => 'ReflectionParameter', 25 => 'ReflectionType', 26 => 'ReflectionNamedType', 27 => 'ReflectionMethod', 28 => 'ReflectionClass', 29 => 'ReflectionObject', 30 => 'ReflectionProperty', 31 => 'ReflectionClassConstant', 32 => 'ReflectionExtension', 33 => 'ReflectionZendExtension', 34 => 'LogicException', 35 => 'BadFunctionCallException', 36 => 'BadMethodCallException', 37 => 'DomainException', 38 => 'InvalidArgumentException', 39 => 'LengthException', 40 => 'OutOfRangeException', 41 => 'RuntimeException', 42 => 'OutOfBoundsException', 43 => 'OverflowException', 44 => 'RangeException', 45 => 'UnderflowException', 46 => 'UnexpectedValueException', 47 => 'RecursiveIteratorIterator', 48 => 'IteratorIterator', 49 => 'FilterIterator', 50 => 'RecursiveFilterIterator', 51 => 'CallbackFilterIterator', 52 => 'RecursiveCallbackFilterIterator', 53 => 'ParentIterator', 54 => 'LimitIterator', 55 => 'CachingIterator', 56 => 'RecursiveCachingIterator', 57 => 'NoRewindIterator', 58 => 'AppendIterator', 59 => 'InfiniteIterator', 60 => 'RegexIterator', 61 => 'RecursiveRegexIterator', 62 => 'EmptyIterator', 63 => 'RecursiveTreeIterator', 64 => 'ArrayObject', 65 => 'ArrayIterator', 66 => 'RecursiveArrayIterator', 67 => 'SplFileInfo', 68 => 'DirectoryIterator', 69 => 'FilesystemIterator', 70 => 'RecursiveDirectoryIterator', 71 => 'GlobIterator', 72 => 'SplFileObject', 73 => 'SplTempFileObject', 74 => 'SplDoublyLinkedList', 75 => 'SplQueue', 76 => 'SplStack', 77 => 'SplHeap', 78 => 'SplMinHeap', 79 => 'SplMaxHeap', 80 => 'SplPriorityQueue', 81 => 'SplFixedArray', 82 => 'SplObjectStorage', 83 => 'MultipleIterator', 84 => 'SodiumException', 85 => 'SessionHandler', 86 => '__PHP_Incomplete_Class', 87 => 'php_user_filter', 88 => 'Directory', 89 => 'AssertionError', 90 => 'PDOException', 91 => 'PDO', 92 => 'PDOStatement', 93 => 'PDORow', 94 => 'CURLFile', 95 => 'DOMException', 96 => 'DOMStringList', 97 => 'DOMNameList', 98 => 'DOMImplementationList', 99 => 'DOMImplementationSource', 100 => 'DOMImplementation', 101 => 'DOMNode', 102 => 'DOMNameSpaceNode', 103 => 'DOMDocumentFragment', 104 => 'DOMDocument', 105 => 'DOMNodeList', 106 => 'DOMNamedNodeMap', 107 => 'DOMCharacterData', 108 => 'DOMAttr', 109 => 'DOMElement', 110 => 'DOMText', 111 => 'DOMComment', 112 => 'DOMTypeinfo', 113 => 'DOMUserDataHandler', 114 => 'DOMDomError', 115 => 'DOMErrorHandler', 116 => 'DOMLocator', 117 => 'DOMConfiguration', 118 => 'DOMCdataSection', 119 => 'DOMDocumentType', 120 => 'DOMNotation', 121 => 'DOMEntity', 122 => 'DOMEntityReference', 123 => 'DOMProcessingInstruction', 124 => 'DOMStringExtend', 125 => 'DOMXPath', 126 => 'finfo', 127 => 'Collator', ...) }, $arguments = array ('listGroups' => FALSE, 'listSuites' => FALSE, 'listTests' => FALSE, 'listTestsXml' => FALSE, 'loader' => NULL, 'useDefaultConfiguration' => TRUE, 'loadedExtensions' => array (), 'notLoadedExtensions' => array (), 'configuration' => './phpunit.xml', 'testSuffixes' => array (0 => 'Test.php', 1 => '.phpt')), $exit = TRUE) /home/sujith/test/owncloud3/lib/composer/phpunit/phpunit/src/TextUI/Command.php:195
PHP   5. PHPUnit\Framework\TestSuite->run($result = class PHPUnit\Framework\TestResult { protected $passed = array (); protected $errors = array (); protected $failures = array (); protected $warnings = array (); protected $notImplemented = array (); protected $risky = array (); protected $skipped = array (); protected $listeners = array (0 => class PHPUnit\TextUI\ResultPrinter { ... }); protected $runTests = 0; protected $time = 0; protected $topTestSuite = class PHPUnit\Framework\TestSuite { private $cachedNumTests = 2; protected $backupGlobals = NULL; protected $backupStaticAttributes = NULL; private $beStrictAboutChangesToGlobalState = NULL; protected $runTestInSeparateProcess = FALSE; protected $name = 'OCA\\Encryption\\Tests\\Command\\FixEncryptedVersionTest'; protected $groups = array (...); protected $tests = array (...); protected $numTests = -1; protected $testCase = TRUE; protected $foundClasses = array (...); private $iteratorFilter = NULL; private $declaredClasses = array (...) }; protected $codeCoverage = class SebastianBergmann\CodeCoverage\CodeCoverage { private $driver = class SebastianBergmann\CodeCoverage\Driver\Xdebug { ... }; private $filter = class SebastianBergmann\CodeCoverage\Filter { ... }; private $wizard = class SebastianBergmann\CodeUnitReverseLookup\Wizard { ... }; private $cacheTokens = FALSE; private $checkForUnintentionallyCoveredCode = FALSE; private $forceCoversAnnotation = FALSE; private $checkForUnexecutedCoveredCode = FALSE; private $checkForMissingCoversAnnotation = FALSE; private $addUncoveredFilesFromWhitelist = TRUE; private $processUncoveredFilesFromWhitelist = FALSE; private $ignoreDeprecatedCode = FALSE; private $currentId = NULL; private $data = array (...); private $ignoredLines = array (...); private $disableIgnoredLines = FALSE; private $tests = array (...); private $unintentionallyCoveredSubclassesWhitelist = array (...); private $isInitialized = FALSE; private $shouldCheckForDeadAndUnused = TRUE; private $report = NULL }; protected $convertErrorsToExceptions = TRUE; protected $stop = FALSE; protected $stopOnError = FALSE; protected $stopOnFailure = FALSE; protected $stopOnWarning = FALSE; protected $beStrictAboutTestsThatDoNotTestAnything = TRUE; protected $beStrictAboutOutputDuringTests = FALSE; protected $beStrictAboutTodoAnnotatedTests = FALSE; protected $beStrictAboutResourceUsageDuringSmallTests = FALSE; protected $enforceTimeLimit = FALSE; protected $timeoutForSmallTests = 900; protected $timeoutForMediumTests = 900; protected $timeoutForLargeTests = 900; protected $stopOnRisky = FALSE; protected $stopOnIncomplete = FALSE; protected $stopOnSkipped = FALSE; protected $lastTestFailed = FALSE; private $registerMockObjectsFromTestArgumentsRecursively = FALSE }) /home/sujith/test/owncloud3/lib/composer/phpunit/phpunit/src/TextUI/TestRunner.php:545
PHP   6. OCA\Encryption\Tests\Command\FixEncryptedVersionTest::setUpBeforeClass() /home/sujith/test/owncloud3/lib/composer/phpunit/phpunit/src/Framework/TestSuite.php:702
PHP   7. OC\User\Session->logout() /home/sujith/test/owncloud3/apps/encryption/tests/unit/Command/FixEncryptedVersionTest.php:66
PHP   8. OC\User\Session->emittingCall($fn = class Closure { public $this = class OC\User\Session { private $manager = class OC\User\Manager { ... }; private $session = class OC\Session\Memory { ... }; private $timeFactory = class OC\AppFramework\Utility\TimeFactory { ... }; private $tokenProvider = class OC\Authentication\Token\DefaultTokenProvider { ... }; private $config = class OC\AllConfig { ... }; private $logger = class OC\Log { ... }; protected $activeUser = NULL; private $serviceLoader = class OC\Server { ... }; protected $userSyncService = class OC\User\SyncService { ... }; protected $eventDispatcher = class Symfony\Component\EventDispatcher\EventDispatcher { ... } } }, $arguments = array ('before' => array ('uid' => ''), 'after' => array ('uid' => '')), $class = 'user', $eventName = 'logout') /home/sujith/test/owncloud3/lib/private/User/Session.php:1087
PHP   9. OC\User\Session->OC\User\{closure:/home/sujith/test/owncloud3/lib/private/User/Session.php:1062-1087}(array ('uid' => '')) /home/sujith/test/owncloud3/lib/public/Events/EventEmitterTrait.php:50
PHP  10. OC\User\Session->unsetMagicInCookie() /home/sujith/test/owncloud3/lib/private/User/Session.php:1083
PHP  11. setcookie('oc_token', '', 1554381736, '', '', FALSE, TRUE) /home/sujith/test/owncloud3/lib/private/User/Session.php:1114
PHP Warning:  Cannot modify header information - headers already sent by (output started at /home/sujith/test/owncloud3/lib/composer/phpunit/phpunit/src/Util/Printer.php:112) in /home/sujith/test/owncloud3/lib/private/User/Session.php on line 1115
PHP Stack trace:
PHP   1. {main}() /home/sujith/test/owncloud3/lib/composer/phpunit/phpunit/phpunit:0
PHP   2. PHPUnit\TextUI\Command::main($exit = *uninitialized*) /home/sujith/test/owncloud3/lib/composer/phpunit/phpunit/phpunit:53
PHP   3. PHPUnit\TextUI\Command->run($argv = array (0 => '../../lib/composer/bin/phpunit', 1 => '--configuration', 2 => './phpunit.xml', 3 => 'tests/unit/Command/FixEncryptedVersionTest.php'), $exit = TRUE) /home/sujith/test/owncloud3/lib/composer/phpunit/phpunit/src/TextUI/Command.php:148
PHP   4. PHPUnit\TextUI\TestRunner->doRun($suite = class PHPUnit\Framework\TestSuite { private $cachedNumTests = 2; protected $backupGlobals = NULL; protected $backupStaticAttributes = NULL; private $beStrictAboutChangesToGlobalState = NULL; protected $runTestInSeparateProcess = FALSE; protected $name = 'OCA\\Encryption\\Tests\\Command\\FixEncryptedVersionTest'; protected $groups = array ('DB' => array (...)); protected $tests = array (0 => class OCA\Encryption\Tests\Command\FixEncryptedVersionTest { ... }, 1 => class OCA\Encryption\Tests\Command\FixEncryptedVersionTest { ... }); protected $numTests = -1; protected $testCase = TRUE; protected $foundClasses = array (); private $iteratorFilter = NULL; private $declaredClasses = array (0 => 'stdClass', 1 => 'Exception', 2 => 'ErrorException', 3 => 'Error', 4 => 'ParseError', 5 => 'TypeError', 6 => 'ArgumentCountError', 7 => 'ArithmeticError', 8 => 'DivisionByZeroError', 9 => 'Closure', 10 => 'Generator', 11 => 'ClosedGeneratorException', 12 => 'DateTime', 13 => 'DateTimeImmutable', 14 => 'DateTimeZone', 15 => 'DateInterval', 16 => 'DatePeriod', 17 => 'LibXMLError', 18 => 'HashContext', 19 => 'ReflectionException', 20 => 'Reflection', 21 => 'ReflectionFunctionAbstract', 22 => 'ReflectionFunction', 23 => 'ReflectionGenerator', 24 => 'ReflectionParameter', 25 => 'ReflectionType', 26 => 'ReflectionNamedType', 27 => 'ReflectionMethod', 28 => 'ReflectionClass', 29 => 'ReflectionObject', 30 => 'ReflectionProperty', 31 => 'ReflectionClassConstant', 32 => 'ReflectionExtension', 33 => 'ReflectionZendExtension', 34 => 'LogicException', 35 => 'BadFunctionCallException', 36 => 'BadMethodCallException', 37 => 'DomainException', 38 => 'InvalidArgumentException', 39 => 'LengthException', 40 => 'OutOfRangeException', 41 => 'RuntimeException', 42 => 'OutOfBoundsException', 43 => 'OverflowException', 44 => 'RangeException', 45 => 'UnderflowException', 46 => 'UnexpectedValueException', 47 => 'RecursiveIteratorIterator', 48 => 'IteratorIterator', 49 => 'FilterIterator', 50 => 'RecursiveFilterIterator', 51 => 'CallbackFilterIterator', 52 => 'RecursiveCallbackFilterIterator', 53 => 'ParentIterator', 54 => 'LimitIterator', 55 => 'CachingIterator', 56 => 'RecursiveCachingIterator', 57 => 'NoRewindIterator', 58 => 'AppendIterator', 59 => 'InfiniteIterator', 60 => 'RegexIterator', 61 => 'RecursiveRegexIterator', 62 => 'EmptyIterator', 63 => 'RecursiveTreeIterator', 64 => 'ArrayObject', 65 => 'ArrayIterator', 66 => 'RecursiveArrayIterator', 67 => 'SplFileInfo', 68 => 'DirectoryIterator', 69 => 'FilesystemIterator', 70 => 'RecursiveDirectoryIterator', 71 => 'GlobIterator', 72 => 'SplFileObject', 73 => 'SplTempFileObject', 74 => 'SplDoublyLinkedList', 75 => 'SplQueue', 76 => 'SplStack', 77 => 'SplHeap', 78 => 'SplMinHeap', 79 => 'SplMaxHeap', 80 => 'SplPriorityQueue', 81 => 'SplFixedArray', 82 => 'SplObjectStorage', 83 => 'MultipleIterator', 84 => 'SodiumException', 85 => 'SessionHandler', 86 => '__PHP_Incomplete_Class', 87 => 'php_user_filter', 88 => 'Directory', 89 => 'AssertionError', 90 => 'PDOException', 91 => 'PDO', 92 => 'PDOStatement', 93 => 'PDORow', 94 => 'CURLFile', 95 => 'DOMException', 96 => 'DOMStringList', 97 => 'DOMNameList', 98 => 'DOMImplementationList', 99 => 'DOMImplementationSource', 100 => 'DOMImplementation', 101 => 'DOMNode', 102 => 'DOMNameSpaceNode', 103 => 'DOMDocumentFragment', 104 => 'DOMDocument', 105 => 'DOMNodeList', 106 => 'DOMNamedNodeMap', 107 => 'DOMCharacterData', 108 => 'DOMAttr', 109 => 'DOMElement', 110 => 'DOMText', 111 => 'DOMComment', 112 => 'DOMTypeinfo', 113 => 'DOMUserDataHandler', 114 => 'DOMDomError', 115 => 'DOMErrorHandler', 116 => 'DOMLocator', 117 => 'DOMConfiguration', 118 => 'DOMCdataSection', 119 => 'DOMDocumentType', 120 => 'DOMNotation', 121 => 'DOMEntity', 122 => 'DOMEntityReference', 123 => 'DOMProcessingInstruction', 124 => 'DOMStringExtend', 125 => 'DOMXPath', 126 => 'finfo', 127 => 'Collator', ...) }, $arguments = array ('listGroups' => FALSE, 'listSuites' => FALSE, 'listTests' => FALSE, 'listTestsXml' => FALSE, 'loader' => NULL, 'useDefaultConfiguration' => TRUE, 'loadedExtensions' => array (), 'notLoadedExtensions' => array (), 'configuration' => './phpunit.xml', 'testSuffixes' => array (0 => 'Test.php', 1 => '.phpt')), $exit = TRUE) /home/sujith/test/owncloud3/lib/composer/phpunit/phpunit/src/TextUI/Command.php:195
PHP   5. PHPUnit\Framework\TestSuite->run($result = class PHPUnit\Framework\TestResult { protected $passed = array (); protected $errors = array (); protected $failures = array (); protected $warnings = array (); protected $notImplemented = array (); protected $risky = array (); protected $skipped = array (); protected $listeners = array (0 => class PHPUnit\TextUI\ResultPrinter { ... }); protected $runTests = 0; protected $time = 0; protected $topTestSuite = class PHPUnit\Framework\TestSuite { private $cachedNumTests = 2; protected $backupGlobals = NULL; protected $backupStaticAttributes = NULL; private $beStrictAboutChangesToGlobalState = NULL; protected $runTestInSeparateProcess = FALSE; protected $name = 'OCA\\Encryption\\Tests\\Command\\FixEncryptedVersionTest'; protected $groups = array (...); protected $tests = array (...); protected $numTests = -1; protected $testCase = TRUE; protected $foundClasses = array (...); private $iteratorFilter = NULL; private $declaredClasses = array (...) }; protected $codeCoverage = class SebastianBergmann\CodeCoverage\CodeCoverage { private $driver = class SebastianBergmann\CodeCoverage\Driver\Xdebug { ... }; private $filter = class SebastianBergmann\CodeCoverage\Filter { ... }; private $wizard = class SebastianBergmann\CodeUnitReverseLookup\Wizard { ... }; private $cacheTokens = FALSE; private $checkForUnintentionallyCoveredCode = FALSE; private $forceCoversAnnotation = FALSE; private $checkForUnexecutedCoveredCode = FALSE; private $checkForMissingCoversAnnotation = FALSE; private $addUncoveredFilesFromWhitelist = TRUE; private $processUncoveredFilesFromWhitelist = FALSE; private $ignoreDeprecatedCode = FALSE; private $currentId = NULL; private $data = array (...); private $ignoredLines = array (...); private $disableIgnoredLines = FALSE; private $tests = array (...); private $unintentionallyCoveredSubclassesWhitelist = array (...); private $isInitialized = FALSE; private $shouldCheckForDeadAndUnused = TRUE; private $report = NULL }; protected $convertErrorsToExceptions = TRUE; protected $stop = FALSE; protected $stopOnError = FALSE; protected $stopOnFailure = FALSE; protected $stopOnWarning = FALSE; protected $beStrictAboutTestsThatDoNotTestAnything = TRUE; protected $beStrictAboutOutputDuringTests = FALSE; protected $beStrictAboutTodoAnnotatedTests = FALSE; protected $beStrictAboutResourceUsageDuringSmallTests = FALSE; protected $enforceTimeLimit = FALSE; protected $timeoutForSmallTests = 900; protected $timeoutForMediumTests = 900; protected $timeoutForLargeTests = 900; protected $stopOnRisky = FALSE; protected $stopOnIncomplete = FALSE; protected $stopOnSkipped = FALSE; protected $lastTestFailed = FALSE; private $registerMockObjectsFromTestArgumentsRecursively = FALSE }) /home/sujith/test/owncloud3/lib/composer/phpunit/phpunit/src/TextUI/TestRunner.php:545
PHP   6. OCA\Encryption\Tests\Command\FixEncryptedVersionTest::setUpBeforeClass() /home/sujith/test/owncloud3/lib/composer/phpunit/phpunit/src/Framework/TestSuite.php:702
PHP   7. OC\User\Session->logout() /home/sujith/test/owncloud3/apps/encryption/tests/unit/Command/FixEncryptedVersionTest.php:66
PHP   8. OC\User\Session->emittingCall($fn = class Closure { public $this = class OC\User\Session { private $manager = class OC\User\Manager { ... }; private $session = class OC\Session\Memory { ... }; private $timeFactory = class OC\AppFramework\Utility\TimeFactory { ... }; private $tokenProvider = class OC\Authentication\Token\DefaultTokenProvider { ... }; private $config = class OC\AllConfig { ... }; private $logger = class OC\Log { ... }; protected $activeUser = NULL; private $serviceLoader = class OC\Server { ... }; protected $userSyncService = class OC\User\SyncService { ... }; protected $eventDispatcher = class Symfony\Component\EventDispatcher\EventDispatcher { ... } } }, $arguments = array ('before' => array ('uid' => ''), 'after' => array ('uid' => '')), $class = 'user', $eventName = 'logout') /home/sujith/test/owncloud3/lib/private/User/Session.php:1087
PHP   9. OC\User\Session->OC\User\{closure:/home/sujith/test/owncloud3/lib/private/User/Session.php:1062-1087}(array ('uid' => '')) /home/sujith/test/owncloud3/lib/public/Events/EventEmitterTrait.php:50
PHP  10. OC\User\Session->unsetMagicInCookie() /home/sujith/test/owncloud3/lib/private/User/Session.php:1083
PHP  11. setcookie('oc_remember_login', '', 1554381736, '', '', FALSE, TRUE) /home/sujith/test/owncloud3/lib/private/User/Session.php:1115
PHP Warning:  Cannot modify header information - headers already sent by (output started at /home/sujith/test/owncloud3/lib/composer/phpunit/phpunit/src/Util/Printer.php:112) in /home/sujith/test/owncloud3/lib/private/User/Session.php on line 1118
PHP Stack trace:
PHP   1. {main}() /home/sujith/test/owncloud3/lib/composer/phpunit/phpunit/phpunit:0
PHP   2. PHPUnit\TextUI\Command::main($exit = *uninitialized*) /home/sujith/test/owncloud3/lib/composer/phpunit/phpunit/phpunit:53
PHP   3. PHPUnit\TextUI\Command->run($argv = array (0 => '../../lib/composer/bin/phpunit', 1 => '--configuration', 2 => './phpunit.xml', 3 => 'tests/unit/Command/FixEncryptedVersionTest.php'), $exit = TRUE) /home/sujith/test/owncloud3/lib/composer/phpunit/phpunit/src/TextUI/Command.php:148
PHP   4. PHPUnit\TextUI\TestRunner->doRun($suite = class PHPUnit\Framework\TestSuite { private $cachedNumTests = 2; protected $backupGlobals = NULL; protected $backupStaticAttributes = NULL; private $beStrictAboutChangesToGlobalState = NULL; protected $runTestInSeparateProcess = FALSE; protected $name = 'OCA\\Encryption\\Tests\\Command\\FixEncryptedVersionTest'; protected $groups = array ('DB' => array (...)); protected $tests = array (0 => class OCA\Encryption\Tests\Command\FixEncryptedVersionTest { ... }, 1 => class OCA\Encryption\Tests\Command\FixEncryptedVersionTest { ... }); protected $numTests = -1; protected $testCase = TRUE; protected $foundClasses = array (); private $iteratorFilter = NULL; private $declaredClasses = array (0 => 'stdClass', 1 => 'Exception', 2 => 'ErrorException', 3 => 'Error', 4 => 'ParseError', 5 => 'TypeError', 6 => 'ArgumentCountError', 7 => 'ArithmeticError', 8 => 'DivisionByZeroError', 9 => 'Closure', 10 => 'Generator', 11 => 'ClosedGeneratorException', 12 => 'DateTime', 13 => 'DateTimeImmutable', 14 => 'DateTimeZone', 15 => 'DateInterval', 16 => 'DatePeriod', 17 => 'LibXMLError', 18 => 'HashContext', 19 => 'ReflectionException', 20 => 'Reflection', 21 => 'ReflectionFunctionAbstract', 22 => 'ReflectionFunction', 23 => 'ReflectionGenerator', 24 => 'ReflectionParameter', 25 => 'ReflectionType', 26 => 'ReflectionNamedType', 27 => 'ReflectionMethod', 28 => 'ReflectionClass', 29 => 'ReflectionObject', 30 => 'ReflectionProperty', 31 => 'ReflectionClassConstant', 32 => 'ReflectionExtension', 33 => 'ReflectionZendExtension', 34 => 'LogicException', 35 => 'BadFunctionCallException', 36 => 'BadMethodCallException', 37 => 'DomainException', 38 => 'InvalidArgumentException', 39 => 'LengthException', 40 => 'OutOfRangeException', 41 => 'RuntimeException', 42 => 'OutOfBoundsException', 43 => 'OverflowException', 44 => 'RangeException', 45 => 'UnderflowException', 46 => 'UnexpectedValueException', 47 => 'RecursiveIteratorIterator', 48 => 'IteratorIterator', 49 => 'FilterIterator', 50 => 'RecursiveFilterIterator', 51 => 'CallbackFilterIterator', 52 => 'RecursiveCallbackFilterIterator', 53 => 'ParentIterator', 54 => 'LimitIterator', 55 => 'CachingIterator', 56 => 'RecursiveCachingIterator', 57 => 'NoRewindIterator', 58 => 'AppendIterator', 59 => 'InfiniteIterator', 60 => 'RegexIterator', 61 => 'RecursiveRegexIterator', 62 => 'EmptyIterator', 63 => 'RecursiveTreeIterator', 64 => 'ArrayObject', 65 => 'ArrayIterator', 66 => 'RecursiveArrayIterator', 67 => 'SplFileInfo', 68 => 'DirectoryIterator', 69 => 'FilesystemIterator', 70 => 'RecursiveDirectoryIterator', 71 => 'GlobIterator', 72 => 'SplFileObject', 73 => 'SplTempFileObject', 74 => 'SplDoublyLinkedList', 75 => 'SplQueue', 76 => 'SplStack', 77 => 'SplHeap', 78 => 'SplMinHeap', 79 => 'SplMaxHeap', 80 => 'SplPriorityQueue', 81 => 'SplFixedArray', 82 => 'SplObjectStorage', 83 => 'MultipleIterator', 84 => 'SodiumException', 85 => 'SessionHandler', 86 => '__PHP_Incomplete_Class', 87 => 'php_user_filter', 88 => 'Directory', 89 => 'AssertionError', 90 => 'PDOException', 91 => 'PDO', 92 => 'PDOStatement', 93 => 'PDORow', 94 => 'CURLFile', 95 => 'DOMException', 96 => 'DOMStringList', 97 => 'DOMNameList', 98 => 'DOMImplementationList', 99 => 'DOMImplementationSource', 100 => 'DOMImplementation', 101 => 'DOMNode', 102 => 'DOMNameSpaceNode', 103 => 'DOMDocumentFragment', 104 => 'DOMDocument', 105 => 'DOMNodeList', 106 => 'DOMNamedNodeMap', 107 => 'DOMCharacterData', 108 => 'DOMAttr', 109 => 'DOMElement', 110 => 'DOMText', 111 => 'DOMComment', 112 => 'DOMTypeinfo', 113 => 'DOMUserDataHandler', 114 => 'DOMDomError', 115 => 'DOMErrorHandler', 116 => 'DOMLocator', 117 => 'DOMConfiguration', 118 => 'DOMCdataSection', 119 => 'DOMDocumentType', 120 => 'DOMNotation', 121 => 'DOMEntity', 122 => 'DOMEntityReference', 123 => 'DOMProcessingInstruction', 124 => 'DOMStringExtend', 125 => 'DOMXPath', 126 => 'finfo', 127 => 'Collator', ...) }, $arguments = array ('listGroups' => FALSE, 'listSuites' => FALSE, 'listTests' => FALSE, 'listTestsXml' => FALSE, 'loader' => NULL, 'useDefaultConfiguration' => TRUE, 'loadedExtensions' => array (), 'notLoadedExtensions' => array (), 'configuration' => './phpunit.xml', 'testSuffixes' => array (0 => 'Test.php', 1 => '.phpt')), $exit = TRUE) /home/sujith/test/owncloud3/lib/composer/phpunit/phpunit/src/TextUI/Command.php:195
PHP   5. PHPUnit\Framework\TestSuite->run($result = class PHPUnit\Framework\TestResult { protected $passed = array (); protected $errors = array (); protected $failures = array (); protected $warnings = array (); protected $notImplemented = array (); protected $risky = array (); protected $skipped = array (); protected $listeners = array (0 => class PHPUnit\TextUI\ResultPrinter { ... }); protected $runTests = 0; protected $time = 0; protected $topTestSuite = class PHPUnit\Framework\TestSuite { private $cachedNumTests = 2; protected $backupGlobals = NULL; protected $backupStaticAttributes = NULL; private $beStrictAboutChangesToGlobalState = NULL; protected $runTestInSeparateProcess = FALSE; protected $name = 'OCA\\Encryption\\Tests\\Command\\FixEncryptedVersionTest'; protected $groups = array (...); protected $tests = array (...); protected $numTests = -1; protected $testCase = TRUE; protected $foundClasses = array (...); private $iteratorFilter = NULL; private $declaredClasses = array (...) }; protected $codeCoverage = class SebastianBergmann\CodeCoverage\CodeCoverage { private $driver = class SebastianBergmann\CodeCoverage\Driver\Xdebug { ... }; private $filter = class SebastianBergmann\CodeCoverage\Filter { ... }; private $wizard = class SebastianBergmann\CodeUnitReverseLookup\Wizard { ... }; private $cacheTokens = FALSE; private $checkForUnintentionallyCoveredCode = FALSE; private $forceCoversAnnotation = FALSE; private $checkForUnexecutedCoveredCode = FALSE; private $checkForMissingCoversAnnotation = FALSE; private $addUncoveredFilesFromWhitelist = TRUE; private $processUncoveredFilesFromWhitelist = FALSE; private $ignoreDeprecatedCode = FALSE; private $currentId = NULL; private $data = array (...); private $ignoredLines = array (...); private $disableIgnoredLines = FALSE; private $tests = array (...); private $unintentionallyCoveredSubclassesWhitelist = array (...); private $isInitialized = FALSE; private $shouldCheckForDeadAndUnused = TRUE; private $report = NULL }; protected $convertErrorsToExceptions = TRUE; protected $stop = FALSE; protected $stopOnError = FALSE; protected $stopOnFailure = FALSE; protected $stopOnWarning = FALSE; protected $beStrictAboutTestsThatDoNotTestAnything = TRUE; protected $beStrictAboutOutputDuringTests = FALSE; protected $beStrictAboutTodoAnnotatedTests = FALSE; protected $beStrictAboutResourceUsageDuringSmallTests = FALSE; protected $enforceTimeLimit = FALSE; protected $timeoutForSmallTests = 900; protected $timeoutForMediumTests = 900; protected $timeoutForLargeTests = 900; protected $stopOnRisky = FALSE; protected $stopOnIncomplete = FALSE; protected $stopOnSkipped = FALSE; protected $lastTestFailed = FALSE; private $registerMockObjectsFromTestArgumentsRecursively = FALSE }) /home/sujith/test/owncloud3/lib/composer/phpunit/phpunit/src/TextUI/TestRunner.php:545
PHP   6. OCA\Encryption\Tests\Command\FixEncryptedVersionTest::setUpBeforeClass() /home/sujith/test/owncloud3/lib/composer/phpunit/phpunit/src/Framework/TestSuite.php:702
PHP   7. OC\User\Session->logout() /home/sujith/test/owncloud3/apps/encryption/tests/unit/Command/FixEncryptedVersionTest.php:66
PHP   8. OC\User\Session->emittingCall($fn = class Closure { public $this = class OC\User\Session { private $manager = class OC\User\Manager { ... }; private $session = class OC\Session\Memory { ... }; private $timeFactory = class OC\AppFramework\Utility\TimeFactory { ... }; private $tokenProvider = class OC\Authentication\Token\DefaultTokenProvider { ... }; private $config = class OC\AllConfig { ... }; private $logger = class OC\Log { ... }; protected $activeUser = NULL; private $serviceLoader = class OC\Server { ... }; protected $userSyncService = class OC\User\SyncService { ... }; protected $eventDispatcher = class Symfony\Component\EventDispatcher\EventDispatcher { ... } } }, $arguments = array ('before' => array ('uid' => ''), 'after' => array ('uid' => '')), $class = 'user', $eventName = 'logout') /home/sujith/test/owncloud3/lib/private/User/Session.php:1087
PHP   9. OC\User\Session->OC\User\{closure:/home/sujith/test/owncloud3/lib/private/User/Session.php:1062-1087}(array ('uid' => '')) /home/sujith/test/owncloud3/lib/public/Events/EventEmitterTrait.php:50
PHP  10. OC\User\Session->unsetMagicInCookie() /home/sujith/test/owncloud3/lib/private/User/Session.php:1083
PHP  11. setcookie('oc_username', '', 1554381736, '/', '', FALSE, TRUE) /home/sujith/test/owncloud3/lib/private/User/Session.php:1118
PHP Warning:  Cannot modify header information - headers already sent by (output started at /home/sujith/test/owncloud3/lib/composer/phpunit/phpunit/src/Util/Printer.php:112) in /home/sujith/test/owncloud3/lib/private/User/Session.php on line 1119
PHP Stack trace:
PHP   1. {main}() /home/sujith/test/owncloud3/lib/composer/phpunit/phpunit/phpunit:0
PHP   2. PHPUnit\TextUI\Command::main($exit = *uninitialized*) /home/sujith/test/owncloud3/lib/composer/phpunit/phpunit/phpunit:53
PHP   3. PHPUnit\TextUI\Command->run($argv = array (0 => '../../lib/composer/bin/phpunit', 1 => '--configuration', 2 => './phpunit.xml', 3 => 'tests/unit/Command/FixEncryptedVersionTest.php'), $exit = TRUE) /home/sujith/test/owncloud3/lib/composer/phpunit/phpunit/src/TextUI/Command.php:148
PHP   4. PHPUnit\TextUI\TestRunner->doRun($suite = class PHPUnit\Framework\TestSuite { private $cachedNumTests = 2; protected $backupGlobals = NULL; protected $backupStaticAttributes = NULL; private $beStrictAboutChangesToGlobalState = NULL; protected $runTestInSeparateProcess = FALSE; protected $name = 'OCA\\Encryption\\Tests\\Command\\FixEncryptedVersionTest'; protected $groups = array ('DB' => array (...)); protected $tests = array (0 => class OCA\Encryption\Tests\Command\FixEncryptedVersionTest { ... }, 1 => class OCA\Encryption\Tests\Command\FixEncryptedVersionTest { ... }); protected $numTests = -1; protected $testCase = TRUE; protected $foundClasses = array (); private $iteratorFilter = NULL; private $declaredClasses = array (0 => 'stdClass', 1 => 'Exception', 2 => 'ErrorException', 3 => 'Error', 4 => 'ParseError', 5 => 'TypeError', 6 => 'ArgumentCountError', 7 => 'ArithmeticError', 8 => 'DivisionByZeroError', 9 => 'Closure', 10 => 'Generator', 11 => 'ClosedGeneratorException', 12 => 'DateTime', 13 => 'DateTimeImmutable', 14 => 'DateTimeZone', 15 => 'DateInterval', 16 => 'DatePeriod', 17 => 'LibXMLError', 18 => 'HashContext', 19 => 'ReflectionException', 20 => 'Reflection', 21 => 'ReflectionFunctionAbstract', 22 => 'ReflectionFunction', 23 => 'ReflectionGenerator', 24 => 'ReflectionParameter', 25 => 'ReflectionType', 26 => 'ReflectionNamedType', 27 => 'ReflectionMethod', 28 => 'ReflectionClass', 29 => 'ReflectionObject', 30 => 'ReflectionProperty', 31 => 'ReflectionClassConstant', 32 => 'ReflectionExtension', 33 => 'ReflectionZendExtension', 34 => 'LogicException', 35 => 'BadFunctionCallException', 36 => 'BadMethodCallException', 37 => 'DomainException', 38 => 'InvalidArgumentException', 39 => 'LengthException', 40 => 'OutOfRangeException', 41 => 'RuntimeException', 42 => 'OutOfBoundsException', 43 => 'OverflowException', 44 => 'RangeException', 45 => 'UnderflowException', 46 => 'UnexpectedValueException', 47 => 'RecursiveIteratorIterator', 48 => 'IteratorIterator', 49 => 'FilterIterator', 50 => 'RecursiveFilterIterator', 51 => 'CallbackFilterIterator', 52 => 'RecursiveCallbackFilterIterator', 53 => 'ParentIterator', 54 => 'LimitIterator', 55 => 'CachingIterator', 56 => 'RecursiveCachingIterator', 57 => 'NoRewindIterator', 58 => 'AppendIterator', 59 => 'InfiniteIterator', 60 => 'RegexIterator', 61 => 'RecursiveRegexIterator', 62 => 'EmptyIterator', 63 => 'RecursiveTreeIterator', 64 => 'ArrayObject', 65 => 'ArrayIterator', 66 => 'RecursiveArrayIterator', 67 => 'SplFileInfo', 68 => 'DirectoryIterator', 69 => 'FilesystemIterator', 70 => 'RecursiveDirectoryIterator', 71 => 'GlobIterator', 72 => 'SplFileObject', 73 => 'SplTempFileObject', 74 => 'SplDoublyLinkedList', 75 => 'SplQueue', 76 => 'SplStack', 77 => 'SplHeap', 78 => 'SplMinHeap', 79 => 'SplMaxHeap', 80 => 'SplPriorityQueue', 81 => 'SplFixedArray', 82 => 'SplObjectStorage', 83 => 'MultipleIterator', 84 => 'SodiumException', 85 => 'SessionHandler', 86 => '__PHP_Incomplete_Class', 87 => 'php_user_filter', 88 => 'Directory', 89 => 'AssertionError', 90 => 'PDOException', 91 => 'PDO', 92 => 'PDOStatement', 93 => 'PDORow', 94 => 'CURLFile', 95 => 'DOMException', 96 => 'DOMStringList', 97 => 'DOMNameList', 98 => 'DOMImplementationList', 99 => 'DOMImplementationSource', 100 => 'DOMImplementation', 101 => 'DOMNode', 102 => 'DOMNameSpaceNode', 103 => 'DOMDocumentFragment', 104 => 'DOMDocument', 105 => 'DOMNodeList', 106 => 'DOMNamedNodeMap', 107 => 'DOMCharacterData', 108 => 'DOMAttr', 109 => 'DOMElement', 110 => 'DOMText', 111 => 'DOMComment', 112 => 'DOMTypeinfo', 113 => 'DOMUserDataHandler', 114 => 'DOMDomError', 115 => 'DOMErrorHandler', 116 => 'DOMLocator', 117 => 'DOMConfiguration', 118 => 'DOMCdataSection', 119 => 'DOMDocumentType', 120 => 'DOMNotation', 121 => 'DOMEntity', 122 => 'DOMEntityReference', 123 => 'DOMProcessingInstruction', 124 => 'DOMStringExtend', 125 => 'DOMXPath', 126 => 'finfo', 127 => 'Collator', ...) }, $arguments = array ('listGroups' => FALSE, 'listSuites' => FALSE, 'listTests' => FALSE, 'listTestsXml' => FALSE, 'loader' => NULL, 'useDefaultConfiguration' => TRUE, 'loadedExtensions' => array (), 'notLoadedExtensions' => array (), 'configuration' => './phpunit.xml', 'testSuffixes' => array (0 => 'Test.php', 1 => '.phpt')), $exit = TRUE) /home/sujith/test/owncloud3/lib/composer/phpunit/phpunit/src/TextUI/Command.php:195
PHP   5. PHPUnit\Framework\TestSuite->run($result = class PHPUnit\Framework\TestResult { protected $passed = array (); protected $errors = array (); protected $failures = array (); protected $warnings = array (); protected $notImplemented = array (); protected $risky = array (); protected $skipped = array (); protected $listeners = array (0 => class PHPUnit\TextUI\ResultPrinter { ... }); protected $runTests = 0; protected $time = 0; protected $topTestSuite = class PHPUnit\Framework\TestSuite { private $cachedNumTests = 2; protected $backupGlobals = NULL; protected $backupStaticAttributes = NULL; private $beStrictAboutChangesToGlobalState = NULL; protected $runTestInSeparateProcess = FALSE; protected $name = 'OCA\\Encryption\\Tests\\Command\\FixEncryptedVersionTest'; protected $groups = array (...); protected $tests = array (...); protected $numTests = -1; protected $testCase = TRUE; protected $foundClasses = array (...); private $iteratorFilter = NULL; private $declaredClasses = array (...) }; protected $codeCoverage = class SebastianBergmann\CodeCoverage\CodeCoverage { private $driver = class SebastianBergmann\CodeCoverage\Driver\Xdebug { ... }; private $filter = class SebastianBergmann\CodeCoverage\Filter { ... }; private $wizard = class SebastianBergmann\CodeUnitReverseLookup\Wizard { ... }; private $cacheTokens = FALSE; private $checkForUnintentionallyCoveredCode = FALSE; private $forceCoversAnnotation = FALSE; private $checkForUnexecutedCoveredCode = FALSE; private $checkForMissingCoversAnnotation = FALSE; private $addUncoveredFilesFromWhitelist = TRUE; private $processUncoveredFilesFromWhitelist = FALSE; private $ignoreDeprecatedCode = FALSE; private $currentId = NULL; private $data = array (...); private $ignoredLines = array (...); private $disableIgnoredLines = FALSE; private $tests = array (...); private $unintentionallyCoveredSubclassesWhitelist = array (...); private $isInitialized = FALSE; private $shouldCheckForDeadAndUnused = TRUE; private $report = NULL }; protected $convertErrorsToExceptions = TRUE; protected $stop = FALSE; protected $stopOnError = FALSE; protected $stopOnFailure = FALSE; protected $stopOnWarning = FALSE; protected $beStrictAboutTestsThatDoNotTestAnything = TRUE; protected $beStrictAboutOutputDuringTests = FALSE; protected $beStrictAboutTodoAnnotatedTests = FALSE; protected $beStrictAboutResourceUsageDuringSmallTests = FALSE; protected $enforceTimeLimit = FALSE; protected $timeoutForSmallTests = 900; protected $timeoutForMediumTests = 900; protected $timeoutForLargeTests = 900; protected $stopOnRisky = FALSE; protected $stopOnIncomplete = FALSE; protected $stopOnSkipped = FALSE; protected $lastTestFailed = FALSE; private $registerMockObjectsFromTestArgumentsRecursively = FALSE }) /home/sujith/test/owncloud3/lib/composer/phpunit/phpunit/src/TextUI/TestRunner.php:545
PHP   6. OCA\Encryption\Tests\Command\FixEncryptedVersionTest::setUpBeforeClass() /home/sujith/test/owncloud3/lib/composer/phpunit/phpunit/src/Framework/TestSuite.php:702
PHP   7. OC\User\Session->logout() /home/sujith/test/owncloud3/apps/encryption/tests/unit/Command/FixEncryptedVersionTest.php:66
PHP   8. OC\User\Session->emittingCall($fn = class Closure { public $this = class OC\User\Session { private $manager = class OC\User\Manager { ... }; private $session = class OC\Session\Memory { ... }; private $timeFactory = class OC\AppFramework\Utility\TimeFactory { ... }; private $tokenProvider = class OC\Authentication\Token\DefaultTokenProvider { ... }; private $config = class OC\AllConfig { ... }; private $logger = class OC\Log { ... }; protected $activeUser = NULL; private $serviceLoader = class OC\Server { ... }; protected $userSyncService = class OC\User\SyncService { ... }; protected $eventDispatcher = class Symfony\Component\EventDispatcher\EventDispatcher { ... } } }, $arguments = array ('before' => array ('uid' => ''), 'after' => array ('uid' => '')), $class = 'user', $eventName = 'logout') /home/sujith/test/owncloud3/lib/private/User/Session.php:1087
PHP   9. OC\User\Session->OC\User\{closure:/home/sujith/test/owncloud3/lib/private/User/Session.php:1062-1087}(array ('uid' => '')) /home/sujith/test/owncloud3/lib/public/Events/EventEmitterTrait.php:50
PHP  10. OC\User\Session->unsetMagicInCookie() /home/sujith/test/owncloud3/lib/private/User/Session.php:1083
PHP  11. setcookie('oc_token', '', 1554381736, '/', '', FALSE, TRUE) /home/sujith/test/owncloud3/lib/private/User/Session.php:1119
PHP Warning:  Cannot modify header information - headers already sent by (output started at /home/sujith/test/owncloud3/lib/composer/phpunit/phpunit/src/Util/Printer.php:112) in /home/sujith/test/owncloud3/lib/private/User/Session.php on line 1120
PHP Stack trace:
PHP   1. {main}() /home/sujith/test/owncloud3/lib/composer/phpunit/phpunit/phpunit:0
PHP   2. PHPUnit\TextUI\Command::main($exit = *uninitialized*) /home/sujith/test/owncloud3/lib/composer/phpunit/phpunit/phpunit:53
PHP   3. PHPUnit\TextUI\Command->run($argv = array (0 => '../../lib/composer/bin/phpunit', 1 => '--configuration', 2 => './phpunit.xml', 3 => 'tests/unit/Command/FixEncryptedVersionTest.php'), $exit = TRUE) /home/sujith/test/owncloud3/lib/composer/phpunit/phpunit/src/TextUI/Command.php:148
PHP   4. PHPUnit\TextUI\TestRunner->doRun($suite = class PHPUnit\Framework\TestSuite { private $cachedNumTests = 2; protected $backupGlobals = NULL; protected $backupStaticAttributes = NULL; private $beStrictAboutChangesToGlobalState = NULL; protected $runTestInSeparateProcess = FALSE; protected $name = 'OCA\\Encryption\\Tests\\Command\\FixEncryptedVersionTest'; protected $groups = array ('DB' => array (...)); protected $tests = array (0 => class OCA\Encryption\Tests\Command\FixEncryptedVersionTest { ... }, 1 => class OCA\Encryption\Tests\Command\FixEncryptedVersionTest { ... }); protected $numTests = -1; protected $testCase = TRUE; protected $foundClasses = array (); private $iteratorFilter = NULL; private $declaredClasses = array (0 => 'stdClass', 1 => 'Exception', 2 => 'ErrorException', 3 => 'Error', 4 => 'ParseError', 5 => 'TypeError', 6 => 'ArgumentCountError', 7 => 'ArithmeticError', 8 => 'DivisionByZeroError', 9 => 'Closure', 10 => 'Generator', 11 => 'ClosedGeneratorException', 12 => 'DateTime', 13 => 'DateTimeImmutable', 14 => 'DateTimeZone', 15 => 'DateInterval', 16 => 'DatePeriod', 17 => 'LibXMLError', 18 => 'HashContext', 19 => 'ReflectionException', 20 => 'Reflection', 21 => 'ReflectionFunctionAbstract', 22 => 'ReflectionFunction', 23 => 'ReflectionGenerator', 24 => 'ReflectionParameter', 25 => 'ReflectionType', 26 => 'ReflectionNamedType', 27 => 'ReflectionMethod', 28 => 'ReflectionClass', 29 => 'ReflectionObject', 30 => 'ReflectionProperty', 31 => 'ReflectionClassConstant', 32 => 'ReflectionExtension', 33 => 'ReflectionZendExtension', 34 => 'LogicException', 35 => 'BadFunctionCallException', 36 => 'BadMethodCallException', 37 => 'DomainException', 38 => 'InvalidArgumentException', 39 => 'LengthException', 40 => 'OutOfRangeException', 41 => 'RuntimeException', 42 => 'OutOfBoundsException', 43 => 'OverflowException', 44 => 'RangeException', 45 => 'UnderflowException', 46 => 'UnexpectedValueException', 47 => 'RecursiveIteratorIterator', 48 => 'IteratorIterator', 49 => 'FilterIterator', 50 => 'RecursiveFilterIterator', 51 => 'CallbackFilterIterator', 52 => 'RecursiveCallbackFilterIterator', 53 => 'ParentIterator', 54 => 'LimitIterator', 55 => 'CachingIterator', 56 => 'RecursiveCachingIterator', 57 => 'NoRewindIterator', 58 => 'AppendIterator', 59 => 'InfiniteIterator', 60 => 'RegexIterator', 61 => 'RecursiveRegexIterator', 62 => 'EmptyIterator', 63 => 'RecursiveTreeIterator', 64 => 'ArrayObject', 65 => 'ArrayIterator', 66 => 'RecursiveArrayIterator', 67 => 'SplFileInfo', 68 => 'DirectoryIterator', 69 => 'FilesystemIterator', 70 => 'RecursiveDirectoryIterator', 71 => 'GlobIterator', 72 => 'SplFileObject', 73 => 'SplTempFileObject', 74 => 'SplDoublyLinkedList', 75 => 'SplQueue', 76 => 'SplStack', 77 => 'SplHeap', 78 => 'SplMinHeap', 79 => 'SplMaxHeap', 80 => 'SplPriorityQueue', 81 => 'SplFixedArray', 82 => 'SplObjectStorage', 83 => 'MultipleIterator', 84 => 'SodiumException', 85 => 'SessionHandler', 86 => '__PHP_Incomplete_Class', 87 => 'php_user_filter', 88 => 'Directory', 89 => 'AssertionError', 90 => 'PDOException', 91 => 'PDO', 92 => 'PDOStatement', 93 => 'PDORow', 94 => 'CURLFile', 95 => 'DOMException', 96 => 'DOMStringList', 97 => 'DOMNameList', 98 => 'DOMImplementationList', 99 => 'DOMImplementationSource', 100 => 'DOMImplementation', 101 => 'DOMNode', 102 => 'DOMNameSpaceNode', 103 => 'DOMDocumentFragment', 104 => 'DOMDocument', 105 => 'DOMNodeList', 106 => 'DOMNamedNodeMap', 107 => 'DOMCharacterData', 108 => 'DOMAttr', 109 => 'DOMElement', 110 => 'DOMText', 111 => 'DOMComment', 112 => 'DOMTypeinfo', 113 => 'DOMUserDataHandler', 114 => 'DOMDomError', 115 => 'DOMErrorHandler', 116 => 'DOMLocator', 117 => 'DOMConfiguration', 118 => 'DOMCdataSection', 119 => 'DOMDocumentType', 120 => 'DOMNotation', 121 => 'DOMEntity', 122 => 'DOMEntityReference', 123 => 'DOMProcessingInstruction', 124 => 'DOMStringExtend', 125 => 'DOMXPath', 126 => 'finfo', 127 => 'Collator', ...) }, $arguments = array ('listGroups' => FALSE, 'listSuites' => FALSE, 'listTests' => FALSE, 'listTestsXml' => FALSE, 'loader' => NULL, 'useDefaultConfiguration' => TRUE, 'loadedExtensions' => array (), 'notLoadedExtensions' => array (), 'configuration' => './phpunit.xml', 'testSuffixes' => array (0 => 'Test.php', 1 => '.phpt')), $exit = TRUE) /home/sujith/test/owncloud3/lib/composer/phpunit/phpunit/src/TextUI/Command.php:195
PHP   5. PHPUnit\Framework\TestSuite->run($result = class PHPUnit\Framework\TestResult { protected $passed = array (); protected $errors = array (); protected $failures = array (); protected $warnings = array (); protected $notImplemented = array (); protected $risky = array (); protected $skipped = array (); protected $listeners = array (0 => class PHPUnit\TextUI\ResultPrinter { ... }); protected $runTests = 0; protected $time = 0; protected $topTestSuite = class PHPUnit\Framework\TestSuite { private $cachedNumTests = 2; protected $backupGlobals = NULL; protected $backupStaticAttributes = NULL; private $beStrictAboutChangesToGlobalState = NULL; protected $runTestInSeparateProcess = FALSE; protected $name = 'OCA\\Encryption\\Tests\\Command\\FixEncryptedVersionTest'; protected $groups = array (...); protected $tests = array (...); protected $numTests = -1; protected $testCase = TRUE; protected $foundClasses = array (...); private $iteratorFilter = NULL; private $declaredClasses = array (...) }; protected $codeCoverage = class SebastianBergmann\CodeCoverage\CodeCoverage { private $driver = class SebastianBergmann\CodeCoverage\Driver\Xdebug { ... }; private $filter = class SebastianBergmann\CodeCoverage\Filter { ... }; private $wizard = class SebastianBergmann\CodeUnitReverseLookup\Wizard { ... }; private $cacheTokens = FALSE; private $checkForUnintentionallyCoveredCode = FALSE; private $forceCoversAnnotation = FALSE; private $checkForUnexecutedCoveredCode = FALSE; private $checkForMissingCoversAnnotation = FALSE; private $addUncoveredFilesFromWhitelist = TRUE; private $processUncoveredFilesFromWhitelist = FALSE; private $ignoreDeprecatedCode = FALSE; private $currentId = NULL; private $data = array (...); private $ignoredLines = array (...); private $disableIgnoredLines = FALSE; private $tests = array (...); private $unintentionallyCoveredSubclassesWhitelist = array (...); private $isInitialized = FALSE; private $shouldCheckForDeadAndUnused = TRUE; private $report = NULL }; protected $convertErrorsToExceptions = TRUE; protected $stop = FALSE; protected $stopOnError = FALSE; protected $stopOnFailure = FALSE; protected $stopOnWarning = FALSE; protected $beStrictAboutTestsThatDoNotTestAnything = TRUE; protected $beStrictAboutOutputDuringTests = FALSE; protected $beStrictAboutTodoAnnotatedTests = FALSE; protected $beStrictAboutResourceUsageDuringSmallTests = FALSE; protected $enforceTimeLimit = FALSE; protected $timeoutForSmallTests = 900; protected $timeoutForMediumTests = 900; protected $timeoutForLargeTests = 900; protected $stopOnRisky = FALSE; protected $stopOnIncomplete = FALSE; protected $stopOnSkipped = FALSE; protected $lastTestFailed = FALSE; private $registerMockObjectsFromTestArgumentsRecursively = FALSE }) /home/sujith/test/owncloud3/lib/composer/phpunit/phpunit/src/TextUI/TestRunner.php:545
PHP   6. OCA\Encryption\Tests\Command\FixEncryptedVersionTest::setUpBeforeClass() /home/sujith/test/owncloud3/lib/composer/phpunit/phpunit/src/Framework/TestSuite.php:702
PHP   7. OC\User\Session->logout() /home/sujith/test/owncloud3/apps/encryption/tests/unit/Command/FixEncryptedVersionTest.php:66
PHP   8. OC\User\Session->emittingCall($fn = class Closure { public $this = class OC\User\Session { private $manager = class OC\User\Manager { ... }; private $session = class OC\Session\Memory { ... }; private $timeFactory = class OC\AppFramework\Utility\TimeFactory { ... }; private $tokenProvider = class OC\Authentication\Token\DefaultTokenProvider { ... }; private $config = class OC\AllConfig { ... }; private $logger = class OC\Log { ... }; protected $activeUser = NULL; private $serviceLoader = class OC\Server { ... }; protected $userSyncService = class OC\User\SyncService { ... }; protected $eventDispatcher = class Symfony\Component\EventDispatcher\EventDispatcher { ... } } }, $arguments = array ('before' => array ('uid' => ''), 'after' => array ('uid' => '')), $class = 'user', $eventName = 'logout') /home/sujith/test/owncloud3/lib/private/User/Session.php:1087
PHP   9. OC\User\Session->OC\User\{closure:/home/sujith/test/owncloud3/lib/private/User/Session.php:1062-1087}(array ('uid' => '')) /home/sujith/test/owncloud3/lib/public/Events/EventEmitterTrait.php:50
PHP  10. OC\User\Session->unsetMagicInCookie() /home/sujith/test/owncloud3/lib/private/User/Session.php:1083
PHP  11. setcookie('oc_remember_login', '', 1554381736, '/', '', FALSE, TRUE) /home/sujith/test/owncloud3/lib/private/User/Session.php:1120
a test string for helloWelcome to your ownCloud account!

This is just an example file for developers and git users. 
The packaged and released versions will come with better examples.

a test string for worldRLets modify againWelcome to your ownCloud account!

This is just an example file for developers and git users. 
The packaged and released versions will come with better examples.

a test string for worldR                                                                  2 / 2 (100%)

Time: 34.32 seconds, Memory: 30.00MB

There were 2 risky tests:

1) OCA\Encryption\Tests\Command\FixEncryptedVersionTest::testEncryptedVersionZero
Test code or tested code did not (only) close its own output buffers

2) OCA\Encryption\Tests\Command\FixEncryptedVersionTest::testEncryptedVersionLessThanOriginalValue
Test code or tested code did not (only) close its own output buffers

OK, but incomplete, skipped, or risky tests!
Tests: 2, Assertions: 2, Risky: 2.

Generating code coverage report in Clover XML format ... done
 ✘ sujith@sujith-ownCloud  ~/test/owncloud3/apps/encryption   fix-encryption-version-command

Digging into it...

@sharidas sharidas changed the title [WIP] Add encryption version fix command Add encryption version fix command Apr 4, 2019
@sharidas
Copy link
Contributor Author

sharidas commented Apr 5, 2019

Using the unit test this is what I wanted to do:

  • Simulate the scenario that happened with one of our user(s), where the filecache table got messed up with wrong encrypted version
  • Run the command
  • Verify everything is ok

But the problem here I find with

Unit test

Acceptance test

  • As of now we don't have the end point in the tests where the db could be manipulated. Once its there we could use it to alter the values and run the command and check the files. IMHO, that would be a clean way.

lib/Command/FixEncryptedVersion.php Outdated Show resolved Hide resolved
lib/Command/FixEncryptedVersion.php Show resolved Hide resolved
lib/Command/FixEncryptedVersion.php Outdated Show resolved Hide resolved
lib/Command/FixEncryptedVersion.php Show resolved Hide resolved
lib/Command/FixEncryptedVersion.php Outdated Show resolved Hide resolved
lib/Command/FixEncryptedVersion.php Outdated Show resolved Hide resolved
lib/Command/FixEncryptedVersion.php Outdated Show resolved Hide resolved
lib/Command/FixEncryptedVersion.php Outdated Show resolved Hide resolved
if ($oldEncryptedVersion !== null) {
$encryptedVersion = $oldEncryptedVersion + $increment;
} else {
$encryptedVersion = $encryptedVersion + $increment;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please recheck, from my understanding this will go as follows:

with $encryptedVersion = 6 at start

cycle 1: $increment=1, $encryptedVersion=6+1=7
cycle 2: $increment=2, $encryptedVersion=7+2=9
cycle 3: $increment=3, $encryptedVersion=9+3=12
...

if it doesn't do that (which might be confirmed with unit test), then rewrite the code to make it more clear what happens to the reader

Copy link
Contributor Author

@sharidas sharidas Apr 5, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually it doesn't work like that, I have added php comment. Also adjusted the variable encryptedVersion in this section to $newEncryptedVersion, the oldEncryptedVersion is renamed to $wrongEncryptedVersion.
So basically its like this:

when the $wrongEncryptedVersion = 6 at start

cycle 1: $increment=1, $newEncryptedVersion = 6+1 = 7
cycle 2: $increment=2, $newEncryptedVersion = 6+2 = 8
cycle 3: $increment=3, $newEncryptedVersion = 6+3 = 9
Basically the $wrongEncryptedVersion remains same and the $increment is doing the increment.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so it was only a code readability issue, cool

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup.

@sharidas sharidas force-pushed the fix-encryption-version-command branch 2 times, most recently from b8d461a to c44077c Compare April 5, 2019 12:31
//Enable encryption app
\OC_App::enable("encryption");
//Enable encryption
\OC::$server->getConfig()->setAppValue('core', 'encryption_enabled', 'yes');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

normally you should save appconfig values in a variable and set that variable back at the end of the test to avoid side effects

* set to a positive non zero number.
*/
public function testEncryptedVersionZero() {
$this->markTestSkipped("Skipping this test because the user login would fail in the CI. And once we have a db endpoints available in acceptance test, we would add the test over there");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please continue researching a bit

you should use $this->loginAsUser() for a more accurate login simulation. see https://github.com/owncloud/core/blob/v10.1.1/tests/lib/TestCase.php#L368

Copy link
Contributor

@PVince81 PVince81 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks better and more straightforward to read

please check my comment to unskip the unit tests, there should be a way

@sharidas sharidas force-pushed the fix-encryption-version-command branch 2 times, most recently from 1bcf089 to 37bbca5 Compare April 8, 2019 09:35
@sharidas
Copy link
Contributor Author

sharidas commented Apr 8, 2019

The output buffer issue https://drone.owncloud.com/owncloud/encryption/609/150 :(

@sharidas sharidas force-pushed the fix-encryption-version-command branch from 37bbca5 to ebd1a20 Compare April 8, 2019 13:30
@sharidas
Copy link
Contributor Author

sharidas commented Apr 8, 2019

Here is the output captured from my instance
a.txt the output looks clean. @PVince81 let me know if this looks ok.

@PVince81
Copy link
Contributor

PVince81 commented Apr 8, 2019

Here is the output captured from my instance

not sure what this is and what I should do about it ?

@sharidas sharidas force-pushed the fix-encryption-version-command branch from ebd1a20 to fd1d53e Compare April 8, 2019 13:59
@sharidas
Copy link
Contributor Author

sharidas commented Apr 8, 2019

Here is the output captured from my instance

not sure what this is and what I should do about it ?

Here is the output captured from my instance

not sure what this is and what I should do about it ?

Ok :) Lets wait for the CI result.

@sharidas
Copy link
Contributor Author

sharidas commented Apr 8, 2019

Will have to restart the CI again, because of unrelated failure https://drone.owncloud.com/owncloud/encryption/612/1494 :(

@sharidas
Copy link
Contributor Author

sharidas commented Apr 8, 2019

The CI has passed. Would require re-review.

@PVince81
Copy link
Contributor

PVince81 commented Apr 9, 2019

looks good now.

I'm missing a test where the correct value is lower than the encrypted version value and where decrementing would succeed.

@sharidas sharidas force-pushed the fix-encryption-version-command branch from b92e86d to 06c913f Compare April 9, 2019 11:39
Add a new command to fix the encryption
version. This would help the admin to
fix the issues related to encryption version
mismatch for the files.

Signed-off-by: Sujith H <[email protected]>
This change helps to fix the errors caused
while running the unit test without enabling
the app.

Signed-off-by: Sujith H <[email protected]>
@sharidas sharidas force-pushed the fix-encryption-version-command branch from 06c913f to 4f2d98d Compare April 9, 2019 11:53
@sharidas
Copy link
Contributor Author

sharidas commented Apr 9, 2019

I'm missing a test where the correct value is lower than the encrypted version value and where decrementing would succeed.

Ouch. Added the test at the end of the test file, which shows that the command would allow the files encrypted version reach the correct value by decrementing only.

@sharidas
Copy link
Contributor Author

sharidas commented Apr 9, 2019

Re-review required.

Copy link
Contributor

@PVince81 PVince81 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 please backport

@PVince81 PVince81 merged commit c620361 into master Apr 9, 2019
@delete-merged-branch delete-merged-branch bot deleted the fix-encryption-version-command branch April 9, 2019 17:23
@patrickjahns patrickjahns modified the milestones: development, QA Aug 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants