There is this source code on GitHub (a PHP class, around 200 lines of code) distributed under GPL license which has some bugs and is not useful to me unless those bugs are fixed. If I fix those bugs, can I use the new code in my product commercially?


Yes, so long as the commercial product is released under the GNU GPL.

Assuming the GNU GPL v3 for clarity's sake (the same conclusion would be reached for the GPL v2, just the wording is different):

  • By fixing the bugs, you are producing a "work based on the Program". If distributed, this modified work must be licensed under the GPL.
  • You can then incorporate the modified work into your commercial product, and then distribute the commercial product under the GPL in accordance with any of the options in section 6 of the GPL - note that all these require you to release the full source (not just that of the modified code) of your commercial product.
  • 4
    This is all correct, however: since PHP is chiefly a Web language, it is probably worth noting that if the class is not distributed (i.e., if the class is only used to render or process information for a client accessing a network service), GPL distribution obligations do not apply. (I realize that the OP says "distributed" in the post, though they might be unaware of the important nuance that use in a service is not actually distribution.) – apsillers Jun 7 '18 at 22:06
  • 1
    @apsillers The distribution obligations apply, but only to the people you distribute the code to. For example, a likely scenario is that I make a product which I distribute to a company that will then host a web service. In that case I must give that company the source code, along with the rights that the GPL allows (right to make verbatim copies, etc.). – Brandin Jun 8 '18 at 8:33
  • @Brandin Unless the OP is doing a pure SaaS play in which case they don't distribute it to anyone. But yeah, the devil is in the details here. – Philip Kendall Jun 8 '18 at 10:53
  • @Brandin: Your example is not correct. Uploading content to diskspace that you rent from a hosting provider is not considered distribution to that hosting provider, as you are not giving that provider control over what to do with the files. – Bart van Ingen Schenau Jun 9 '18 at 18:08
  • @BartvanIngenSchenau I mean you develop a product and then give to company C who then hosts it on their servers or someone else's. In that case you are distributing to C and must give them the source and whatever rights the GPL entails. – Brandin Jun 10 '18 at 20:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.