README.SUBMITTING_PATCH 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  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 or PECL 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 and #php.doc
  15. on the EFNet network and #winphp-dev 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://php.net/mailing-lists.php.
  29. Information on PHP internal C functions is at
  30. http://php.net/internals, though this is considered incomplete.
  31. Various external resources can be found on the web. See
  32. https://wiki.php.net/internals for some references. A standard
  33. printed reference is the book "Extending and Embedding PHP" by Sara
  34. Golemon.
  35. The preferred way to propose PHP patch is sending pull request from
  36. GitHub: https://github.com/php/php-src
  37. Fork the official PHP repository and send a pull request. A
  38. notification will be sent to the pull request mailing list. Sending a
  39. note to PHP Internals list (internals@lists.php.net) may help getting
  40. more feedback and quicker turnaround. You can also add pull requests
  41. to bug reports at http://bugs.php.net/.
  42. If you are not using GitHub, attach your patch to a PHP bug and
  43. consider sending a notification email about the change to
  44. internals@lists.php.net. If the bug is for an extension, also CC the
  45. extension maintainer. Explain what has been changed by your patch.
  46. Test scripts should be included.
  47. Please make the mail subject prefix "[PATCH]". If attaching a patch,
  48. ensure it has a file extension of ".txt". This is because only MIME
  49. attachments of type 'text/*' are accepted.
  50. PHP Documentation Patches
  51. -------------------------
  52. If you are fixing incorrect PHP documentation first create a bug or
  53. identify an existing bug at http://bugs.php.net/. A bug can be used
  54. to track the patch progress and prevent your changes getting lost in
  55. the PHP mail archives.
  56. If your change is large, then first discuss it with the mail list
  57. phpdoc@lists.php.net. Subscription is explained on
  58. http://php.net/mailing-lists.php.
  59. Information on contributing to PHP documentation is at
  60. http://php.net/dochowto and http://wiki.php.net/doc/howto
  61. Attach the patch to the PHP bug and consider sending a notification
  62. email about the change to phpdoc@lists.php.net. Explain what has been
  63. fixed/added/changed by your patch.
  64. Please make the mail subject prefix "[PATCH]". Include the bug id(s)
  65. which can be closed by your patch. If attaching a patch, ensure it
  66. has a file extension of ".txt". This is because only MIME attachments
  67. of type 'text/*' are accepted.
  68. PECL Extension Patches: http://pecl.php.net/
  69. --------------------------------------------
  70. If you are fixing broken functionality in a PECL extension then create
  71. a bug or identify an existing bug at http://bugs.php.net/. A bug
  72. can be used to track the patch progress and prevent your changes
  73. getting lost in the PHP mail archives.
  74. If your change is large then create a Request For Comment (RFC) page
  75. on http://wiki.php.net/rfc, discuss it with the extension maintainer,
  76. and discuss it on the development mail list pecl-dev@lists.php.net.
  77. PECL mail list subscription is explained on
  78. http://pecl.php.net/support.php. RFC Wiki accounts can be requested
  79. on http://wiki.php.net/start?do=register
  80. Information on PHP internal C functions is at
  81. http://www.php.net/internals, though this is considered incomplete.
  82. Various external resources can be found on the web. A standard
  83. printed reference is the book "Extending and Embedding PHP" by Sara
  84. Golemon.
  85. Update any open bugs and add a link to the source of your patch. Send
  86. the patch or pointer to the bug to pecl-dev@lists.php.net. Also CC
  87. the extension maintainer. Explain what has been changed by your
  88. patch. Test scripts should be included.
  89. Please make the mail subject prefix "[PATCH] ...". Include the patch
  90. as an attachment with a file extension of ".txt". This is because
  91. only MIME attachments of type 'text/*' are accepted.
  92. PEAR Package Patches: http://pear.php.net/
  93. ------------------------------------------
  94. Information on contributing to PEAR is available at
  95. http://pear.php.net/manual/en/developers-newmaint.php and
  96. http://pear.php.net/manual/en/guide-developers.php
  97. How to create your PHP, PHP Documentation or PECL patch
  98. -------------------------------------------------------
  99. PHP and most PECL packages use Git for revision control. Some PECL
  100. packages use Subversion (SVN) Read http://www.php.net/git.php for help
  101. on using Git to get and build PHP source code. We recommend to look
  102. at our workflow on https://wiki.php.net/vcs/gitworkflow and our FAQ
  103. https://wiki.php.net/vcs/gitfaq.
  104. Generally we ask that bug fix patches work on the current stable PHP
  105. development branches and on "master". New PHP features only need to
  106. work on "master".
  107. Read CODING_STANDARDS before you start working.
  108. After modifying the source see README.TESTING and
  109. http://qa.php.net/write-test.php for how to test. Submitting test
  110. scripts helps us to understand what functionality has changed. It is
  111. important for the stability and maintainability of PHP that tests are
  112. comprehensive.
  113. After testing is finished, create a patch file using the command:
  114. git diff > your_patch.txt
  115. For ease of review and later troubleshooting, submit individual
  116. patches for each bug or feature.
  117. Checklist for submitting your PHP or PECL code patch
  118. ----------------------------------------------------
  119. - Update git source just before running your final 'diff' and
  120. before testing.
  121. - Add in-line comments and/or have external documentation ready.
  122. Use only "/* */" style comments, not "//".
  123. - Create test scripts for use with "make test".
  124. - Run "make test" to check your patch doesn't break other features.
  125. - Rebuild PHP with --enable-debug (which will show some kinds of
  126. memory errors) and check the PHP and web server error logs after
  127. running your PHP tests.
  128. - Rebuild PHP with --enable-maintainer-zts to check your patch
  129. compiles on multi-threaded web servers.
  130. - Review the patch once more just before submitting it.
  131. What happens after submitting your PHP, PHP Documentation or PECL patch
  132. -----------------------------------------------------------------------
  133. If your patch is easy to review and obviously has no side-effects,
  134. it might be committed relatively quickly.
  135. Because PHP is a volunteer-driven effort more complex patches will
  136. require patience on your side. If you do not receive feedback in a
  137. few days, consider resubmitting the patch. Before doing this think
  138. about these questions:
  139. - Did I send the patch to the right mail list?
  140. - Did I review the mail list archives to see if these kind of
  141. changes had been discussed before?
  142. - Did I explain my patch clearly?
  143. - Is my patch too hard to review? Because of what factors?
  144. What happens when your PHP or PECL patch is applied
  145. ---------------------------------------------------
  146. Your name will likely be included in the Git commit log. If your
  147. patch affects end users, a brief description and your name might be
  148. added to the NEWS file.
  149. Thank you for patching PHP!