Submitting Patches

If you have modified a package to expand its functionality or to fix a bug, you should contribute your changes back to the community (some licenses force you to do so, and it is generally considered immoral not to).

Before creating the patch, you must first obtain the latest sources of the package you wish to patch from SVN by running the commands (the package in this example is Foo_Bar):


svn checkout http://svn.php.net:/repository/pear/packages/Foo_Bar/trunk

   

Now that you have the latest sources, you can edit the relevant file(s). Make sure that your patch is fully compatible with the PEAR coding standards.

After you have finished adding/changing the code, TEST it: We will not accept code that hasn't been carefully tested. When you are absolutely sure the new code doesn't introduce bugs, create a unified diff by running:

cd pear/Foo_Bar
svn diff >Foo_Bar.diff
   

The resulting .diff file contains your patch. This diff makes it easy for us to see what has been changed.

The next step is to submit the patch. There are basically two options to do this: The first option is to submit the patch by creating a bug report for the package in question. You can do this by visiting the package homepage on pear.php.net and clicking on the "Bugs" tab at the top of the page. Another option is sending a mail to pear-dev@lists.php.net and Cc'ing the maintainer(s) of the package. The subject of the mail should be prefixed with '[Patch]' to make it clear you are submitting a patch. Also include a verbose explanation of what the patch does. Don't forget to attach the .diff file to the mail. The maintainers of the package are usually listed in the header of each source file. Apart from that their email addresses are available on the package information page on http://pear.php.net/.

If you are using Outlook or Outlook Express, please change the file extension of the diff file to .txt, because Outlook's MIME-Type detection depends on the file extension and attachments with a MIME-Type not equal to text/plain will be rejected by our mailinglist software.

If your patch does break backwards compatibility, the chances are fairly good that the maintainers won't be happy about it. Thus you should always try to fix a bug in a way that does not seriously change the public API. But if there is absolutely no way to keep backwards compatibility and/or if your patch contains a groundbreaking improvement, even API changes are fine.

Writing New Packages (Previous) Reporting Bugs (Next)
Last updated: Sat, 16 Feb 2019 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report.
View this page in:
  • English

User Notes:

There are no user contributed notes for this page.