thexerteproject / xerteonlinetoolkits

Xerte Online Toolkits
www.xerte.org.uk
Apache License 2.0
62 stars 61 forks source link

reported issues when using PHP 8.1 and other PHP version related issues #1143

Closed ronm123 closed 1 year ago

ronm123 commented 1 year ago
torinfo commented 1 year ago

Hmm. Somehow in PHP8.1 the tree structure of the workspace tree is different, i.e. the template_id is a number, not a string.

That means the the follwoing javascript fails:

function delete_template(template_id) {
    $.ajax({
        type: "POST",
        url: "website_code/php/templates/delete_template.php",
        data: {
            template_id: template_id.substr(template_id.indexOf("_") + 1, template_id.length)
        }
    })
    .done(function(response){
        delete_stateChanged(response);
    });
}

template_id.substr(templateid.indexOf("") + 1, template_id.length) failes, becasue template_id.indexOf does not exist.

But... I don't understand why that construct is there in the first place. I'll check on an install with htaccess apache shortcuts enabled.

torinfo commented 1 year ago

Even if apache mode is switched on, just the templateid is passed (without any '')

I removed the substr function and just pass the template_id.