WPBP / WordPress-Plugin-Boilerplate-Powered

Wordpress Plugin Boilerplate but Powered with examples and a generator!
https://wpbp.github.io/
GNU General Public License v3.0
782 stars 116 forks source link

Errors when generating / activating a plugin #132

Closed eleftrik closed 5 years ago

eleftrik commented 5 years ago

Hi, I just generated a standard wpbp.json inside wp-content/plugins/:

{
  "plugin": {
    "name": "Name",
    "version": "0.1.0"
  },
  "author": {
    "name": "Me",
    "email": "me@me.me",
    "url": "http://me@me.me",
    "license": "GPL 2.0+",
    "copyright": "2019 Me Ltd."
  },
  "public-assets": {
    "js": "true",
    "css": "true"
  },
  "act-deact": {
    "actdeact": "true",
    "uninstall": "true"
  },
  "admin-assets": {
    "admin-js": "true",
    "admin-css": "true",
    "settings-js": "true",
    "settings-css": "true",
    "admin-page": "true"
  },
  "ajax": {
    "public": "true",
    "admin": "true"
  },
  "git-repo": "true",
  "coffeescript": "true",
  "grunt": "true",
  "grumphp": "true",
  "phpcs-standard": "https://raw.githubusercontent.com/CodeAtCode/CodeatCS/master/codeat.xml",
  "unit-test": "true",
  "wpcli": "true",
  "language-files": "true",
  "libraries": [
    "Freemius/wordpress-sdk",
    "julien731/WP-Dismissible-Notices-Handler",
    "julien731/WP-Review-Me",
    "nathanielks/wp-admin-notice",
    "origgami/CMB2-grid",
    "mte90/wp-contextual-help",
    "WebDevStudios/CMB2",
    "johnbillion/extended-cpts",
    "stevegrunwell/wp-cache-remember",
    "WPBP/CPT_Columns",
    "WPBP/CronPlus",
    "WPBP/Debug",
    "WPBP/FakePage",
    "WPBP/Language",
    "WPBP/PointerPlus",
    "WPBP/Requirements",
    "WPBP/Template",
    "WPBP/Widgets-Helper",
    "WPBP/Backbone-Modal-View",
    "Yoast/i18n-module",
    "Yoast/whip"
  ],
  "snippet": {
    "backend": [
      "bubble-notification-pending-cpt",
      "dashboard-activity",
      "donate-link-plugin-list",
      "impexp-settings"
    ],
    "frontend": [
      "body-class",
      "cpt-search-support",
      "wp-localize-script",
      "shortcode",
      "template-system"
    ],
    "system": [
      "capability-system",
      "upgrade-procedure",
      "transient",
      "rest"
    ]
  }
}

After launching wpbp-generator --dark --dev --verbose I got this error:

Generating autoload files
PHP Fatal error:  Class 'Doctrine\Common\Collections\ArrayCollection' not found in /Users/<omitted>/test/wp/wp-content/plugins/name/vendor/phpro/grumphp/src/Collection/ProcessArgumentsCollection.php on line 8

Then, if I try to activate this plugin in /wp-admin, I got this error:

