Skip to content

Conversation

@lscharmer
Copy link
Owner

@lscharmer lscharmer commented Oct 25, 2021

The new implementation uses the shuffle(...) function instead of the ilArrayElementShuffler::mtShuffle(...) method because since PHP 7.1 shuffle() already uses the Mersenne Twister algorithm. (see https://www.php.net/manual/en/function.shuffle.php)

The existence check for mt_srand and mt_rand is also removed, because it is replaced by srand in PHP 7.1 (see https://www.php.net/manual/en/function.mt-srand.php)

Because all ILIAS\Refinery\Transformation's must be pure and the seeding of the random number generator is not, the ShuffleTransformation returns an Effect which can be called to seed the random generator and shuffle the previously given array (which then will be returned).

This way no side effect is done in the Transformation class itself.

@lscharmer lscharmer self-assigned this Oct 25, 2021
Copy link
Collaborator

@mjansenDatabay mjansenDatabay left a comment

Choose a reason for hiding this comment

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

  • Please create a random() method in src/Refinery/Factory.php
  • RandomGroupshould only be instantiated within this method in theRefinery Factory (and in unit tests)
  • Please don't create instances in consuming code, alway use $DIC->refinery()->random().

@lscharmer lscharmer force-pushed the feature/refinery-random branch from 7a208b8 to 5f6c2be Compare November 4, 2021 10:46
lscharmer pushed a commit that referenced this pull request Jan 5, 2022
PHP8 -Language Service Refactoring
lscharmer pushed a commit that referenced this pull request May 31, 2022
lscharmer pushed a commit that referenced this pull request May 31, 2022
Hi Fabian,

a PHP Fatal Error occurs when performing setup command 'migrate':

PHP Fatal error:  Uncaught ILIAS\Setup\UnachievableException: Problem in DB-Update: 0 Return value of ilStaticCache::set() must be of the type bool, array returned in /***/trunk8/Services/GlobalCache/classes/Static/class.ilStaticCache.php:33#0 /***/trunk8/Services/GlobalCache/classes/class.ilGlobalCache.php(307): ilStaticCache->set()
#1 /***/trunk8/Services/Language/classes/class.ilCachedLanguage.php(62): ilGlobalCache->set()
#2 /***/trunk8/Services/Language/classes/class.ilCachedLanguage.php(29): ilCachedLanguage->writeToCache()
#3 /***/trunk8/Services/Language/classes/class.ilCachedLanguage.php(107): ilCachedLanguage->__construct()
#4 /***/trunk8/Services/Language/classes/class.ilLanguage.php(91): ilCachedLanguage::getInstance()
#5 /***/trunk8/Services/Language/classes/class.ilLanguage.php(374): ilLanguage->__construct in /***/trunk8/Services/Database/classes/Setup/class.ilDatabaseUpdatedObjective.php on line 72
lscharmer pushed a commit that referenced this pull request Jun 28, 2022
lscharmer pushed a commit that referenced this pull request Jun 28, 2022
…uestionPool::toXML(): Argument #1 () must be of type array…
lscharmer pushed a commit that referenced this pull request Jul 18, 2022
…rown with message ilObject::_lookupObjId(): Argument #1
lscharmer pushed a commit that referenced this pull request Jul 18, 2022
…($additionalContentEditingMode) must be of type string, null given,
lscharmer pushed a commit that referenced this pull request Jul 18, 2022
…ubScreenId(): Argument #1 ($a_id) must be of type string, null given"
lscharmer pushed a commit that referenced this pull request Aug 10, 2022
…sults in error / ilHelpGUI::setSubScreenId(): Argument #1 must be a string
lscharmer pushed a commit that referenced this pull request Aug 10, 2022
…alue(): Argument #1 ($a_value) must be of type string…"
lscharmer pushed a commit that referenced this pull request Nov 28, 2022
lscharmer pushed a commit that referenced this pull request Nov 28, 2022
…own with message ilAlphabetInputGUI::fixDBUmlauts(): Argument #1 () must be of
lscharmer pushed a commit that referenced this pull request Jan 13, 2023
…own with message ilAlphabetInputGUI::fixDBUmlauts(): Argument #1 () must be of
lscharmer pushed a commit that referenced this pull request Feb 28, 2023
occured TypeError:

TypeError thrown with message "str_pad(): Argument #1 ($string) must be of type string, int given"

Stacktrace:
ILIAS-eLearning#7 TypeError in /srv/www/9/trunk9/Services/Object/classes/class.ilObjectDefinition.php:74
ILIAS-eLearning#6 str_pad in /srv/www/9/trunk9/Services/Object/classes/class.ilObjectDefinition.php:74
[...]
lscharmer pushed a commit that referenced this pull request May 5, 2023
…($data) must be of type string, null given
lscharmer pushed a commit that referenced this pull request May 15, 2023
…($data) must be of type string, null given
lscharmer pushed a commit that referenced this pull request Aug 2, 2023
lscharmer pushed a commit that referenced this pull request Sep 27, 2023
…ink\{closure}(): Argument #1 () must of type int, string given
lscharmer pushed a commit that referenced this pull request Oct 30, 2023
occured TypeError:

TypeError thrown with message "str_pad(): Argument #1 ($string) must be of type string, int given"

Stacktrace:
ILIAS-eLearning#7 TypeError in /srv/www/9/trunk9/Services/Object/classes/class.ilObjectDefinition.php:74
ILIAS-eLearning#6 str_pad in /srv/www/9/trunk9/Services/Object/classes/class.ilObjectDefinition.php:74
[...]
lscharmer pushed a commit that referenced this pull request Nov 6, 2023
lscharmer pushed a commit that referenced this pull request Nov 16, 2023
lscharmer pushed a commit that referenced this pull request Jan 15, 2024
lscharmer pushed a commit that referenced this pull request Jan 15, 2024
lscharmer pushed a commit that referenced this pull request Jan 16, 2024
lscharmer pushed a commit that referenced this pull request Jun 11, 2024
…#7410)

TypeError thrown with message "Return value of ilObjSurvey::getAnonymousIdByCode() must be of the type int, null returned"

Stacktrace:
ILIAS-eLearning#9 TypeError in /var/www/html/Modules/Survey/classes/class.ilObjSurvey.php:4702
ILIAS-eLearning#8 ilObjSurvey:getAnonymousIdByCode in /var/www/html/Modules/Survey/Execution/class.ilSurveyExecutionGUI.php:175
ILIAS-eLearning#7 ilSurveyExecutionGUI:checkAuth in /var/www/html/Modules/Survey/Execution/class.ilSurveyExecutionGUI.php:354
ILIAS-eLearning#6 ilSurveyExecutionGUI:outSurveyPage in /var/www/html/Modules/Survey/Execution/class.ilSurveyExecutionGUI.php:280
#5 ilSurveyExecutionGUI:redirectQuestion in /var/www/html/Modules/Survey/Execution/class.ilSurveyExecutionGUI.php:140
#4 ilSurveyExecutionGUI:executeCommand in /var/www/html/Services/UICore/classes/class.ilCtrl.php:199
#3 ilCtrl:forwardCommand in /var/www/html/Modules/Survey/classes/class.ilObjSurveyGUI.php:206
#2 ilObjSurveyGUI:executeCommand in /var/www/html/Services/UICore/classes/class.ilCtrl.php:199
#1 ilCtrl:forwardCommand in /var/www/html/Services/UICore/classes/class.ilCtrl.php:174
#0 ilCtrl:callBaseClass in /var/www/html/ilias.php:24
lscharmer pushed a commit that referenced this pull request Jun 24, 2024
…#7410)

TypeError thrown with message "Return value of ilObjSurvey::getAnonymousIdByCode() must be of the type int, null returned"

Stacktrace:
ILIAS-eLearning#9 TypeError in /var/www/html/Modules/Survey/classes/class.ilObjSurvey.php:4702
ILIAS-eLearning#8 ilObjSurvey:getAnonymousIdByCode in /var/www/html/Modules/Survey/Execution/class.ilSurveyExecutionGUI.php:175
ILIAS-eLearning#7 ilSurveyExecutionGUI:checkAuth in /var/www/html/Modules/Survey/Execution/class.ilSurveyExecutionGUI.php:354
ILIAS-eLearning#6 ilSurveyExecutionGUI:outSurveyPage in /var/www/html/Modules/Survey/Execution/class.ilSurveyExecutionGUI.php:280
#5 ilSurveyExecutionGUI:redirectQuestion in /var/www/html/Modules/Survey/Execution/class.ilSurveyExecutionGUI.php:140
#4 ilSurveyExecutionGUI:executeCommand in /var/www/html/Services/UICore/classes/class.ilCtrl.php:199
#3 ilCtrl:forwardCommand in /var/www/html/Modules/Survey/classes/class.ilObjSurveyGUI.php:206
#2 ilObjSurveyGUI:executeCommand in /var/www/html/Services/UICore/classes/class.ilCtrl.php:199
#1 ilCtrl:forwardCommand in /var/www/html/Services/UICore/classes/class.ilCtrl.php:174
#0 ilCtrl:callBaseClass in /var/www/html/ilias.php:24
lscharmer pushed a commit that referenced this pull request Jun 24, 2024
…eyCategories::addCategory(): Argument #1 () must be o
lscharmer pushed a commit that referenced this pull request Jun 24, 2024
…#7410)

TypeError thrown with message "Return value of ilObjSurvey::getAnonymousIdByCode() must be of the type int, null returned"

Stacktrace:
ILIAS-eLearning#9 TypeError in /var/www/html/Modules/Survey/classes/class.ilObjSurvey.php:4702
ILIAS-eLearning#8 ilObjSurvey:getAnonymousIdByCode in /var/www/html/Modules/Survey/Execution/class.ilSurveyExecutionGUI.php:175
ILIAS-eLearning#7 ilSurveyExecutionGUI:checkAuth in /var/www/html/Modules/Survey/Execution/class.ilSurveyExecutionGUI.php:354
ILIAS-eLearning#6 ilSurveyExecutionGUI:outSurveyPage in /var/www/html/Modules/Survey/Execution/class.ilSurveyExecutionGUI.php:280
#5 ilSurveyExecutionGUI:redirectQuestion in /var/www/html/Modules/Survey/Execution/class.ilSurveyExecutionGUI.php:140
#4 ilSurveyExecutionGUI:executeCommand in /var/www/html/Services/UICore/classes/class.ilCtrl.php:199
#3 ilCtrl:forwardCommand in /var/www/html/Modules/Survey/classes/class.ilObjSurveyGUI.php:206
#2 ilObjSurveyGUI:executeCommand in /var/www/html/Services/UICore/classes/class.ilCtrl.php:199
#1 ilCtrl:forwardCommand in /var/www/html/Services/UICore/classes/class.ilCtrl.php:174
#0 ilCtrl:callBaseClass in /var/www/html/ilias.php:24
lscharmer pushed a commit that referenced this pull request Jun 24, 2024
…eyCategories::addCategory(): Argument #1 () must be o
lscharmer pushed a commit that referenced this pull request Apr 3, 2025
…strip_tags(): Argument #1 ($string) must be of type string, null given

# Conflicts:
#	components/ILIAS/ResourceStorage/src/Preloader/SecureString.php
lscharmer pushed a commit that referenced this pull request Apr 11, 2025
…strip_tags(): Argument #1 ($string) must be of type string, null given
lscharmer pushed a commit that referenced this pull request May 14, 2025
…strip_tags(): Argument #1 ($string) must be of type string, null given
lscharmer pushed a commit that referenced this pull request Sep 23, 2025
lscharmer pushed a commit that referenced this pull request Oct 10, 2025
lscharmer pushed a commit that referenced this pull request Nov 3, 2025
lscharmer pushed a commit that referenced this pull request Jan 6, 2026
lscharmer pushed a commit that referenced this pull request Jan 6, 2026
lscharmer pushed a commit that referenced this pull request Jan 6, 2026
lscharmer pushed a commit that referenced this pull request Jan 6, 2026
lscharmer pushed a commit that referenced this pull request Jan 6, 2026
lscharmer pushed a commit that referenced this pull request Jan 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants