#451 - Some models are broken on PHP 7+
Type Defect
Status Fixed
Milestone 3.7.2
Version 3.7.2
Component Core
Priority Highest
Severity Blocker
Owner alex
Assigned to Jack
Reported 6 years ago
Updated 4 years ago
Votes 0
Related tickets
Proposed time
Worked time

What did you do to cause this? Fresh installation

What page were you on? /users/1 and /admin/

What PHP and MariaDB versions do you run? PHP 7.1.1 and MariaDB 15.1

Describe the defect: PHP7 changed how variables-variables are processed (explanation here). Among other things, it makes the group view unloadable and breaks functionality such as admin panel.

I know that PHP 7 isn't officially supported in 3.X, but the fix is easy and won't break PHP 5.

File vendor/avalon/database/model.php line #401 changes from:

return $this->$var = $model::find($belongs_to['foreign_key'], $this->$belongs_to['column']);


return $this->$var = $model::find($belongs_to['foreign_key'], $this->{$belongs_to['column']});

Ticket History

6 years and 5 months ago by Jack

  • Component Core
  • Severity Normal Blocker
  • Priority Normal Highest
  • Status New Accepted
  • Assigned to Jack

Thank you for the report, I have not tested on PHP 7 much. Will try to get this done ASAP after work. Thank you again.

5 years ago by Eric TF Bat

The suggestion here is almost correct, and was good enough to help me when I tried installing Traq on a modern (ie PHP7) server, but the square brackets are erroneous. I just did this instead:

$xxx = $belongs_to['column'];
return $this->$var = $model::find($belongs_to['foreign_key'], $this->$xxx);

This really needs fixing. Nobody using PHP 7 will be able to use Traq without this, and your website(s) say nothing about the requirement to use ONLY version 5.x.

Jack closed as Fixed 4 years and 6 months ago