Warning: require(/app/wp-content/plugins/name/vendor/composer/../myclabs/deep-copy/src/DeepCopy/deep_copy.php): failed to open stream: No such file or directory in /app/wp-content/plugins/name/vendor/composer/autoload_real.php on line 66 Call Stack: 0.0037 422528 1. {main}() /app/wp-admin/plugins.php:0 0.3054 8341088 2. plugin_sandbox_scrape() /app/wp-admin/plugins.php:172 0.3055 8341952 3. include('/app/wp-content/plugins/name/name.php') /app/wp-admin/includes/plugin.php:1909 0.3055 8343208 4. require_once('/app/wp-content/plugins/name/vendor/autoload.php') /app/wp-content/plugins/name/name.php:67 0.3056 8343864 5. ComposerAutoloaderInitfc50f2424edbbe5a2d76f8b8c50df8c3::getLoader() /app/wp-content/plugins/name/vendor/autoload.php:7 0.3056 8347032 6. composerRequirefc50f2424edbbe5a2d76f8b8c50df8c3() /app/wp-content/plugins/name/vendor/composer/autoload_real.php:56 Fatal error: require(): Failed opening required '/app/wp-content/plugins/name/vendor/composer/../myclabs/deep-copy/src/DeepCopy/deep_copy.php' (include_path='.:/usr/local/lib/php') in /app/wp-content/plugins/name/vendor/composer/autoload_real.php on line 66 Call Stack: 0.0037 422528 1. {main}() /app/wp-admin/plugins.php:0 0.3054 8341088 2. plugin_sandbox_scrape() /app/wp-admin/plugins.php:172 0.3055 8341952 3. include('/app/wp-content/plugins/name/name.php') /app/wp-admin/includes/plugin.php:1909 0.3055 8343208 4. require_once('/app/wp-content/plugins/name/vendor/autoload.php') /app/wp-content/plugins/name/name.php:67 0.3056 8343864 5. ComposerAutoloaderInitfc50f2424edbbe5a2d76f8b8c50df8c3::getLoader() /app/wp-content/plugins/name/vendor/autoload.php:7 0.3056 8347032 6. composerRequirefc50f2424edbbe5a2d76f8b8c50df8c3() /app/wp-content/plugins/name/vendor/composer/autoload_real.php:56 

PHP version: 7.2 I run this WordPress project inside Docker containers (with Lando). What am I doing wrong?

Thanks for your support

Mte90 commented 5 years ago

Seems something based on https://www.google.com/search?client=firefox-b-d&q=PHP+Fatal+error%3A++Class+%27Doctrine%5CCommon%5CCollections%5CArrayCollection%27 Probably there is a dependence that is conflicting with other version. Probably there is something with codeception, you can try also to disable the unit test in this way codeception will be not downloaded. Another test is to add the latest codeception version (2.5.*) and see if this fix the issue.

Mte90 commented 5 years ago

I did a bump of the packages for composer and tested. I am not getting any error. I will probably do a new release soon.

eleftrik commented 5 years ago

Thank you @Mte90.

I set "unit-test": "false", but I got the same error about ArrayCollection inside grumphp.

So I set "grumphp": "false". This way, I got no errors from Composer; only a suggestion (Package webdevstudios/cmb2 is abandoned, you should avoid using it. Use cmb2/cmb2 instead.).

When activating the plugin, I got this fatal error:

Warning: require(/app/wp-content/plugins/name/vendor/composer/../julien731/wp-dismissible-notices-handler/includes/helper-functions.php): failed to open stream: No such file or directory in /app/wp-content/plugins/name/vendor/composer/autoload_real.php on line 66 Call Stack: 0.0033 426768 1. {main}() /app/wp-admin/plugins.php:0 3.5283 20905824 2. plugin_sandbox_scrape() /app/wp-admin/plugins.php:178 3.5285 20906104 3. include('/app/wp-content/plugins/name/name.php') /app/wp-admin/includes/plugin.php:1897 3.5286 20906944 4. require_once('/app/wp-content/plugins/name/vendor/autoload.php') /app/wp-content/plugins/name/name.php:67 3.5287 20907600 5. ComposerAutoloaderInit5e9027e9a87caba1d498717ca162af0b::getLoader() /app/wp-content/plugins/name/vendor/autoload.php:7 3.5296 20911072 6. composerRequire5e9027e9a87caba1d498717ca162af0b() /app/wp-content/plugins/name/vendor/composer/autoload_real.php:56 Fatal error: require(): Failed opening required '/app/wp-content/plugins/name/vendor/composer/../julien731/wp-dismissible-notices-handler/includes/helper-functions.php' (include_path='.:/usr/local/lib/php') in /app/wp-content/plugins/name/vendor/composer/autoload_real.php on line 66 Call Stack: 0.0033 426768 1. {main}() /app/wp-admin/plugins.php:0 3.5283 20905824 2. plugin_sandbox_scrape() /app/wp-admin/plugins.php:178 3.5285 20906104 3. include('/app/wp-content/plugins/name/name.php') /app/wp-admin/includes/plugin.php:1897 3.5286 20906944 4. require_once('/app/wp-content/plugins/name/vendor/autoload.php') /app/wp-content/plugins/name/name.php:67 3.5287 20907600 5. ComposerAutoloaderInit5e9027e9a87caba1d498717ca162af0b::getLoader() /app/wp-content/plugins/name/vendor/autoload.php:7 3.5296 20911072 6. composerRequire5e9027e9a87caba1d498717ca162af0b() /app/wp-content/plugins/name/vendor/composer/autoload_real.php:56

