RSS Feed/News Use of func_num_args() makes methods non-extendable

Status
Not open for further replies.

ENXF NET

Administrator
Staff member
Administrator
Moderator
+Lifetime VIP+
S.V.I.P.S Member
S.V.I.P Member
V.I.P Member
Collaborate
Registered
Joined
Nov 13, 2018
Messages
28,827
Points
823

Reputation:

The use of the func_num_args() function within the XF/Mvc/Entity/Finder class makes those methods not extendable because if you pass null to the method, it's counted as an argument that was passed.

Let's say we have a class extension that hooks into the Finder::where() method...

PHP:

Code:
namespace Addon\XF\Finder;

class User extends XFCP_User
{
    public function where($condition, $operator = null, $value = null)
    {
        return parent::where($condition, $operator, $value);
    }...

Read more

Continue reading...
 
Status
Not open for further replies.
Top