Semanticmediawiki: FormsBuilder.php producing a PHP Warning

Created on 1 Sep 2019  路  6Comments  路  Source: SemanticMediaWiki/SemanticMediaWiki

Setup and configuration

  • SMW version: 3.0.2
  • MW version: 1.31.0
  • PHP version: 7.1.31
  • MySQL version: 5.6.44-86.0

Issue

Using this search profile form definition the following appears on Special:Search:

Warning: is_array() expects exactly 1 parameter, 0 given in /w/extensions/SemanticMediaWiki/src/MediaWiki/Search/Form/FormsBuilder.php on line 249

(I am still learning search profiles, I don't know what is wrong).

bug

Most helpful comment

(I am still learning search profiles, I don't know what is wrong).

As for the "don't know what is wrong", the code is wrong not your schema. On the matter of "I am still learning", if something is unclear on the provide wiki page or [0] docu then just create a new ticket or make suggestions on how to improve the documentation (and examples) and make it more user friendly.

[0] https://github.com/SemanticMediaWiki/SemanticMediaWiki/tree/master/src/MediaWiki/Search

All 6 comments

Warning: is_array() expects exactly 1 parameter, 0 given in /w/extensions/SemanticMediaWiki/src/MediaWiki/Search/Form/FormsBuilder.php on line 249

Okay, if we look at the code above we'll see something like:

        if ( isset( $data['namespaces']['hidden'] ) && is_array(  ) ) {
            $this->hidden_namespaces( $data['namespaces']['hidden'] );
        }

Now, && is_array( ) should actually be && is_array( $data['namespaces']['hidden'] ), so during some copy and pasting the inner part went missing and is the reason for the " is_array() expects exactly 1 parameter" message.

(I am still learning search profiles, I don't know what is wrong).

As for the "don't know what is wrong", the code is wrong not your schema. On the matter of "I am still learning", if something is unclear on the provide wiki page or [0] docu then just create a new ticket or make suggestions on how to improve the documentation (and examples) and make it more user friendly.

[0] https://github.com/SemanticMediaWiki/SemanticMediaWiki/tree/master/src/MediaWiki/Search

Thanks @mwjames. Shoud I make a PR with this change or are you going to make it?

Shoud I make a PR with this change or are you going to make it?

You could have been bold here. ;) Just made #4285 Anyways it will indeed be much appreciated if you could have a peep at the docu.

Anyways it will indeed be much appreciated if you could have a peep at the docu.

Ok, here it is.

Ok, here it is.

Thanks a lot! Did some minor fluff and published.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jaideraf picture jaideraf  路  3Comments

WolfgangFahl picture WolfgangFahl  路  3Comments

jaideraf picture jaideraf  路  3Comments

JeroenDeDauw picture JeroenDeDauw  路  3Comments

mwjames picture mwjames  路  3Comments