Skip to content

Commit eafe070

Browse files
committed
Merge branch 'PHP-5.4' of git.php.net:php-src into PHP-5.4
2 parents d3faae0 + e9b4bca commit eafe070

33 files changed

+840
-159
lines changed

CODING_STANDARDS

Lines changed: 23 additions & 3 deletions
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

NEWS

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,18 @@ PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33
?? ??? 2013, PHP 5.4.26
44

5+
- LDAP:
6+
. Implemented ldap_modify_batch (https://wiki.php.net/rfc/ldap_modify_batch).
7+
(Ondřej Hošek)
8+
59
?? ??? 2013, PHP 5.4.25
610

711
- Core:
812
. Fixed bug #66286 (Incorrect object comparison with inheritance). (Nikita)
913
. Fixed bug #66509 (copy() arginfo has changed starting from 5.4).
1014
(Will Fitch)
1115

12-
- mysqlnd
16+
- mysqlnd:
1317
. Fixed bug #66283 (Segmentation fault after memory_limit). (Johannes)
1418

1519
- PDO_pgsql:

README.EXTENSIONS

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
This file describes extension module API details. Refer to
2+
README.EXT_SKEL to create extension skeleton files. Refer to
3+
Hacker's Guide for PHP internals.
4+
5+
http://www.php.net/manual/en/internals2.php
6+
7+
8+
19
Between PHP 4.0.6 and 4.1.0, the Zend module struct changed in a way
210
that broke both source and binary compatibility. If you are
311
maintaining a third party extension, here's how to update it:

README.EXT_SKEL

Lines changed: 24 additions & 6 deletions
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.RELEASE_PROCESS

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,10 @@ pointing out "the location of the release" and "the possible release date of
101101
either the next RC, or the final release".
102102

103103
2. Send an email (see example here http://news.php.net/php.pear.qa/5201) **To**
104-
``php-qa@lists.php.net`` and ``primary-qa-tests@lists.php.net``.
104+
``php-qa@lists.php.net`` and ``primary-qa-tester@lists.php.net``.
105105
This email is to notify the selected projects about a new release so that they
106106
can make sure their projects keep working. Make sure that you have been setup
107-
as a moderator for ``primary-qa-tests@lists.php.net`` by having someone (Wez,
107+
as a moderator for ``primary-qa-tester@lists.php.net`` by having someone (Hannes, Dan,
108108
Derick) run the following commands for you:
109109

110110
``ssh lists.php.net``

README.SUBMITTING_PATCH

Lines changed: 11 additions & 0 deletions
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 (internals@lists.php.net) 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
-------------------------

UPGRADING

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,7 @@ c. New functions
621621
- LDAP:
622622
- ldap_control_paged_result()
623623
- ldap_control_paged_result_response()
624+
- ldap_modify_batch (5.4.26)
624625

625626
- libxml:
626627
- libxml_set_external_entity_loader()

ext/date/lib/fallbackmap.h

Lines changed: 42 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,42 @@
1-
{ "sst", 0, -11, "Pacific/Apia" },
2-
{ "hst", 0, -10, "Pacific/Honolulu" },
3-
{ "akst", 0, -9, "America/Anchorage" },
4-
{ "akdt", 1, -8, "America/Anchorage" },
5-
{ "pst", 0, -8, "America/Los_Angeles" },
6-
{ "pdt", 1, -7, "America/Los_Angeles" },
7-
{ "mst", 0, -7, "America/Denver" },
8-
{ "mdt", 1, -6, "America/Denver" },
9-
{ "cst", 0, -6, "America/Chicago" },
10-
{ "cdt", 1, -5, "America/Chicago" },
11-
{ "est", 0, -5, "America/New_York" },
12-
{ "edt", 1, -4, "America/New_York" },
13-
{ "ast", 0, -4, "America/Halifax" },
14-
{ "adt", 1, -3, "America/Halifax" },
15-
{ "brt", 0, -3, "America/Sao_Paulo" },
16-
{ "brst", 1, -2, "America/Sao_Paulo" },
17-
{ "azost", 0, -1, "Atlantic/Azores" },
18-
{ "azodt", 1, 0, "Atlantic/Azores" },
19-
{ "gmt", 0, 0, "Europe/London" },
20-
{ "bst", 1, 1, "Europe/London" },
21-
{ "cet", 0, 1, "Europe/Paris" },
22-
{ "cest", 1, 2, "Europe/Paris" },
23-
{ "eet", 0, 2, "Europe/Helsinki" },
24-
{ "eest", 1, 3, "Europe/Helsinki" },
25-
{ "msk", 0, 3, "Europe/Moscow" },
26-
{ "msd", 1, 4, "Europe/Moscow" },
27-
{ "gst", 0, 4, "Asia/Dubai" },
28-
{ "pkt", 0, 5, "Asia/Karachi" },
29-
{ "ist", 0, 5.5, "Asia/Kolkata" },
30-
{ "npt", 0, 5.75, "Asia/Katmandu" },
31-
{ "yekt", 1, 6, "Asia/Yekaterinburg" },
32-
{ "novst", 1, 7, "Asia/Novosibirsk" },
33-
{ "krat", 0, 7, "Asia/Krasnoyarsk" },
34-
{ "krast", 1, 8, "Asia/Krasnoyarsk" },
35-
{ "jst", 0, 9, "Asia/Tokyo" },
36-
{ "est", 0, 10, "Australia/Melbourne" },
37-
{ "cst", 1, 10.5, "Australia/Adelaide" },
38-
{ "est", 1, 11, "Australia/Melbourne" },
39-
{ "nzst", 0, 12, "Pacific/Auckland" },
40-
{ "nzdt", 1, 13, "Pacific/Auckland" },
1+
{ "sst", 0, -660, "Pacific/Apia" },
2+
{ "hst", 0, -600, "Pacific/Honolulu" },
3+
{ "akst", 0, -540, "America/Anchorage" },
4+
{ "akdt", 1, -480, "America/Anchorage" },
5+
{ "pst", 0, -480, "America/Los_Angeles" },
6+
{ "pdt", 1, -420, "America/Los_Angeles" },
7+
{ "mst", 0, -420, "America/Denver" },
8+
{ "mdt", 1, -360, "America/Denver" },
9+
{ "cst", 0, -360, "America/Chicago" },
10+
{ "cdt", 1, -300, "America/Chicago" },
11+
{ "est", 0, -300, "America/New_York" },
12+
{ "vet", 0, -270, "America/Caracas" },
13+
{ "edt", 1, -240, "America/New_York" },
14+
{ "ast", 0, -240, "America/Halifax" },
15+
{ "adt", 1, -180, "America/Halifax" },
16+
{ "brt", 0, -180, "America/Sao_Paulo" },
17+
{ "brst", 1, -120, "America/Sao_Paulo" },
18+
{ "azost", 0, -60, "Atlantic/Azores" },
19+
{ "azodt", 1, 0, "Atlantic/Azores" },
20+
{ "gmt", 0, 0, "Europe/London" },
21+
{ "bst", 1, 60, "Europe/London" },
22+
{ "cet", 0, 60, "Europe/Paris" },
23+
{ "cest", 1, 120, "Europe/Paris" },
24+
{ "eet", 0, 120, "Europe/Helsinki" },
25+
{ "eest", 1, 180, "Europe/Helsinki" },
26+
{ "msk", 0, 180, "Europe/Moscow" },
27+
{ "msd", 1, 240, "Europe/Moscow" },
28+
{ "gst", 0, 240, "Asia/Dubai" },
29+
{ "pkt", 0, 300, "Asia/Karachi" },
30+
{ "ist", 0, 330, "Asia/Kolkata" },
31+
{ "npt", 0, 345, "Asia/Katmandu" },
32+
{ "yekt", 1, 360, "Asia/Yekaterinburg" },
33+
{ "novst", 1, 420, "Asia/Novosibirsk" },
34+
{ "krat", 0, 420, "Asia/Krasnoyarsk" },
35+
{ "cst", 0, 480, "Asia/Shanghai" },
36+
{ "krast", 1, 480, "Asia/Krasnoyarsk" },
37+
{ "jst", 0, 540, "Asia/Tokyo" },
38+
{ "est", 0, 600, "Australia/Melbourne" },
39+
{ "cst", 1, 630, "Australia/Adelaide" },
40+
{ "est", 1, 660, "Australia/Melbourne" },
41+
{ "nzst", 0, 720, "Pacific/Auckland" },
42+
{ "nzdt", 1, 780, "Pacific/Auckland" },

ext/date/lib/parse_date.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
/* Generated by re2c 0.13.5 on Sun Aug 25 14:46:08 2013 */
1+
/* Generated by re2c 0.13.5 on Sat Jan 25 15:48:30 2014 */
22
#line 1 "ext/date/lib/parse_date.re"
33
/*
44
+----------------------------------------------------------------------+
55
| PHP Version 5 |
66
+----------------------------------------------------------------------+
7-
| Copyright (c) 1997-2014 The PHP Group |
7+
| Copyright (c) 1997-2013 The PHP Group |
88
+----------------------------------------------------------------------+
99
| This source file is subject to version 3.01 of the PHP license, |
1010
| that is bundled with this package in the file LICENSE, and is |
@@ -752,7 +752,7 @@ const static timelib_tz_lookup_table* zone_search(const char *word, long gmtoffs
752752
/* Still didn't find anything, let's find the zone solely based on
753753
* offset/isdst then */
754754
for (fmp = timelib_timezone_fallbackmap; fmp->name; fmp++) {
755-
if ((fmp->gmtoffset * 3600) == gmtoffset && fmp->type == isdst) {
755+
if ((fmp->gmtoffset * 60) == gmtoffset && fmp->type == isdst) {
756756
return fmp;
757757
}
758758
}

ext/date/lib/parse_date.re

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,7 @@ const static timelib_tz_lookup_table* zone_search(const char *word, long gmtoffs
750750
/* Still didn't find anything, let's find the zone solely based on
751751
* offset/isdst then */
752752
for (fmp = timelib_timezone_fallbackmap; fmp->name; fmp++) {
753-
if ((fmp->gmtoffset * 3600) == gmtoffset && fmp->type == isdst) {
753+
if ((fmp->gmtoffset * 60) == gmtoffset && fmp->type == isdst) {
754754
return fmp;
755755
}
756756
}

ext/date/lib/timelib.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ int timelib_apply_localtime(timelib_time *t, unsigned int localtime);
9191
void timelib_unixtime2gmt(timelib_time* tm, timelib_sll ts);
9292
void timelib_unixtime2local(timelib_time *tm, timelib_sll ts);
9393
void timelib_update_from_sse(timelib_time *tm);
94+
void timelib_set_timezone_from_offset(timelib_time *t, timelib_sll utc_offset);
95+
void timelib_set_timezone_from_abbr(timelib_time *t, timelib_abbr_info abbr_info);
9496
void timelib_set_timezone(timelib_time *t, timelib_tzinfo *tz);
9597

9698
/* From parse_tz.c */

ext/date/lib/timelib_structs.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,12 @@ typedef struct timelib_time {
172172
* 2 TimeZone abbreviation */
173173
} timelib_time;
174174

175+
typedef struct timelib_abbr_info {
176+
timelib_sll utc_offset;
177+
char *abbr;
178+
int dst;
179+
} timelib_abbr_info;
180+
175181
typedef struct timelib_error_message {
176182
int position;
177183
char character;

ext/date/lib/unixtime2tm.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,34 @@ void timelib_unixtime2local(timelib_time *tm, timelib_sll ts)
214214
tm->have_zone = 1;
215215
}
216216

217+
void timelib_set_timezone_from_offset(timelib_time *t, timelib_sll utc_offset)
218+
{
219+
if (t->tz_abbr) {
220+
free(t->tz_abbr);
221+
}
222+
t->tz_abbr = NULL;
223+
224+
t->z = utc_offset;
225+
t->have_zone = 1;
226+
t->zone_type = TIMELIB_ZONETYPE_OFFSET;
227+
t->dst = 0;
228+
t->tz_info = NULL;
229+
}
230+
231+
void timelib_set_timezone_from_abbr(timelib_time *t, timelib_abbr_info abbr_info)
232+
{
233+
if (t->tz_abbr) {
234+
free(t->tz_abbr);
235+
}
236+
t->tz_abbr = strdup(abbr_info.abbr);
237+
238+
t->z = abbr_info.utc_offset;
239+
t->have_zone = 1;
240+
t->zone_type = TIMELIB_ZONETYPE_ABBR;
241+
t->dst = abbr_info.dst;
242+
t->tz_info = NULL;
243+
}
244+
217245
void timelib_set_timezone(timelib_time *t, timelib_tzinfo *tz)
218246
{
219247
timelib_time_offset *gmt_offset;

ext/date/php_date.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2992,11 +2992,18 @@ PHP_FUNCTION(date_timezone_set)
29922992
dateobj = (php_date_obj *) zend_object_store_get_object(object TSRMLS_CC);
29932993
DATE_CHECK_INITIALIZED(dateobj->time, DateTime);
29942994
tzobj = (php_timezone_obj *) zend_object_store_get_object(timezone_object TSRMLS_CC);
2995-
if (tzobj->type != TIMELIB_ZONETYPE_ID) {
2996-
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can only do this for zones with ID for now");
2997-
return;
2995+
2996+
switch (tzobj->type) {
2997+
case TIMELIB_ZONETYPE_OFFSET:
2998+
timelib_set_timezone_from_offset(dateobj->time, tzobj->tzi.utc_offset);
2999+
break;
3000+
case TIMELIB_ZONETYPE_ABBR:
3001+
timelib_set_timezone_from_abbr(dateobj->time, tzobj->tzi.z);
3002+
break;
3003+
case TIMELIB_ZONETYPE_ID:
3004+
timelib_set_timezone(dateobj->time, tzobj->tzi.tz);
3005+
break;
29983006
}
2999-
timelib_set_timezone(dateobj->time, tzobj->tzi.tz);
30003007
timelib_unixtime2local(dateobj->time, dateobj->time->sse);
30013008

30023009
RETURN_ZVAL(object, 1, 0);

0 commit comments

Comments
 (0)