Forum

[PHP8] Depreciation...
 
Notifications
Retirer tout

[PHP8] Depreciation notice on require param after optional param

4 Posts
2 Utilisateurs
0 Reactions
1,900 Vu
(@bbalet)
Posts: 10
Active Member
Début du sujet
 
[#7158]

In view/objectDetail.php, you can find this odd signature with an optional paramater that is not placed at the end :
function drawStructureFromObject($obj, $refresh=false, $way, $item) {

This is depreciated in PHP8 and will cause an error with the following versions. After examining all the callers, I suggest to remove the optionnality:

function drawStructureFromObject($obj, $refresh, $way, $item) {

 


 
Posté : 5 Jan PM 13:011
(@bbalet)
Posts: 10
Active Member
Début du sujet
 

Same error, same fix for:

function drawSubscriptionsList($obj, $refresh=false, $limitToActive) {
function drawVersionStructureFromObjectAsset($obj, $refresh=false, $way, $item) {
function drawVersionStructureFromObject($obj, $refresh=false, $way, $item) {


 
Posté : 5 Jan PM 13:011
(@babynus)
Posts: 14952
Membre Admin
 

Hi,

Yes, I started to test under PHP8, wich requires (weel it's only deprecated message yet) that optional parameter cannot be followed by required one.
We fixed with different, but systematic solution : after optional parameter, existing required parameters are set option with null value

function drawStructureFromObject($obj, $refresh=false, $way=null, $item=null) {

This will work in all cases as these parameters are always set (they were required).


 
Posté : 6 Jan AM 02:011
(@babynus)
Posts: 14952
Membre Admin
 

function drawSubscriptionsList($obj, $refresh=false, $limitToActive) {
function drawVersionStructureFromObjectAsset($obj, $refresh=false, $way, $item) {
function drawVersionStructureFromObject($obj, $refresh=false, $way, $item) {
Yes, I already found these errors during first PHP8 testing, and few others in tcpdt_fonts.php, tcpdf_static.php, EmployeeManagerMain.php, RequestHandler.php, PlannningElementMain.php, ImputationLine.php and projeqtor.php


 
Posté : 6 Jan AM 02:011
Share:
Retour en haut