I tried to remove "julien731/WP-Dismissible-Notices-Handler" from libraries, run wpbp-generator again, but when trying to activate I got the same error.

Thank you

Mte90 commented 5 years ago

I am doing few tests and already fixed the issue with Grumphp, they released few hours a new release that fix this issue. I am investingating the other problem with that library.

Mte90 commented 5 years ago

I did a new release of the boilerplate and generator with fixes to these errors. Thanks for letting me know :-)

eleftrik commented 5 years ago

I did a new release of the boilerplate and generator with fixes to these errors. Thanks for letting me know :-)

Thank you @Mte90 for your quick reply! I will try again as soon as I can.

eleftrik commented 5 years ago

Just updated to latest version via composer global require wpbp/generator:dev-master

wpbp-generator --dark --verbose --json && \
wpbp-generator --dark --verbose

I only got two Notices:

😎 Downloading 3.0.1 package
Extract Boilerplate
Boilerplate Extracted
Rename in progress
Renamed /Users/....../wp-plugin/wp-content/plugins/name/languages/plugin-name.pot to /Users/....../wp-plugin/wp-content/plugins/name/languages/name.pot
PHP Notice:  Undefined index: libraries_webdevstudios__cmb2 in /Users/..../.composer/vendor/wpbp/generator/generator/remove.php on line 117

Notice: Undefined index: libraries_webdevstudios__cmb2 in /Users/..../.composer/vendor/wpbp/generator/generator/remove.php on line 117
Renamed /Users/....../wp-plugin/wp-content/plugins/name/plugin-name.php to /Users/....../wp-plugin/wp-content/plugins/name/name.php

Unfortunately, when activating the plugin in WordPress I still got the same fatal error:

Warning: require(/app/wp-content/plugins/name/vendor/composer/../myclabs/deep-copy/src/DeepCopy/deep_copy.php): failed to open stream: No such file or directory in /app/wp-content/plugins/name/vendor/composer/autoload_real.php on line 66 Call Stack: 0.0043 424144 1. {main}() /app/wp-admin/plugins.php:0 1.1136 8352656 2. plugin_sandbox_scrape() /app/wp-admin/plugins.php:172 1.1140 8353520 3. include('/app/wp-content/plugins/name/name.php') /app/wp-admin/includes/plugin.php:1909 1.1148 8354760 4. require_once('/app/wp-content/plugins/name/vendor/autoload.php') /app/wp-content/plugins/name/name.php:67 1.1153 8355416 5. ComposerAutoloaderInit9903fdd7f177c86ad9eea1ee270c5886::getLoader() /app/wp-content/plugins/name/vendor/autoload.php:7 1.1166 8358584 6. composerRequire9903fdd7f177c86ad9eea1ee270c5886() /app/wp-content/plugins/name/vendor/composer/autoload_real.php:56 Fatal error: require(): Failed opening required '/app/wp-content/plugins/name/vendor/composer/../myclabs/deep-copy/src/DeepCopy/deep_copy.php' (include_path='.:/usr/local/lib/php') in /app/wp-content/plugins/name/vendor/composer/autoload_real.php on line 66 Call Stack: 0.0043 424144 1. {main}() /app/wp-admin/plugins.php:0 1.1136 8352656 2. plugin_sandbox_scrape() /app/wp-admin/plugins.php:172 1.1140 8353520 3. include('/app/wp-content/plugins/name/name.php') /app/wp-admin/includes/plugin.php:1909 1.1148 8354760 4. require_once('/app/wp-content/plugins/name/vendor/autoload.php') /app/wp-content/plugins/name/name.php:67 1.1153 8355416 5. ComposerAutoloaderInit9903fdd7f177c86ad9eea1ee270c5886::getLoader() /app/wp-content/plugins/name/vendor/autoload.php:7 1.1166 8358584 6. composerRequire9903fdd7f177c86ad9eea1ee270c5886() /app/wp-content/plugins/name/vendor/composer/autoload_real.php:56

