Reviewed: https://reviews.mahara.org/10711 Committed: https://git.mahara.org/mahara/mahara/commit/4263848b4e4cc87a57d8719123b7a363bcbebf45 Submitter: Cecilia Vela Gurovic (cecili...@catalyst.net.nz) Branch: master
commit 4263848b4e4cc87a57d8719123b7a363bcbebf45 Author: Rebecca Blundell <rebeccablund...@catalyst.net.nz> Date: Mon Jan 13 16:19:13 2020 +1300 Bug 1839411: Update Mahara to work with PHP7.3/7.4 Fixed strpos error picked up by 7.3 I haven't found any other 7.3 issues and none have been caught by behat For 7.4: -Fixed implode param order (glue, parts) Note that Mink has a reversed implode not fixed upstream: external/vendor/behat/mink/src/Selector/Xpath/Escaper.php:50 I have added a function to copy the correct code over in the interim I also pushed a change to an HTMLPurifier file as it is not fixed upstream -Changed a variable read by fread to allow for false return type -Calling a non-array as an array now causes an error, meaning we need to confirm an array value before attempting to use a variable. An obvious case is in multi-record db calls the return value is either an array of results or false. E.g. $array = db_call();//returns false as no results //do sth with result $var = $array[0]//error, trying to access type false as array //instead we need to check the value before accessing: $var = !empty($array[0]) ? $array[0] : false //or some equivalent check of the db_call's return Because of this change, I have attempted to check all the multi-db calls for possible false results and include a check for that if there wasn't already one. -In conjunction with the previous work, I noticed that trying to use foreach on a non-iterable result causes an error and that array functions (i.e. array_keys()) called on a non-array also cause an error. Where I found them I added checks as well. -A change in PHP7.2 was that items counted with count() must implement Countable. (i.e, int/bool is not OK). I fixed the ones I found. -I used the regex \{\$?\d?[^\s]\} to search for array access using {} instead of [] and changed those. (Note: the regex pulls in a lot more) CSStidy has a lot of these that aren't fixed, but those are covered by the CSStidy upgrade (Bug 1840099) Change-Id: I64a8feb821433ecd99463762a9999449c50ee32e -- You received this bug notification because you are a member of Mahara Contributors, which is subscribed to Mahara. Matching subscriptions: Subscription for all Mahara Contributors -- please ask on #mahara-dev or mahara.org forum before editing or unsubscribing it! https://bugs.launchpad.net/bugs/1839411 Title: Update codebase for php 7.3 and php 7.4 Status in Mahara: Fix Committed Bug description: I tried running behat tests in php 7.3 and among other issues got the following error due to a PHP 7.3 deprecation: /code/mahara/test/behat/features/site_features/smart_evidence_editor.feature:8 8192: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in ~/code/mahara/htdocs/lib/mahara.php line 1620 This made me think we should check the code for this and other 7.3 issues. Notes on migrating to 7.3: https://www.php.net/manual/en/migration73.php And on migrating to 7.4: https://www.php.net/manual/en/migration74.php To manage notifications about this bug go to: https://bugs.launchpad.net/mahara/+bug/1839411/+subscriptions _______________________________________________ Mailing list: https://launchpad.net/~mahara-contributors Post to : mahara-contributors@lists.launchpad.net Unsubscribe : https://launchpad.net/~mahara-contributors More help : https://help.launchpad.net/ListHelp