You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

182 lines
7.4 KiB

  1. Submitting Enhancements and Patches to PHP
  2. ==========================================
  3. This document describes how to submit an enhancement or patch for PHP.
  4. It's easy!
  5. You don't need any login accounts or special access to download,
  6. build, debug and begin submitting PHP, PECL or PEAR code, tests or
  7. documentation. Once you've followed this README and had several
  8. patches accepted, commit privileges are often quickly granted.
  9. An excellent article to read first is:
  10. http://phpadvent.org/2008/less-whining-more-coding-by-elizabeth-smith
  11. Online Forums
  12. -------------
  13. There are several IRC channels where PHP developers are often
  14. available to discuss questions. They include #php.pecl, #php.doc and
  15. #pear on the EFNet network and #php-dev-win on FreeNode.
  16. PHP Patches
  17. -----------
  18. If you are fixing broken functionality in PHP C source code first
  19. create a bug or identify an existing bug at http://bugs.php.net/. A
  20. bug can be used to track the patch progress and prevent your changes
  21. getting lost in the PHP mail archives.
  22. If your change is large then create a Request For Comment (RFC) page
  23. on http://wiki.php.net/rfc, discuss it with the extension maintainer,
  24. and discuss it on the development mail list internals@lists.php.net.
  25. RFC Wiki accounts can be requested on
  26. http://wiki.php.net/start?do=register. PHP extension maintainers can
  27. be found in the EXTENSIONS file in the PHP source. Mail list
  28. subscription is explained on http://www.php.net/mailing-lists.php.
  29. Information on PHP internal C functions is at
  30. http://www.php.net/internals, though this is considered incomplete.
  31. Various external resources can be found on the web. A standard
  32. printed reference is the book "Extending and Embedding PHP" by Sara
  33. Golemon.
  34. Attach the patch to the PHP bug and consider sending a notification
  35. email about the change to internals@lists.php.net. Also CC the
  36. extension maintainer. Explain what has been changed by your patch.
  37. Test scripts should be included.
  38. Please make the mail subject prefix "[PATCH]". If attaching a patch,
  39. ensure it has a file extension of ".txt". This is because only MIME
  40. attachments of type 'text/*' are accepted.
  41. PHP Documentation Patches
  42. -------------------------
  43. If you are fixing incorrect PHP documentation first create a bug or
  44. identify an existing bug at http://bugs.php.net/. A bug can be used
  45. to track the patch progress and prevent your changes getting lost in
  46. the PHP mail archives.
  47. If your change is large, then first discuss it with the mail list
  48. phpdoc@lists.php.net. Subscription is explained on
  49. http://www.php.net/mailing-lists.php.
  50. Information on contributing to PHP documentation is at
  51. http://php.net/dochowto and http://wiki.php.net/doc/howto
  52. Attach the patch to the PHP bug and consider sending a notification
  53. email about the change to phpdoc@lists.php.net. Explain what has been
  54. fixed/added/changed by your patch.
  55. Please make the mail subject prefix "[PATCH]". Include the bug id(s)
  56. which can be closed by your patch. If attaching a patch, ensure it
  57. has a file extension of ".txt". This is because only MIME attachments
  58. of type 'text/*' are accepted.
  59. PECL Extension Patches: http://pecl.php.net/
  60. --------------------------------------------
  61. If you are fixing broken functionality in a PECL extension then create
  62. a bug or identify an existing bug at http://pecl.php.net/bugs/. A bug
  63. can be used to track the patch progress and prevent your changes
  64. getting lost in the PHP mail archives.
  65. If your change is large then create a Request For Comment (RFC) page
  66. on http://wiki.php.net/rfc, discuss it with the extension maintainer,
  67. and discuss it on the development mail list pecl-dev@lists.php.net.
  68. PECL mail list subscription is explained on
  69. http://pecl.php.net/support.php. RFC Wiki accounts can be requested
  70. on http://wiki.php.net/start?do=register
  71. Information on PHP internal C functions is at
  72. http://www.php.net/internals, though this is considered incomplete.
  73. Various external resources can be found on the web. A standard
  74. printed reference is the book "Extending and Embedding PHP" by Sara
  75. Golemon.
  76. Update any open bugs and add a link to the source of your patch. Send
  77. the patch or pointer to the bug to pecl-dev@lists.php.net. Also CC
  78. the extension maintainer. Explain what has been changed by your
  79. patch. Test scripts should be included.
  80. Please make the mail subject prefix "[PATCH] ...". Include the patch
  81. as an attachment with a file extension of ".txt". This is because
  82. only MIME attachments of type 'text/*' are accepted.
  83. PEAR Package Patches: http://pear.php.net/
  84. ------------------------------------------
  85. Information on contributing to PEAR is available at
  86. http://pear.php.net/manual/en/developers-newmaint.php and
  87. http://pear.php.net/manual/en/guide-developers.php
  88. How to create your PHP, PHP Documentation or PECL patch
  89. -------------------------------------------------------
  90. PHP and PECL use Subversion (SVN) for revision control. Read
  91. http://www.php.net/svn.php for help on using SVN to get and build PHP
  92. source code. We recommend using a Sparse Directory checkout described
  93. in http://wiki.php.net/vcs/svnfaq. If you are new to SVN, read
  94. http://svnbook.red-bean.com.
  95. Generally we ask that bug fix patches work on the current stable PHP
  96. development branches and on "trunk". New PHP features only need to
  97. work on "trunk".
  98. Read CODING_STANDARDS before you start working.
  99. After modifying the source see README.TESTING and
  100. http://qa.php.net/write-test.php for how to test. Submitting test
  101. scripts helps us to understand what functionality has changed. It is
  102. important for the stability and maintainability of PHP that tests are
  103. comprehensive.
  104. After testing is finished, create a patch file using the command:
  105. svn diff > your_patch.txt
  106. For ease of review and later troubleshooting, submit individual
  107. patches for each bug or feature.
  108. Checklist for submitting your PHP or PECL code patch
  109. ----------------------------------------------------
  110. - Update SVN source just before running your final 'diff' and
  111. before testing.
  112. - Add in-line comments and/or have external documentation ready.
  113. Use only "/* */" style comments, not "//".
  114. - Create test scripts for use with "make test".
  115. - Run "make test" to check your patch doesn't break other features.
  116. - Rebuild PHP with --enable-debug (which will show some kinds of
  117. memory errors) and check the PHP and web server error logs after
  118. running your PHP tests.
  119. - Rebuild PHP with --enable-maintainer-zts to check your patch
  120. compiles on multi-threaded web servers.
  121. - Review the patch once more just before submitting it.
  122. What happens after submitting your PHP, PHP Documentation or PECL patch
  123. -----------------------------------------------------------------------
  124. If your patch is easy to review and obviously has no side-effects,
  125. it might be committed relatively quickly.
  126. Because PHP is a volunteer-driven effort more complex patches will
  127. require patience on your side. If you do not receive feedback in a
  128. few days, consider resubmitting the patch. Before doing this think
  129. about these questions:
  130. - Did I send the patch to the right mail list?
  131. - Did I review the mail list archives to see if these kind of
  132. changes had been discussed before?
  133. - Did I explain my patch clearly?
  134. - Is my patch too hard to review? Because of what factors?
  135. What happens when your PHP or PECL patch is applied
  136. ---------------------------------------------------
  137. Your name will likely be included in the SVN commit log. If your
  138. patch affects end users, a brief description and your name might be
  139. added to the NEWS file.
  140. Thank you for patching PHP!