Skip to content

Commit 223a62d

Browse files
committed
Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5: Fix English and improve by Stas. Thanks :) Update source docs Revert "Update source docs" Update source docs Conflicts: README.EXTENSIONS
2 parents 5613178 + fed80ee commit 223a62d

File tree

3 files changed

+58
-9
lines changed

3 files changed

+58
-9
lines changed

CODING_STANDARDS

+23-3
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ Exceptions:
8282
library may need to control or free the memory, or when the memory in
8383
question needs to survive between multiple requests.
8484

85-
Naming Conventions
85+
User Functions/Methods Naming Conventions
8686
------------------
8787

8888
1. Function names for user-level functions should be enclosed with in
@@ -163,6 +163,26 @@ Naming Conventions
163163
'foobar'
164164
'foo_bar'
165165

166+
Internal Function Naming Convensions
167+
----------------------
168+
169+
1. Functions that are part of the external API should be named
170+
'php_modulename_function()' to avoid symbol collision. They should be in
171+
lowercase, with words underscore delimited. Exposed API must be defined
172+
in 'php_modulename.h'.
173+
174+
PHPAPI char *php_session_create_id(PS_CREATE_SID_ARGS);
175+
176+
Unexposed module function should be static and should not be defined in
177+
'php_modulename.h'.
178+
179+
static int php_session_destroy(TSRMLS_D)
180+
181+
2. Main module source file must be named 'modulename.c'.
182+
183+
3. Header file that is used by other sources must be named 'php_modulename.h'.
184+
185+
166186
Syntax and indentation
167187
----------------------
168188

@@ -181,9 +201,9 @@ Syntax and indentation
181201
of PHP or one of its standard modules, please maintain the K&R
182202
style. This applies to just about everything, starting with
183203
indentation and comment styles and up to function declaration
184-
syntax. Also see Indentstyle_.
204+
syntax. Also see Indentstyle.
185205

186-
.. _Indentstyle: http://www.catb.org/~esr/jargon/html/I/indent-style.html
206+
Indentstyle: http://www.catb.org/~esr/jargon/html/I/indent-style.html
187207

188208
3. Be generous with whitespace and braces. Keep one empty line between the
189209
variable declaration section and the statements in a block, as well as

README.EXT_SKEL

+24-6
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,29 @@ HOW TO USE IT
4545

4646
--proto=filename.
4747

48+
SOURCE AND HEADER FILE NAME
49+
50+
./ext_skel generates 'module_name.c' and 'php_module_name.h' as main source
51+
and header files. Keep these names.
52+
53+
Module functions (User functions) must be named
54+
55+
module_name_function()
56+
57+
When you need to expose module functions to other modules, expose functions
58+
strictly needed by others. Exposed internal function must be named
59+
60+
php_module_name_function()
61+
62+
See also CODING_STANDARDS.
63+
64+
4865
FORMAT OF FUNCTION DEFINITIONS FILE
4966

5067
All the definitions must be on one line. In it's simplest form, it's just
5168
the function name, e.g.
5269

53-
my_function
70+
module_name_function
5471

5572
but then you'll be left with an almost empty function body without any
5673
argument handling.
@@ -72,8 +89,9 @@ FORMAT OF FUNCTION DEFINITIONS FILE
7289

7390
An example:
7491

75-
my_function(int arg1, int arg2 [, int arg3 [, int arg4]]) this is my 1st
92+
module_name_function(int arg1, int arg2 [, int arg3 [, int arg4]])
7693

94+
Arguments arg1 and arg2 are required.
7795
Arguments arg3 and arg4 are optional.
7896

7997
If possible, the function definition should also contain it's return type
@@ -133,15 +151,15 @@ EXAMPLE
133151

134152
The following _one_ line
135153

136-
bool my_drawtext(resource image, string text, resource font, int x, int y [, int color])
154+
bool module_name_drawtext(resource image, string text, resource font, int x, int y [, int color])
137155

138156
will create this function definition for you (note that there are a few
139157
question marks to be replaced by you, and you must of course add your own
140158
value definitions too):
141159

142-
/* {{{ proto bool my_drawtext(resource image, string text, resource font, int x, int y [, int color])
160+
/* {{{ proto bool module_name_drawtext(resource image, string text, resource font, int x, int y [, int color])
143161
*/
144-
PHP_FUNCTION(my_drawtext)
162+
PHP_FUNCTION(module_name_drawtext)
145163
{
146164
char *text = NULL;
147165
int argc = ZEND_NUM_ARGS();
@@ -164,7 +182,7 @@ PHP_FUNCTION(my_drawtext)
164182
ZEND_FETCH_RESOURCE(???, ???, font, font_id, "???", ???_rsrc_id);
165183
}
166184

167-
php_error(E_WARNING, "my_drawtext: not yet implemented");
185+
php_error(E_WARNING, "module_name_drawtext: not yet implemented");
168186
}
169187
/* }}} */
170188

README.SUBMITTING_PATCH

+11
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,17 @@ Please make the mail subject prefix "[PATCH]". If attaching a patch,
5050
ensure it has a file extension of ".txt". This is because only MIME
5151
attachments of type 'text/*' are accepted.
5252

53+
The preferred way to propose PHP patch is sending pull request from
54+
github.
55+
56+
https://github.com/php/php-src
57+
58+
Fork the official PHP repository and send a pull request. A
59+
notification will be sent to the pull request mailing list. Sending a
60+
note to PHP Internals list ([email protected]) may help getting
61+
more feedback and quicker turnaround. You can also add pull requests
62+
to bug reports at http://bugs.php.net/.
63+
5364

5465
PHP Documentation Patches
5566
-------------------------

0 commit comments

Comments
 (0)