(even it's a warning, WordPress doesn't let me activate the plugin)

Mte90 commented 5 years ago

THere was a missing step to do on the generator but I will do another release for that fix. In the meantime I am doing af ull check and test to understand why it is happening this error. Beucase seems a problem of phpunit this time.

Mte90 commented 5 years ago

I did a new release of the boilerplate and the ngeerator. I found a different bug because of the migration of CMB2 but also on the generator that was removing folders that wasn't need to remove like stuff in vendor or nove_modules. Update the generator right now and everything should work, I did a lot of tests with your setting file :-)

davideprevosto commented 5 years ago

Hi, these are my settings:

  "plugin": {
    "name": "My Plugin",
    "version": "1.0.0"
  },
  "author": {
    "name": "me",
    "email": "info@me",
    "url": "https://www.me",
    "license": "GPL 2.0+",
    "copyright": "2019 me"
  },
  "public-assets": {
    "js": "true",
    "css": "true"
  },
  "act-deact": {
    "actdeact": "true",
    "uninstall": "true"
  },
  "admin-assets": {
    "admin-js": "false",
    "admin-css": "false",
    "settings-js": "true",
    "settings-css": "true",
    "admin-page": "true"
  },
  "ajax": {
    "public": "true",
    "admin": "false"
  },
  "git-repo": "false",
  "coffeescript": "false",
  "grunt": "false",
  "grumphp": "true",
  "phpcs-standard": "https://raw.githubusercontent.com/CodeAtCode/CodeatCS/master/codeat.xml",
  "unit-test": "true",
  "wpcli": "true",
  "language-files": "true",
  "libraries": [
    "Freemius/wordpress-sdk",
    "julien731/WP-Dismissible-Notices-Handler",
    "julien731/WP-Review-Me",
    "nathanielks/wp-admin-notice",
    "origgami/CMB2-grid",
    "mte90/wp-contextual-help",
    "WebDevStudios/CMB2",
    "johnbillion/extended-cpts",
    "stevegrunwell/wp-cache-remember",
    "WPBP/CPT_Columns",
    "WPBP/CronPlus",
    "WPBP/Debug",
    "WPBP/FakePage",
    "WPBP/Language",
    "WPBP/PointerPlus",
    "WPBP/Requirements",
    "WPBP/Template",
    "WPBP/Widgets-Helper",
    "WPBP/Backbone-Modal-View",
    "Yoast/i18n-module",
    "Yoast/whip"
  ],
  "snippet": {
    "backend": [
      "bubble-notification-pending-cpt",
      "dashboard-activity",
      "donate-link-plugin-list",
      "impexp-settings"
    ],
    "frontend": [
      "body-class",
      "cpt-search-support",
      "wp-localize-script",
      "shortcode",
      "template-system"
    ],
    "system": [
      "capability-system",
      "upgrade-procedure",
      "transient",
      "rest"
    ]
  }
}

I am getting:

Warning: require(/app/wp-content/plugins/my-plugin/vendor/composer/../wp-cli/mustangostang-spyc/includes/functions.php): failed to open stream:

Thanks

Mte90 commented 5 years ago

I generated a plugin with settings right now but I am not getting any error. Are you getting that during the generation or when you approve the plugin? Also are you using the latest version of the generator? In the past days I released different version that fixed some issues.

davideprevosto commented 5 years ago

@Mte90 I did update with the last generator version. It works. Thanks