Uploaded image for project: 'phpBB3'
  1. phpBB3
  2. PHPBB3-11871

Extension modules are not working with namespaces anymore

    Details

      Description

      Something went wrong during the request and an exception was thrown. The changes made before the error occurred were reversed to the best of our abilities, but you should check the board for errors.

      A required module info file is missing: nickvergessennewspageacpmain_module

      Note: all \ got removed from the class name

        Activity

        Hide
        EXreaction EXreaction [X] (Inactive) added a comment -

        Where do you get this error?

        Show
        EXreaction EXreaction [X] (Inactive) added a comment - Where do you get this error?
        Hide
        imkingdavid David King added a comment -

        During extension installation (applying the migration). Due to https://github.com/phpbb/phpbb3/blob/develop/phpBB/phpbb/db/migration/tool/module.php#L185 – also occurs during the remove() method.

        https://github.com/imkingdavid/prefixed/blob/0d6d3c413f531e04f96b201a4183a82a8b28d9fa/migrations/v10x/m2_initial_data.php#L52 is the module.add call. All / and
        are replaced with nothing resulting in imkingdavidprefixedacpprefixed_module

        If I remove the namespace stuff from the basename, the extension installs but the module is inaccessible.

        Show
        imkingdavid David King added a comment - During extension installation (applying the migration). Due to https://github.com/phpbb/phpbb3/blob/develop/phpBB/phpbb/db/migration/tool/module.php#L185 – also occurs during the remove() method. https://github.com/imkingdavid/prefixed/blob/0d6d3c413f531e04f96b201a4183a82a8b28d9fa/migrations/v10x/m2_initial_data.php#L52 is the module.add call. All / and are replaced with nothing resulting in imkingdavidprefixedacpprefixed_module If I remove the namespace stuff from the basename, the extension installs but the module is inaccessible.
        Hide
        nickvergessen Joas Schilling added a comment -

        Exreaction it happens when installing/uninstalling an extension

        Show
        nickvergessen Joas Schilling added a comment - Exreaction it happens when installing/uninstalling an extension
        Hide
        imkingdavid David King added a comment -

        From IRC:

        <nickvergessen> imkingdavid: we have a problem
        <nickvergessen> Hi I would prefer Jungle please
        <nickvergessen> http://www.extensions.local/Newspage/phpBB/adm/index.php?i=\nickvergessen\newspage\acp\main_module&mode=config_newspage
        <nickvergessen> guess which character does not parse as url in posts
        <nickvergessen>
        <imkingdavid> for module basename we should probably replace \ with -
        <nickvergessen> yeah
        <nickvergessen> i guess so
        <imkingdavid> and remove the leading one
        <nickvergessen> no
        <nickvergessen> i just s/\/-
        <nickvergessen> so we can do it just the same way back
        <imkingdavid> so i=-nickvergessen ... ?
        <nickvergessen> yeah
        <nickvergessen> doesnt hurt
        <nickvergessen> no one will write it by hand anyway
        <imkingdavid> true

        Show
        imkingdavid David King added a comment - From IRC: <nickvergessen> imkingdavid: we have a problem <nickvergessen> Hi I would prefer Jungle please <nickvergessen> http://www.extensions.local/Newspage/phpBB/adm/index.php?i=\nickvergessen\newspage\acp\main_module&mode=config_newspage <nickvergessen> guess which character does not parse as url in posts <nickvergessen> <imkingdavid> for module basename we should probably replace \ with - <nickvergessen> yeah <nickvergessen> i guess so <imkingdavid> and remove the leading one <nickvergessen> no <nickvergessen> i just s/\/- <nickvergessen> so we can do it just the same way back <imkingdavid> so i=-nickvergessen ... ? <nickvergessen> yeah <nickvergessen> doesnt hurt <nickvergessen> no one will write it by hand anyway <imkingdavid> true
        Hide
        imkingdavid David King added a comment -

        BTW I looked into this some last night. To clarify, removing the namespace stuff from the basename would work, except that set_active() prepends acp_ to the basename name https://github.com/phpbb/phpbb3/blob/develop/phpBB/includes/functions_module.php#L404

        If you change the basename to, e.g. acp_prefixed_module it almost works except that it shows an error about being unable to find the module in ./includes/acp/acp_prefixed_module.php rather than looking in the extension directory.

        So what we need to do is replace \ with - on storage and undo the replacement after retrieval and use call_user_func to instantiate the namespaced object. Or something. My God, this system is crap.

        Show
        imkingdavid David King added a comment - BTW I looked into this some last night. To clarify, removing the namespace stuff from the basename would work, except that set_active() prepends acp_ to the basename name https://github.com/phpbb/phpbb3/blob/develop/phpBB/includes/functions_module.php#L404 If you change the basename to, e.g. acp_prefixed_module it almost works except that it shows an error about being unable to find the module in ./includes/acp/acp_prefixed_module.php rather than looking in the extension directory. So what we need to do is replace \ with - on storage and undo the replacement after retrieval and use call_user_func to instantiate the namespaced object. Or something. My God, this system is crap.

          People

          • Assignee:
            nickvergessen Joas Schilling
            Reporter:
            nickvergessen Joas Schilling
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development