Jump to content

500 Error on wire/modules.php when testing Fieldtype in development


BrendonKoz
 Share

Recommended Posts

I must obviously be doing something wrong in my hackish attempts to develop a Fieldtype. The inputfield and fieldtype are installed successfully, but as soon as I attempt to create a field using the fieldtype, I immediately (upon submit of the field creation form) receive a 500 error. It took me awhile to realize that ProcessWire was snatching the error message away from the server though! Error found in: /site/assets/logs/error.txt:

Quote

2017-11-02 13:43:07    ?    http://127.0.0.1/?/    Error:     Call to a member function hasPermission() on null (line 1287 of C:\Users\bkozlowski.SARWIN2K\Desktop\UwAmp\www\pw_plugin_test\wire\core\Modules.php)

This was a completely clean install of PW v3.0.78 running the classic theme. Immediately after setup I installed my "under development" fieldtype module and the above occurred. I'm uncertain where to look since this seems to be referencing hasPermission in a core file, but as far as I'm aware I wasn't referencing permissions in my (inputfield and fieldtype) modules.

I've attached my files if anyone wants to take a quick look, but I'm still confused why a core file might be rendering the error.

Someone else had this issue with their site during a module update, so perhaps it's a versioning issue (I very well may be mixing old PW module code with new)...
https://processwire.com/talk/topic/16358-error-call-to-a-member-function-haspermission-on-null/

 

FieldtypeBook.info.json

FieldtypeBook.module

InputfieldBook.module

OpenLibraryBook.php

Link to comment
Share on other sites

FieldtypeBook.info.json:

{
    "title": "FieldtypeBook",
    "version": "0.0.1",
    "summary": "Field that stores one or more books with optional metadata.",
    "author": "Brendon Kozlowski",
    "icon": "book",
    "href": "",
    "permission": [
        ""
    ],
    "autoload": false,
    "singular": true,
    "permanent": false,
    "requires": [
        "PHP>=5.6.0",
        "ProcessWire>=2.5.28",
        ""
    ],
    "installs": [
        "InputfieldBook"
    ]
}

The "permission" option here is the problem.

Remove all the cases where you are setting items to "" - if you don't need to set a value for an option then simply don't include it in the JSON.

{
    "title": "FieldtypeBook",
    "version": "0.0.1",
    "summary": "Field that stores one or more books with optional metadata.",
    "author": "Brendon Kozlowski",
    "icon": "book",
    "autoload": false,
    "singular": true,
    "permanent": false,
    "requires": [
        "PHP>=5.6.0",
        "ProcessWire>=2.5.28"
    ],
    "installs": [
        "InputfieldBook"
    ]
}

 

  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...