Skip to content

Commit b68da91

Browse files
committed
Merge branch 'master' into jsond
Conflicts: ext/json/JSON_parser.c ext/json/JSON_parser.h ext/json/config.m4 ext/json/config.w32 ext/json/json.c ext/json/php_json.h
2 parents 4f6539b + a9e8695 commit b68da91

File tree

1,618 files changed

+33258
-32885
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,618 files changed

+33258
-32885
lines changed

NEWS

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
PHP NEWS
1+
PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33
?? ??? 20??, PHP 7.0.0
44

@@ -26,6 +26,13 @@ PHP NEWS
2626
constructor). (dunglas at gmail dot com)
2727
. Removed ZEND_ACC_FINAL_CLASS, promoting ZEND_ACC_FINAL as final class
2828
modifier. (Guilherme Blanco)
29+
. is_long() & is_integer() is now an alias of is_int(). (Kalle)
30+
. Implemented FR #55467 (phpinfo: PHP Variables with $ and single quotes). (Kalle)
31+
. Fixed bug #55415 (php_info produces invalid anchor names). (Kalle, Johannes)
32+
. Added ?? operator. (Andrea)
33+
. Added \u{xxxxx} Unicode Codepoint Escape Syntax. (Andrea)
34+
. Fixed oversight where define() did not support arrays yet const syntax did. (Andrea, Dmitry)
35+
. Use "integer" and "float" instead of "long" and "double" in ZPP, type hint and conversion error messages. (Andrea)
2936

3037
- Date:
3138
. Fixed day_of_week function as it could sometimes return negative values
@@ -65,7 +72,7 @@ PHP NEWS
6572
statements option). (peter dot wolanin at acquia dot com)
6673

6774
- Reflection
68-
. Fixed inheritance chain of Reflector interface (Tjerk)
75+
. Fixed inheritance chain of Reflector interface. (Tjerk)
6976

7077
- Session:
7178
. Fixed bug #67694 (Regression in session_regenerate_id()). (Tjerk)

TSRM/TSRM.c

+18-9
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222

2323
typedef struct _tsrm_tls_entry tsrm_tls_entry;
2424

