Hi Wolfgang,

On  Mi 11 Jan 2017 23:32:05 CET, Wolfgang Schweer wrote:

On Wed, Jan 11, 2017 at 08:53:57PM +0000, Mike Gabriel wrote:
On  Mi 11 Jan 2017 16:47:51 CET, Wolfgang Schweer wrote:

[..]

> while testing Debian Edu stretch another PHP7 issue (constructor name)
> showed up.
>
> Please note that for some reason replacing the function name with
> '__constructor' doesn't work in this case.
>
> This patch seems to fix it:
>
> --- a/tabs_netgroup.inc    2017-01-11 16:20:32.203632303 +0100
> +++ b/tabs_netgroup.inc    2017-01-11 16:13:58.399201779 +0100
> @@ -23,7 +23,7 @@
>
>  class netgrouptabs extends tabs {
>
> -    function netgrouptabs($config, $data, $dn, $cat = "", $hide_refs =
> FALSE, $hide_acls = FALSE) {
> +    function __netgrouptabs($config, $data, $dn, $cat = "", $hide_refs
> = FALSE, $hide_acls = FALSE) {
>          tabs::__plugin($config, $data, $dn, "netgroups", $hide_refs,
> $hide_acls);
>          $this->addSpecialTabs();
>      }

[..]

Sorry, I doubt this, but are you sure about this?

While the above mentioned '__constructor' has been a typo this exact
replacement actually works; but, '__construct' (like used elswhere in
gosa to fix this PHP7 issue) does not. So yes, I'm pretty much sure.

I am not convinced about this after taking a second look. Unfortunately, I currently don't have a test system at hand to verify.

See here for PHP constructor and destructor docs:
http://php.net/manual/en/language.oop5.decon.php

Can you second it with some official PHP7 porting document or such?

No, but I guess that '__construct' fails as class netgrouptabs extends
tabs which already uses '__construct' - so anything different has to be
used.

The most likely thing to happen when naming the function __netgrouptabs() is that it is not executed at all, but instead parent::__construct() gets executed.

```
function netgrouptabs($config, $data, $dn, $cat = "", $hide_refs = FALSE, $hide_acls = FALSE) { tabs::__plugin($config, $data, $dn, "netgroups", $hide_refs, $hide_acls);
        $this->addSpecialTabs();
    }
```

So what happens is that $this->addSpecialTabs(); will not get called when instantiating the tabs. This results in missing tabs: ACL, References. I guess, those are missing in your setup now, right?

In object oriented programming, giving method names same names is common practice, so the method netgrouptabs::__construct() will overload the method parent::__construct() (i.e. tabs::__construct() here). The new method has to mimmick the parent's method's functionality (by simply calling it in most cases) and add some extra magic possibly.

I will now upload a fix for this (using __construct() ) with delay of 2 days so you can veto and cross check once more. Thanks!

Mike



--

DAS-NETZWERKTEAM
mike gabriel, herweg 7, 24357 fleckeby
mobile: +49 (1520) 1976 148
landline: +49 (4354) 8390 139

GnuPG Fingerprint: 9BFB AEE8 6C0A A5FF BF22  0782 9AF4 6B30 2577 1B31
mail: mike.gabr...@das-netzwerkteam.de, http://das-netzwerkteam.de

Attachment: pgp9_1K0W_gQv.pgp
Description: Digitale PGP-Signatur

Reply via email to