In an attempt to not re-invent the wheel, I've been working on a CMS's text-sanitization layer. I found that SimplePie had a really good one in use with it's RSS feed, but it had a lot of features that I didn't need (such as image cache-ing, making relative urls absolute, etc.) so the actual amount of code that I'm using that's more-or-less a direct copy of SimplePie's code, is maybe 20-30% of the original SimplePie_Sanitize class code.

My question is, since it's not exactly a direct copy (agree'd there are parts that are, and parts that aren't as I had to bring it up to PHP 5.3.6 spec and what-not), how much of the code has to be a direct copy for the BSD license (which SimplePie uses) to apply?

Keep in mind I'm going to be adding some of my own things into the code as well to help prevent XSS attacks so the class will eventually may only be 50% original, and 50% of the copied (or at least, the 20-30% that's left of it).

With that: is a simple 'THIS HAS CODE FROM THIS PROJECT' disclaimer enough, or do I have to apply the BSD license to the entire code file?

4 Answers 4


What does the BSD licence say about this ?

If it were GPL then any amount of code derived from any amount of code from a GPL'd project would make your code GPL. Then using this code in your project would make your entire project GPL as well.

If it were LGPL then you could use simple pie without licence transference but you if you derive code then the derived code must also take the licence from the original work.

If it were Apache style stating you used code from the project in your documentation (about box for example) and making the text of the original licence available would be enough...

So your question makes no sense as a general statement, it all depends on the licence of the software you took stuff from or used in your project.

From what I understand the BSD is very liberal. It only states that you cannot state the work is entirely yours nor can you say that the team that authored the original work endorse your system in any way. So yes, in your case here, simply stating that some of the code came from the SimplePie project should be enough to satisfy the licence's requirement. In short they want you to give credit while keeping them independent from your work.

One last thing I would like to add though... I am not a lawyer nor do I claim to have any legal expertise, just worked for along time in companies that took licencing very seriously so I had to be careful what dependencies I use.

  • Quoting the BSD license: Redistribution and use in source and binary forms, with or without modification, are permitted provided the following conditions are met. Then it goes on to list that redistribution must retain the copyright, and the conditions, something that doesn't apply to me since I'm not distributing binary, and then a bit about how you can't use the name of the organization (or it's contrubtors) to endorse or promote the redistribution (without written consent). Since it says I must retain copyright, even with modded code, I'm guessing that I need to use BSD. Just a guess tho.
    – Mike S
    Apr 20, 2011 at 2:12
  • 1
    Redistribution and use in source and binary form, with or without modification. These are the keywords you need to be watchful for, legal documents are often written with many combinatorial statements like this so that the same sentence can be read in many different ways while retaining it`s legal value. One could say they strive to achieve maximum semantic compression. This said, if BSD licence is ok for you then just release with it, I would still mention that some work was derived from SimplePie but that's more of a courtesy than upholding the licence.
    – Newtopian
    Apr 20, 2011 at 2:25
  • 3
    So basically you are using and modifying the source, hence said portions ARE covered by the licence. This however does not mean that the whole work must follow the same licence, that will depend on the licence itself. Again, this is just my humble personal opinion, in most cases if you do what "feels" right then you should be OK. The simple fact that you are questioning yourself here tells me your motives are honest. The whole idea behind open source is to do just what you are doing, BSD being one of the most open licence there is so in the end your conscience should show you the way
    – Newtopian
    Apr 20, 2011 at 2:34
  • "If it were GPL then any amount of code derived from any amount of code from a GPL'd project would make your code GPL. Then using this code in your project would make your entire project GPL as well." Which shows that the GPL is in violation of "fair use" clauses in copyright laws.
    – jwenting
    Apr 20, 2011 at 6:31
  • @jwenting : perhaps it does, professional legal advice or a challenge in court could provide answers here. Then again, the spirit of the licence is not to prohibit use unless specifically authorised (copyright) but places condition that if you choose to use it you must make your derivative work usable by others in the same way. Actually, in this view, GPL encourages fair use if anything. Like I said, I am not a lawyer nor do I try to test the legal validity of said licence. I just try to understand it and respect it as best I can.
    – Newtopian
    Apr 20, 2011 at 6:55

I would think that the use of any part of their source no matter how seemingly insignificant still requires you follow their license... then again I'm no law man so hell if I know.

  • sight... I should learn to be concise... +1. Exactly what I answered, 20 seconds before I did, just not in so many words !!!
    – Newtopian
    Apr 20, 2011 at 2:06
  • This is obviously not true, because small enough parts of their code also appear in other people's code (say, checking the results of string parsing).
    – einpoklum
    Nov 24, 2016 at 23:15
  • @einpoklum If you happen to have the same code, that's fine. If you take the code from someone else then you must follow the license. Simple as that.
    – user7007
    Dec 1, 2016 at 16:45
  • @GlennNelson: No, it isn't as simple as that. In music I know there are often protracted legal battles regarding what minimum length or complexity of a sequence requires licensing. The thing is, for short pieces of code you cannot distinguish between copying and happening-to-have-the-same.
    – einpoklum
    Dec 1, 2016 at 19:34
  • 1
    @einpoklum Ok, if you want to play lawyer, yes, you can steal code from a project and likely get away with it. The point of the question is not to ask "What can I get away with.", however. If you want to advocate criminal activity, by all means do so but it is not the correct answer.
    – user7007
    Dec 1, 2016 at 19:40

The BSD license is not a copyleft license, so you shouldn't have to BSD-license your code as long as you provide the required notice. I'm not a lawyer but that's how I understood it.


As long as it is enough code that a judge would believe that your work is a derived work, the license applies. Where that threshold happens is a judgement call, and is not entirely clear. If you really want clarity, the best that you can do is consult a lawyer and get legal advice. (You will have to pay for this, because if you get the answer then do something stupid - even if that is because of your misunderstanding of the answer given - you can sue the lawyer. Lawyers don't like to be liable for random stuff.)

As a rule of thumb, I've seen many projects say that 10 lines is the point where they worry about copyrights. This does not mean that anything over 10 lines is copyrightable (certainly not, as many cases have shown) or that anything under 10 lines is not copyrightable. But it is a level of copying that they feel comfortable won't cause a problem.

But their comfort level may not be yours. If in doubt, err towards respecting copyrights.

That said, the BSD license is pretty generous. There is no problem with your writing proprietary code that borrows BSD code. Lots of people do so without trouble.

Standard disclaimer. I am not a lawyer, and this is not legal advice. Also be aware that the answers will vary strongly by country.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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