25+
#if defined(TSRM_WIN32)
26+
/* TSRMLS_CACHE_DEFINE; is already done in Zend, this is being always compiled statically. */
27+
#endif
28+
2529
struct _tsrm_tls_entry {
2630
void **storage;
2731
int count;
@@ -177,7 +181,7 @@ TSRM_API void tsrm_shutdown(void)
177181
for (j=0; j<p->count; j++) {
178182
if (p->storage[j]) {
179183
if (resource_types_table && !resource_types_table[j].done && resource_types_table[j].dtor) {
180-
resource_types_table[j].dtor(p->storage[j], &p->storage);
184+
resource_types_table[j].dtor(p->storage[j]);
181185
}
182186
free(p->storage[j]);
183187
}
@@ -252,7 +256,7 @@ TSRM_API ts_rsrc_id ts_allocate_id(ts_rsrc_id *rsrc_id, size_t size, ts_allocate
252256
for (j=p->count; j<id_count; j++) {
253257
p->storage[j] = (void *) malloc(resource_types_table[j].size);
254258
if (resource_types_table[j].ctor) {
255-
resource_types_table[j].ctor(p->storage[j], &p->storage);
259+
resource_types_table[j].ctor(p->storage[j]);
256260
}
257261
}
258262
p->count = id_count;
@@ -282,7 +286,7 @@ static void allocate_new_resource(tsrm_tls_entry **thread_resources_ptr, THREAD_
282286
tsrm_tls_set(*thread_resources_ptr);
283287

284288
if (tsrm_new_thread_begin_handler) {
285-
tsrm_new_thread_begin_handler(thread_id, &((*thread_resources_ptr)->storage));
289+
tsrm_new_thread_begin_handler(thread_id);
286290
}
287291
for (i=0; i<id_count; i++) {
288292
if (resource_types_table[i].done) {
@@ -291,13 +295,13 @@ static void allocate_new_resource(tsrm_tls_entry **thread_resources_ptr, THREAD_
291295
{
292296
(*thread_resources_ptr)->storage[i] = (void *) malloc(resource_types_table[i].size);
293297
if (resource_types_table[i].ctor) {
294-
resource_types_table[i].ctor((*thread_resources_ptr)->storage[i], &(*thread_resources_ptr)->storage);
298+
resource_types_table[i].ctor((*thread_resources_ptr)->storage[i]);
295299
}
296300
}
297301
}
298302

299303
if (tsrm_new_thread_end_handler) {
300-
tsrm_new_thread_end_handler(thread_id, &((*thread_resources_ptr)->storage));
304+
tsrm_new_thread_end_handler(thread_id);
301305
}
302306

303307
tsrm_mutex_unlock(tsmm_mutex);
@@ -390,7 +394,7 @@ void tsrm_free_interpreter_context(void *context)
390394

391395
for (i=0; i<thread_resources->count; i++) {
392396
if (resource_types_table[i].dtor) {
393-
resource_types_table[i].dtor(thread_resources->storage[i], &thread_resources->storage);
397+
resource_types_table[i].dtor(thread_resources->storage[i]);
394398
}
395399
}
396400
for (i=0; i<thread_resources->count; i++) {
@@ -455,7 +459,7 @@ void ts_free_thread(void)
455459
if (thread_resources->thread_id == thread_id) {
456460
for (i=0; i<thread_resources->count; i++) {
457461
if (resource_types_table[i].dtor) {
458-
resource_types_table[i].dtor(thread_resources->storage[i], &thread_resources->storage);
462+
resource_types_table[i].dtor(thread_resources->storage[i]);
459463
}
460464
}
461465
for (i=0; i<thread_resources->count; i++) {
@@ -497,7 +501,7 @@ void ts_free_worker_threads(void)
497501
if (thread_resources->thread_id != thread_id) {
498502
for (i=0; i<thread_resources->count; i++) {
499503
if (resource_types_table[i].dtor) {
500-
resource_types_table[i].dtor(thread_resources->storage[i], &thread_resources->storage);
504+
resource_types_table[i].dtor(thread_resources->storage[i]);
501505
}
502506
}
503507
for (i=0; i<thread_resources->count; i++) {
@@ -543,7 +547,7 @@ void ts_free_id(ts_rsrc_id id)
543547
while (p) {
544548
if (p->count > j && p->storage[j]) {
545549
if (resource_types_table && resource_types_table[j].dtor) {
546-
resource_types_table[j].dtor(p->storage[j], &p->storage);
550+
resource_types_table[j].dtor(p->storage[j]);
547551
}
548552
free(p->storage[j]);
549553
p->storage[j] = NULL;
@@ -791,4 +795,9 @@ void tsrm_error_set(int level, char *debug_filename)
791795
#endif
792796
}
793797

798+
TSRM_API void *tsrm_get_ls_cache(void)
799+
{
800+
return tsrm_tls_get();
801+
}
802+
794803
#endif /* ZTS */

TSRM/TSRM.h

+35-11
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ typedef struct {
9494
#include <signal.h>
9595
#endif
9696

97-
typedef void (*ts_allocate_ctor)(void *, void ***);
98-
typedef void (*ts_allocate_dtor)(void *, void ***);
97+
typedef void (*ts_allocate_ctor)(void *);
98+
typedef void (*ts_allocate_dtor)(void *);
9999

100100
#define THREAD_HASH_OF(thr,ts) (unsigned long)thr%(unsigned long)ts
101101

@@ -129,8 +129,8 @@ TSRM_API void ts_free_id(ts_rsrc_id id);
129129
#define TSRM_ERROR_LEVEL_CORE 2
130130
#define TSRM_ERROR_LEVEL_INFO 3
131131

132-
typedef void (*tsrm_thread_begin_func_t)(THREAD_T thread_id, void ***tsrm_ls);
133-
typedef void (*tsrm_thread_end_func_t)(THREAD_T thread_id, void ***tsrm_ls);
132+
typedef void (*tsrm_thread_begin_func_t)(THREAD_T thread_id);
133+
typedef void (*tsrm_thread_end_func_t)(THREAD_T thread_id);
134134

135135

136136
TSRM_API int tsrm_error(int level, const char *format, ...);
@@ -155,17 +155,33 @@ TSRM_API void *tsrm_new_interpreter_context(void);
155155
TSRM_API void *tsrm_set_interpreter_context(void *new_ctx);
156156
TSRM_API void tsrm_free_interpreter_context(void *context);
157157

158+
TSRM_API void *tsrm_get_ls_cache(void);
159+
160+
#ifdef TSRM_WIN32
161+
# define TSRM_TLS __declspec(thread)
162+
#else
163+
# define TSRM_TLS __thread
164+
#endif
165+
158166
#define TSRM_SHUFFLE_RSRC_ID(rsrc_id) ((rsrc_id)+1)
159167
#define TSRM_UNSHUFFLE_RSRC_ID(rsrc_id) ((rsrc_id)-1)
160168

161-
#define TSRMLS_FETCH() void ***tsrm_ls = (void ***) ts_resource_ex(0, NULL)
162169
#define TSRMLS_FETCH_FROM_CTX(ctx) void ***tsrm_ls = (void ***) ctx
163-
#define TSRMLS_SET_CTX(ctx) ctx = (void ***) tsrm_ls
164-
#define TSRMG(id, type, element) (((type) (*((void ***) tsrm_ls))[TSRM_UNSHUFFLE_RSRC_ID(id)])->element)
165-
#define TSRMLS_D void ***tsrm_ls
166-
#define TSRMLS_DC , TSRMLS_D
167-
#define TSRMLS_C tsrm_ls
168-
#define TSRMLS_CC , TSRMLS_C
170+
#define TSRMLS_SET_CTX(ctx) ctx = (void ***) tsrm_get_ls_cache()
171+
#define TSRMG(id, type, element) (((type) (*((void ***) tsrm_get_ls_cache()))[TSRM_UNSHUFFLE_RSRC_ID(id)])->element)
172+
173+
#define TSRMG_STATIC(id, type, element) (((type) (*((void ***) TSRMLS_CACHE))[TSRM_UNSHUFFLE_RSRC_ID(id)])->element)
174+
#define TSRMLS_CACHE_EXTERN extern TSRM_TLS void *TSRMLS_CACHE
175+
#define TSRMLS_CACHE_DEFINE TSRM_TLS void *TSRMLS_CACHE = NULL
176+
#define TSRMLS_CACHE_UPDATE if (!TSRMLS_CACHE) TSRMLS_CACHE = tsrm_get_ls_cache()
177+
#define TSRMLS_CACHE _tsrm_ls_cache
178+
179+
/* BC only */
180+
#define TSRMLS_D void
181+
#define TSRMLS_DC
182+
#define TSRMLS_C
183+
#define TSRMLS_CC
184+
#define TSRMLS_FETCH()
169185

170186
#ifdef __cplusplus
171187
}
@@ -176,6 +192,14 @@ TSRM_API void tsrm_free_interpreter_context(void *context);
176192
#define TSRMLS_FETCH()
177193
#define TSRMLS_FETCH_FROM_CTX(ctx)
178194
#define TSRMLS_SET_CTX(ctx)
195+
196+
#define TSRMG_STATIC(id, type, element)
197+
#define TSRMLS_CACHE_EXTERN
198+
#define TSRMLS_CACHE_DEFINE
199+
#define TSRMLS_CACHE_UPDATE
200+
#define TSRMLS_CACHE
201+
202+
/* BC only */
179203
#define TSRMLS_D void
180204
#define TSRMLS_DC
181205
#define TSRMLS_C

TSRM/config.w32

+1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
// $Id$
33

44
ADD_SOURCES("TSRM", "TSRM.c tsrm_strtok_r.c tsrm_win32.c");
5+
ADD_FLAG("CFLAGS_BD_TSRM", "/D ZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
56

TSRM/tsrm_win32.c

+18-18
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,11 @@ static ts_rsrc_id win32_globals_id;
4040
static tsrm_win32_globals win32_globals;
4141
#endif
4242

43-
static void tsrm_win32_ctor(tsrm_win32_globals *globals TSRMLS_DC)
43+
static void tsrm_win32_ctor(tsrm_win32_globals *globals)
4444
{
45+
#ifdef ZTS
46+
TSRMLS_CACHE_UPDATE;
47+
#endif
4548
globals->process = NULL;
4649
globals->shm = NULL;
4750
globals->process_size = 0;
@@ -59,7 +62,7 @@ static void tsrm_win32_ctor(tsrm_win32_globals *globals TSRMLS_DC)
5962
globals->impersonation_token_sid = NULL;
6063
}
6164

62-
static void tsrm_win32_dtor(tsrm_win32_globals *globals TSRMLS_DC)
65+
static void tsrm_win32_dtor(tsrm_win32_globals *globals)
6366
{
6467
shm_pair *ptr;
6568

@@ -92,18 +95,18 @@ TSRM_API void tsrm_win32_startup(void)
9295
#ifdef ZTS
9396
ts_allocate_id(&win32_globals_id, sizeof(tsrm_win32_globals), (ts_allocate_ctor)tsrm_win32_ctor, (ts_allocate_ctor)tsrm_win32_dtor);
9497
#else
95-
tsrm_win32_ctor(&win32_globals TSRMLS_CC);
98+
tsrm_win32_ctor(&win32_globals);
9699
#endif
97100
}
98101

99102
TSRM_API void tsrm_win32_shutdown(void)
100103
{
101104
#ifndef ZTS
102-
tsrm_win32_dtor(&win32_globals TSRMLS_CC);
105+
tsrm_win32_dtor(&win32_globals);
103106
#endif
104107
}
105108

106-
char * tsrm_win32_get_path_sid_key(const char *pathname TSRMLS_DC)
109+
char * tsrm_win32_get_path_sid_key(const char *pathname)
107110
{
108111
PSID pSid = TWG(impersonation_token_sid);
109112
TCHAR *ptcSid = NULL;
@@ -191,7 +194,7 @@ PSID tsrm_win32_get_token_sid(HANDLE hToken)
191194
return NULL;
192195
}
193196

194-
TSRM_API int tsrm_win32_access(const char *pathname, int mode TSRMLS_DC)
197+
TSRM_API int tsrm_win32_access(const char *pathname, int mode)
195198
{
196199
time_t t;
197200
HANDLE thread_token = NULL;
@@ -214,7 +217,7 @@ TSRM_API int tsrm_win32_access(const char *pathname, int mode TSRMLS_DC)
214217
} else {
215218
if(!IS_ABSOLUTE_PATH(pathname, strlen(pathname)+1)) {
216219
real_path = (char *)malloc(MAX_PATH);
217-
if(tsrm_realpath(pathname, real_path TSRMLS_CC) == NULL) {
220+
if(tsrm_realpath(pathname, real_path) == NULL) {
218221
goto Finished;
219222
}
220223
pathname = real_path;
@@ -278,14 +281,14 @@ TSRM_API int tsrm_win32_access(const char *pathname, int mode TSRMLS_DC)
278281

279282
if (CWDG(realpath_cache_size_limit)) {
280283
t = time(0);
281-
bucket = realpath_cache_lookup(pathname, (int)strlen(pathname), t TSRMLS_CC);
284+
bucket = realpath_cache_lookup(pathname, (int)strlen(pathname), t);
282285
if(bucket == NULL && real_path == NULL) {
283286
/* We used the pathname directly. Call tsrm_realpath */
284287
/* so that entry is created in realpath cache */
285288
real_path = (char *)malloc(MAX_PATH);
286-
if(tsrm_realpath(pathname, real_path TSRMLS_CC) != NULL) {
289+
if(tsrm_realpath(pathname, real_path) != NULL) {
287290
pathname = real_path;
288-
bucket = realpath_cache_lookup(pathname, (int)strlen(pathname), t TSRMLS_CC);
291+
bucket = realpath_cache_lookup(pathname, (int)strlen(pathname), t);
289292
}
290293
}
291294
}
@@ -380,7 +383,7 @@ TSRM_API int tsrm_win32_access(const char *pathname, int mode TSRMLS_DC)
380383
}
381384

382385

383-
static process_pair *process_get(FILE *stream TSRMLS_DC)
386+
static process_pair *process_get(FILE *stream)
384387
{
385388
process_pair *ptr;
386389
process_pair *newptr;
@@ -410,7 +413,6 @@ static shm_pair *shm_get(int key, void *addr)
410413
{
411414
shm_pair *ptr;
412415
shm_pair *newptr;
413-
TSRMLS_FETCH();
414416

415417
for (ptr = TWG(shm); ptr < (TWG(shm) + TWG(shm_size)); ptr++) {
416418
if (!ptr->descriptor) {
@@ -448,12 +450,11 @@ static HANDLE dupHandle(HANDLE fh, BOOL inherit) {
448450

449451
TSRM_API FILE *popen(const char *command, const char *type)
450452
{
451-
TSRMLS_FETCH();
452453

453-
return popen_ex(command, type, NULL, NULL TSRMLS_CC);
454+
return popen_ex(command, type, NULL, NULL);
454455
}
455456

456-
TSRM_API FILE *popen_ex(const char *command, const char *type, const char *cwd, char *env TSRMLS_DC)
457+
TSRM_API FILE *popen_ex(const char *command, const char *type, const char *cwd, char *env)
457458
{
458459
FILE *stream = NULL;
459460
int fno, type_len, read, mode;
@@ -550,7 +551,7 @@ TSRM_API FILE *popen_ex(const char *command, const char *type, const char *cwd,
550551
}
551552

552553
CloseHandle(process.hThread);
553-
proc = process_get(NULL TSRMLS_CC);
554+
proc = process_get(NULL);
554555

555556
if (read) {
556557
fno = _open_osfhandle((tsrm_intptr_t)in, _O_RDONLY | mode);
@@ -570,9 +571,8 @@ TSRM_API int pclose(FILE *stream)
570571
{
571572
DWORD termstat = 0;
572573
process_pair *process;
573-
TSRMLS_FETCH();
574574

575-
if ((process = process_get(stream TSRMLS_CC)) == NULL) {
575+
if ((process = process_get(stream)) == NULL) {
576576
return 0;
577577
}
578578

TSRM/tsrm_win32.h

+5-4
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ typedef struct {
7171
} tsrm_win32_globals;
7272

7373
#ifdef ZTS
74-
# define TWG(v) TSRMG(win32_globals_id, tsrm_win32_globals *, v)
74+
# define TWG(v) TSRMG_STATIC(win32_globals_id, tsrm_win32_globals *, v)
75+
TSRMLS_CACHE_EXTERN;
7576
#else
7677
# define TWG(v) (win32_globals.v)
7778
#endif
@@ -93,15 +94,15 @@ typedef struct {
9394
#define SHM_RND FILE_MAP_WRITE
9495
#define SHM_REMAP FILE_MAP_COPY
9596

96-
char * tsrm_win32_get_path_sid_key(const char *pathname TSRMLS_DC);
97+
char * tsrm_win32_get_path_sid_key(const char *pathname );
9798

9899
TSRM_API void tsrm_win32_startup(void);
99100
TSRM_API void tsrm_win32_shutdown(void);
100101

101-
TSRM_API FILE *popen_ex(const char *command, const char *type, const char *cwd, char *env TSRMLS_DC);
102+
TSRM_API FILE *popen_ex(const char *command, const char *type, const char *cwd, char *env);
102103
TSRM_API FILE *popen(const char *command, const char *type);
103104
TSRM_API int pclose(FILE *stream);
104-
TSRM_API int tsrm_win32_access(const char *pathname, int mode TSRMLS_DC);
105+
TSRM_API int tsrm_win32_access(const char *pathname, int mode);
105106
TSRM_API int win32_utime(const char *filename, struct utimbuf *buf);
106107

107108
TSRM_API int shmget(int key, int size, int flags);

0 commit comments

Comments
 (0)