Skip to content

Commit 9877773

Browse files
committed
Merge branch 'PHP-5.5' of git.php.net:php-src into PHP-5.5
2 parents 25c9f34 + e60638f commit 9877773

File tree

13 files changed

+76
-46
lines changed

13 files changed

+76
-46
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ PHP NEWS
1111
- CURL:
1212
. Remove curl stream wrappers. (Pierrick)
1313

14+
- MySQLi:
15+
. Fixed bug #64726 (Segfault when calling fetch_object on a use_result and DB
16+
pointer has closed). (Laruence)
17+
1418
- Zip:
1519
. Fixed bug #64342 (ZipArchive::addFile() has to check for file existence).
1620
(Anatol)

Zend/zend_builtin_functions.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1014,7 +1014,7 @@ ZEND_FUNCTION(get_object_vars)
10141014
while (zend_hash_get_current_data_ex(properties, (void **) &value, &pos) == SUCCESS) {
10151015
if (zend_hash_get_current_key_ex(properties, &key, &key_len, &num_index, 0, &pos) == HASH_KEY_IS_STRING) {
10161016
if (zend_check_property_access(zobj, key, key_len-1 TSRMLS_CC) == SUCCESS) {
1017-
zend_unmangle_property_name_ex(key, key_len - 1, &class_name, &prop_name, &prop_len);
1017+
zend_unmangle_property_name_ex(key, key_len - 1, &class_name, &prop_name, (int*) &prop_len);
10181018
/* Not separating references */
10191019
Z_ADDREF_PP(value);
10201020
add_assoc_zval_ex(return_value, prop_name, prop_len + 1, *value);

ext/date/lib/parse_date.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Generated by re2c 0.13.5 on Sun Mar 31 10:47:54 2013 */
1+
/* Generated by re2c 0.13.5 on Fri Apr 26 11:10:28 2013 */
22
#line 1 "ext/date/lib/parse_date.re"
33
/*
44
+----------------------------------------------------------------------+
@@ -25089,7 +25089,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim
2508925089
break;
2509025090

2509125091
case '\\': /* escaped char */
25092-
*fptr++;
25092+
++fptr;
2509325093
if (*ptr == *fptr) {
2509425094
++ptr;
2509525095
} else {

ext/date/lib/parse_date.re

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2096,7 +2096,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim
20962096
break;
20972097

20982098
case '\\': /* escaped char */
2099-
*fptr++;
2099+
++fptr;
21002100
if (*ptr == *fptr) {
21012101
++ptr;
21022102
} else {

ext/date/php_date.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -614,13 +614,11 @@ static void date_object_free_storage_interval(void *object TSRMLS_DC);
614614
static void date_object_free_storage_period(void *object TSRMLS_DC);
615615

616616
static zend_object_value date_object_new_date(zend_class_entry *class_type TSRMLS_DC);
617-
static zend_object_value date_object_new_immutable(zend_class_entry *class_type TSRMLS_DC);
618617
static zend_object_value date_object_new_timezone(zend_class_entry *class_type TSRMLS_DC);
619618
static zend_object_value date_object_new_interval(zend_class_entry *class_type TSRMLS_DC);
620619
static zend_object_value date_object_new_period(zend_class_entry *class_type TSRMLS_DC);
621620

622621
static zend_object_value date_object_clone_date(zval *this_ptr TSRMLS_DC);
623-
static zend_object_value date_object_clone_immutable(zval *this_ptr TSRMLS_DC);
624622
static zend_object_value date_object_clone_timezone(zval *this_ptr TSRMLS_DC);
625623
static zend_object_value date_object_clone_interval(zval *this_ptr TSRMLS_DC);
626624
static zend_object_value date_object_clone_period(zval *this_ptr TSRMLS_DC);

ext/fileinfo/libmagic.patch

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
22
--- libmagic.orig/apprentice.c 2013-03-21 18:45:14.000000000 +0100
3-
+++ libmagic/apprentice.c 2013-04-08 16:14:17.828357711 +0200
3+
+++ libmagic/apprentice.c 2013-04-27 13:53:32.175250261 +0200
44
@@ -29,6 +29,8 @@
55
* apprentice - make one pass through /etc/magic, learning its secrets.
66
*/
@@ -352,7 +352,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
352352
file_oomem(ms, slen);
353353
return -1;
354354
}
355-
@@ -1102,14 +1121,14 @@
355+
@@ -1102,27 +1121,29 @@
356356
if (me == NULL)
357357
return;
358358
for (i = 0; i < nme; i++)
@@ -370,8 +370,9 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
370370
struct magic_entry *mentry[MAGIC_SETS] = { NULL };
371371
uint32_t mentrycount[MAGIC_SETS] = { 0 };
372372
uint32_t i, j;
373-
@@ -1117,12 +1136,14 @@
374-
char **filearr = NULL, *mfn;
373+
size_t files = 0, maxfiles = 0;
374+
- char **filearr = NULL, *mfn;
375+
+ char **filearr = NULL;
375376
struct stat st;
376377
struct magic_map *map;
377378
- DIR *dir;
@@ -411,7 +412,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
411412
+ int mflen;
412413
+ char mfn[MAXPATHLEN];
413414
+
414-
+ dir = php_stream_opendir(fn, REPORT_ERRORS, NULL);
415+
+ dir = php_stream_opendir((char *)fn, REPORT_ERRORS, NULL);
415416
if (!dir) {
416417
errs++;
417418
goto out;
@@ -578,7 +579,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
578579
+#ifdef PHP_WIN32
579580
+ /* Don't bother on windows with php_stream_open_wrapper,
580581
+ return to give apprentice_load() a chance. */
581-
+ if (php_stream_stat_path_ex(fn, 0, &st, NULL) == SUCCESS) {
582+
+ if (php_stream_stat_path_ex((char *)fn, 0, &st, NULL) == SUCCESS) {
582583
+ if (st.sb.st_mode & S_IFDIR) {
583584
+ goto error;
584585
+ }
@@ -751,7 +752,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
751752
}
752753

753754
- if (write(fd, map->nmagic, nm) != (ssize_t)nm) {
754-
+ if (php_stream_write(stream, map->nmagic, nm) != (ssize_t)nm) {
755+
+ if (php_stream_write(stream, (const char *)map->nmagic, nm) != (ssize_t)nm) {
755756
file_error(ms, errno, "error writing `%s'", dbname);
756757
goto out;
757758
}
@@ -767,7 +768,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
767768
for (i = 0; i < MAGIC_SETS; i++) {
768769
len = m * map->nmagic[i];
769770
- if (write(fd, map->magic[i], len) != (ssize_t)len) {
770-
+ if (php_stream_write(stream, map->magic[i], len) != (ssize_t)len) {
771+
+ if (php_stream_write(stream, (const char *)map->magic[i], len) != (ssize_t)len) {
771772
file_error(ms, errno, "error writing `%s'", dbname);
772773
goto out;
773774
}
@@ -2047,7 +2048,7 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c
20472048
+
20482049
diff -u libmagic.orig/magic.c libmagic/magic.c
20492050
--- libmagic.orig/magic.c 2013-01-11 17:43:09.000000000 +0100
2050-
+++ libmagic/magic.c 2013-04-08 15:42:57.328298809 +0200
2051+
+++ libmagic/magic.c 2013-04-27 13:53:32.175250261 +0200
20512052
@@ -25,11 +25,6 @@
20522053
* SUCH DAMAGE.
20532054
*/
@@ -2089,7 +2090,7 @@ diff -u libmagic.orig/magic.c libmagic/magic.c
20892090
#if defined(HAVE_UTIMES)
20902091
# include <sys/time.h>
20912092
#elif defined(HAVE_UTIME)
2092-
@@ -71,18 +75,24 @@
2093+
@@ -71,18 +75,25 @@
20932094
#endif
20942095
#endif
20952096

@@ -2098,14 +2099,14 @@ diff -u libmagic.orig/magic.c libmagic/magic.c
20982099
+# undef S_IFIFO
20992100
+#endif
21002101
+
2101-
+private void free_mlist(struct mlist *);
21022102
private void close_and_restore(const struct magic_set *, const char *, int,
21032103
const struct stat *);
21042104
private int unreadable_info(struct magic_set *, mode_t, const char *);
2105+
+#if 0
21052106
private const char* get_default_magic(void);
21062107
-#ifndef COMPILE_ONLY
21072108
-private const char *file_or_fd(struct magic_set *, const char *, int);
2108-
-#endif
2109+
#endif
21092110
+private const char *file_or_stream(struct magic_set *, const char *, php_stream *);
21102111

21112112
#ifndef STDIN_FILENO
@@ -2117,7 +2118,7 @@ diff -u libmagic.orig/magic.c libmagic/magic.c
21172118
private const char *
21182119
get_default_magic(void)
21192120
{
2120-
@@ -90,7 +100,7 @@
2121+
@@ -90,7 +101,7 @@
21212122
static char *default_magic;
21222123
char *home, *hmagicpath;
21232124

@@ -2126,7 +2127,7 @@ diff -u libmagic.orig/magic.c libmagic/magic.c
21262127
struct stat st;
21272128

21282129
if (default_magic) {
2129-
@@ -104,17 +114,17 @@
2130+
@@ -104,17 +115,17 @@
21302131
return MAGIC;
21312132
if (stat(hmagicpath, &st) == -1) {
21322133
free(hmagicpath);
@@ -2153,15 +2154,15 @@ diff -u libmagic.orig/magic.c libmagic/magic.c
21532154
}
21542155

21552156
if (asprintf(&default_magic, "%s:%s", hmagicpath, MAGIC) < 0)
2156-
@@ -128,6 +138,7 @@
2157+
@@ -128,6 +139,7 @@
21572158
#else
21582159
char *hmagicp = hmagicpath;
21592160
char *tmppath = NULL;
21602161
+ LPTSTR dllpath;
21612162

21622163
#define APPENDPATH() \
21632164
do { \
2164-
@@ -172,7 +183,7 @@
2165+
@@ -172,7 +184,7 @@
21652166
}
21662167

21672168
/* Third, try to get magic file relative to dll location */
@@ -2170,15 +2171,15 @@ diff -u libmagic.orig/magic.c libmagic/magic.c
21702171
dllpath[MAX_PATH] = 0; /* just in case long path gets truncated and not null terminated */
21712172
if (GetModuleFileNameA(NULL, dllpath, MAX_PATH)){
21722173
PathRemoveFileSpecA(dllpath);
2173-
@@ -210,6 +221,7 @@
2174+
@@ -210,6 +222,7 @@
21742175

21752176
return action == FILE_LOAD ? get_default_magic() : MAGIC;
21762177
}
21772178
+#endif
21782179

21792180
public struct magic_set *
21802181
magic_open(int flags)
2181-
@@ -250,7 +262,7 @@
2182+
@@ -250,7 +263,7 @@
21822183
magic_load(struct magic_set *ms, const char *magicfile)
21832184
{
21842185
if (ms == NULL)
@@ -2187,7 +2188,7 @@ diff -u libmagic.orig/magic.c libmagic/magic.c
21872188
return file_apprentice(ms, magicfile, FILE_LOAD);
21882189
}
21892190

2190-
@@ -262,13 +274,6 @@
2191+
@@ -262,13 +275,6 @@
21912192
return file_apprentice(ms, magicfile, FILE_COMPILE);
21922193
}
21932194

@@ -2201,7 +2202,7 @@ diff -u libmagic.orig/magic.c libmagic/magic.c
22012202

22022203
public int
22032204
magic_list(struct magic_set *ms, const char *magicfile)
2204-
@@ -282,9 +287,6 @@
2205+
@@ -282,9 +288,6 @@
22052206
close_and_restore(const struct magic_set *ms, const char *name, int fd,
22062207
const struct stat *sb)
22072208
{
@@ -2211,15 +2212,15 @@ diff -u libmagic.orig/magic.c libmagic/magic.c
22112212

22122213
if ((ms->flags & MAGIC_PRESERVE_ATIME) != 0) {
22132214
/*
2214-
@@ -311,7 +313,6 @@
2215+
@@ -311,7 +314,6 @@
22152216
}
22162217
}
22172218

22182219
-#ifndef COMPILE_ONLY
22192220

22202221
/*
22212222
* find type of descriptor
2222-
@@ -321,7 +322,7 @@
2223+
@@ -321,7 +323,7 @@
22232224
{
22242225
if (ms == NULL)
22252226
return NULL;
@@ -2228,7 +2229,7 @@ diff -u libmagic.orig/magic.c libmagic/magic.c
22282229
}
22292230

22302231
/*
2231-
@@ -332,30 +333,42 @@
2232+
@@ -332,30 +334,42 @@
22322233
{
22332234
if (ms == NULL)
22342235
return NULL;
@@ -2277,7 +2278,7 @@ diff -u libmagic.orig/magic.c libmagic/magic.c
22772278
case -1: /* error */
22782279
goto done;
22792280
case 0: /* nothing found */
2280-
@@ -365,68 +378,48 @@
2281+
@@ -365,68 +379,48 @@
22812282
goto done;
22822283
}
22832284

@@ -2372,7 +2373,7 @@ diff -u libmagic.orig/magic.c libmagic/magic.c
23722373
return rv == 0 ? file_getbuffer(ms) : NULL;
23732374
}
23742375

2375-
@@ -440,14 +433,13 @@
2376+
@@ -440,14 +434,13 @@
23762377
return NULL;
23772378
/*
23782379
* The main work is done here!
@@ -2410,25 +2411,26 @@ diff -u libmagic.orig/magic.h libmagic/magic.h
24102411

24112412
diff -u libmagic.orig/print.c libmagic/print.c
24122413
--- libmagic.orig/print.c 2013-03-21 18:45:14.000000000 +0100
2413-
+++ libmagic/print.c 2013-04-08 15:42:57.328298809 +0200
2414-
@@ -28,6 +28,8 @@
2414+
+++ libmagic/print.c 2013-04-27 13:53:32.175250261 +0200
2415+
@@ -28,13 +28,17 @@
24152416
/*
24162417
* print.c - debugging printout routines
24172418
*/
24182419
+#define _GNU_SOURCE
24192420
+#include "php.h"
24202421

24212422
#include "file.h"
2423+
+#include "cdf.h"
24222424

2423-
@@ -35,6 +37,7 @@
2425+
#ifndef lint
24242426
FILE_RCSID("@(#)$File: print.c,v 1.76 2013/02/26 18:25:00 christos Exp $")
24252427
#endif /* lint */
24262428

24272429
+#include <stdio.h>
24282430
#include <string.h>
24292431
#include <stdarg.h>
24302432
#include <stdlib.h>
2431-
@@ -43,188 +46,28 @@
2433+
@@ -43,188 +47,28 @@
24322434
#endif
24332435
#include <time.h>
24342436

@@ -2619,7 +2621,7 @@ diff -u libmagic.orig/print.c libmagic/print.c
26192621
- (void) fprintf(stderr, "Warning: ");
26202622
va_start(va, f);
26212623
- (void) vfprintf(stderr, f, va);
2622-
+ vasprintf(&expanded_format, f, va);
2624+
+ if (vasprintf(&expanded_format, f, va)); /* silence */
26232625
va_end(va);
26242626
- (void) fputc('\n', stderr);
26252627
+
@@ -2629,7 +2631,7 @@ diff -u libmagic.orig/print.c libmagic/print.c
26292631
}
26302632

26312633
protected const char *
2632-
@@ -235,7 +78,7 @@
2634+
@@ -235,7 +79,7 @@
26332635
struct tm *tm;
26342636

26352637
if (flags & FILE_T_WINDOWS) {

ext/fileinfo/libmagic/apprentice.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,7 +1133,7 @@ apprentice_load(struct magic_set *ms, const char *fn, int action)
11331133
uint32_t mentrycount[MAGIC_SETS] = { 0 };
11341134
uint32_t i, j;
11351135
size_t files = 0, maxfiles = 0;
1136-
char **filearr = NULL, *mfn;
1136+
char **filearr = NULL;
11371137
struct stat st;
11381138
struct magic_map *map;
11391139
php_stream *dir;
@@ -1169,7 +1169,7 @@ apprentice_load(struct magic_set *ms, const char *fn, int action)
11691169
int mflen;
11701170
char mfn[MAXPATHLEN];
11711171

1172-
dir = php_stream_opendir(fn, REPORT_ERRORS, NULL);
1172+
dir = php_stream_opendir((char *)fn, REPORT_ERRORS, NULL);
11731173
if (!dir) {
11741174
errs++;
11751175
goto out;
@@ -2613,7 +2613,7 @@ apprentice_map(struct magic_set *ms, const char *fn)
26132613
#ifdef PHP_WIN32
26142614
/* Don't bother on windows with php_stream_open_wrapper,
26152615
return to give apprentice_load() a chance. */
2616-
if (php_stream_stat_path_ex(fn, 0, &st, NULL) == SUCCESS) {
2616+
if (php_stream_stat_path_ex((char *)fn, 0, &st, NULL) == SUCCESS) {
26172617
if (st.sb.st_mode & S_IFDIR) {
26182618
goto error;
26192619
}
@@ -2778,7 +2778,7 @@ apprentice_compile(struct magic_set *ms, struct magic_map *map, const char *fn)
27782778
goto out;
27792779
}
27802780

2781-
if (php_stream_write(stream, map->nmagic, nm) != (ssize_t)nm) {
2781+
if (php_stream_write(stream, (const char *)map->nmagic, nm) != (ssize_t)nm) {
27822782
file_error(ms, errno, "error writing `%s'", dbname);
27832783
goto out;
27842784
}
@@ -2792,7 +2792,7 @@ apprentice_compile(struct magic_set *ms, struct magic_map *map, const char *fn)
27922792

27932793
for (i = 0; i < MAGIC_SETS; i++) {
27942794
len = m * map->nmagic[i];
2795-
if (php_stream_write(stream, map->magic[i], len) != (ssize_t)len) {
2795+
if (php_stream_write(stream, (const char *)map->magic[i], len) != (ssize_t)len) {
27962796
file_error(ms, errno, "error writing `%s'", dbname);
27972797
goto out;
27982798
}

ext/fileinfo/libmagic/magic.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,12 @@ FILE_RCSID("@(#)$File: magic.c,v 1.78 2013/01/07 18:20:19 christos Exp $")
8080
# undef S_IFIFO
8181
#endif
8282

83-
private void free_mlist(struct mlist *);
8483
private void close_and_restore(const struct magic_set *, const char *, int,
8584
const struct stat *);
8685
private int unreadable_info(struct magic_set *, mode_t, const char *);
86+
#if 0
8787
private const char* get_default_magic(void);
88+
#endif
8889
private const char *file_or_stream(struct magic_set *, const char *, php_stream *);
8990

9091
#ifndef STDIN_FILENO

ext/fileinfo/libmagic/print.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include "php.h"
3333

3434
#include "file.h"
35+
#include "cdf.h"
3536

3637
#ifndef lint
3738
FILE_RCSID("@(#)$File: print.c,v 1.76 2013/02/26 18:25:00 christos Exp $")
@@ -62,7 +63,7 @@ file_magwarn(struct magic_set *ms, const char *f, ...)
6263
TSRMLS_FETCH();
6364

6465
va_start(va, f);
65-
vasprintf(&expanded_format, f, va);
66+
if (vasprintf(&expanded_format, f, va)); /* silence */
6667
va_end(va);
6768

6869
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Warning: %s", expanded_format);

0 commit comments

Comments
 (0)