solved Module Uploading Error

nate
@nate
10 years ago
917 posts
When trying to upload a new marketplace module I get the follwing error from the included Stripe library.

Quote: Errors were found in your upload:
PHP Parse error: syntax error, unexpected 'public' (T_PUBLIC) in /home/jamroom/sites/www.jamroom.net/public_html/data/cache/jrNetworkMarket/TH1KTPfk/modules/n8MSOne/lib/Stripe/InvoiceItem.php on line 47 Errors parsing /home/jamroom/sites/www.jamroom.net/public_html/data/cache/jrNetworkMarket/TH1KTPfk/modules/n8MSOne/lib/Stripe/InvoiceItem.php

I see no errors in this file.

<?php

class Stripe_InvoiceItem extends Stripe_ApiResource{
  /**
   * @param string $id The ID of the invoice item to retrieve.
   * @param string|null $apiKey
   *
   * @return Stripe_InvoiceItem
   */
  public static function retrieve($id, $apiKey=null)
  {
    $class = get_class();
    return self::_scopedRetrieve($class, $id, $apiKey);
  }

  /**
   * @param array|null $params
   * @param string|null $apiKey
   *
   * @return array An array of Stripe_InvoiceItems.
   */
  public static function all($params=null, $apiKey=null)
  {
    $class = get_class();
    return self::_scopedAll($class, $params, $apiKey);
  }

  /**
   * @param array|null $params
   * @param string|null $apiKey
   *
   * @return Stripe_InvoiceItem The created invoice item.
   */
  public static function create($params=null, $apiKey=null)
  {
    $class = get_class();
    return self::_scopedCreate($class, $params, $apiKey);
  }

  /**
   * @return Stripe_InvoiceItem The saved invoice item.
   */
  public function save()
  {
    $class = get_class();
    return self::_scopedSave($class);
  }

  /**
   * @return Stripe_InvoiceItem The deleted invoice item.
   */
  public function delete($params=null)
  {
    $class = get_class();
    return self::_scopedDelete($class, $params);
  }
}

updated by @nate: 03/23/15 12:51:30AM
nate
@nate
10 years ago
917 posts
Also if these errors were also caught when creating the zip like they arwhen uploading it, could speed things up a bit.
nate
@nate
10 years ago
917 posts
Removing the comments from every file in the Stripe class got it to pass inspection. That can't be the way it's suppose to work.




updated by @nate: 02/16/15 12:06:24PM
brian
@brian
10 years ago
10,149 posts
Natedogg265:
Removing the comments from every file in the Stripe class got it to pass inspection. That can't be the way it's suppose to work.

No - that's not the way is supposed to work, nor is it how it works. When you upload a package unzips it and runs a PHP linter and syntax checker on it (part of the PHP core).

The reason it is done here on the system is that we have some extra tools in place that are likely not loaded on your system.

I'm not sure why it would have an error on those files UNLESS there was an actual error, so double check you've not added hidden characters into your files (as an FYI when I looked at your module you sent me a while back EVERY line had extra newline and return characters added in, so your editor could be messing things up).


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
nate
@nate
10 years ago
917 posts
I never edited any of those files aside from removing the comments today. Also, I just switched to PhpStorm last Friday.
brian
@brian
10 years ago
10,149 posts
You need to make sure any "contributed" code in your modules is in the "contrib" directory - i.e.

modules/n8MSOne/contrib/Stripe

NOT in "lib". The JR upload system will skip the files in "contrib" since it assumes you did not create them and they are OK.


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
nate
@nate
10 years ago
917 posts
I live, I learn. I'll rename the directory.
brian
@brian
10 years ago
10,149 posts
Yep - that's the easiest :)


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net

Tags