Mismatched function declaration, update_url() in lib/activity.php
Bug #1605127 reported by
Howard Miller
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Mahara |
Fix Released
|
Medium
|
Aaron Wells | ||
15.04 |
Fix Released
|
Medium
|
Aaron Wells | ||
15.10 |
Fix Released
|
Medium
|
Aaron Wells | ||
16.04 |
Fix Released
|
Medium
|
Aaron Wells | ||
16.10 |
Fix Released
|
Medium
|
Aaron Wells |
Bug Description
Branch 16.04
In lib/activity.php at approx line 710 the function update_url() is declared. It has no parameters.
However, at approx line 750 it is called and a parameter ($userdata-
tags: | added: php7 |
summary: |
- Mismatched function declaration, urdate_url() in lib/activity.php + Mismatched function declaration, update_url() in lib/activity.php |
Changed in mahara: | |
status: | Fix Committed → Fix Released |
milestone: | 16.10.0 → none |
To post a comment you must log in.
Hi Howard,
You are correct. The abstract "Activity" class defines update_url() with no parameters, but then calls it with one parameter a few lines later.
The excess parameter itself actually doesn't cause any problems. If you're calling $this-> update_ url($something) on an Activity subclass that doesn't override update_url(), then PHP will silently accept it and assume you're doing a variable-length argument list ( http:// php.net/ manual/ en/functions. arguments. php#functions. variable- arg-list ). In PHP 5.5 it won't even print an E_STRICT warning or anything. In PHP 5.6 and up, it might, since they've added the "..." syntax to explicitly indicate a variable-length argument list.
The bigger problem here is the mismatch in the signature of the update_url() method between Activity and its subclasses. That will throw an E_STRICT warning in PHP 5, but it's a fatal error in PHP 7.