mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-13 04:00:50 +00:00
Compare commits
37
Commits
php-5.4.9
...
php-5.3.20
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
13adcc108d | ||
|
|
c31ce8a125 | ||
|
|
94cbd6374a | ||
|
|
31ab57e052 | ||
|
|
c2554b4bb4 | ||
|
|
ff6c9e2726 | ||
|
|
00d86afedf | ||
|
|
40fabf68ed | ||
|
|
dc2192c087 | ||
|
|
92e2f29381 | ||
|
|
bc492007da | ||
|
|
f08060a48f | ||
|
|
1e6baa2673 | ||
|
|
e6b727d3b7 | ||
|
|
eff12e56b6 | ||
|
|
df3b9a1e07 | ||
|
|
92147243bf | ||
|
|
90d2561a9c | ||
|
|
f55bed9dad | ||
|
|
8a84b1b5d9 | ||
|
|
1702024073 | ||
|
|
cc315e79e1 | ||
|
|
396c1e990a | ||
|
|
d412152f31 | ||
|
|
c886691100 | ||
|
|
6dff07aa8c | ||
|
|
16f9f46935 | ||
|
|
7468fc0e37 | ||
|
|
f5d8b638c7 | ||
|
|
019bdff395 | ||
|
|
00ad4c0e6a | ||
|
|
1e081a825e | ||
|
|
bb60122c2f | ||
|
|
065862a750 | ||
|
|
44a6fe8411 | ||
|
|
417b1b238f | ||
|
|
1784279be0 |
No files matched your search
@@ -1,6 +1,50 @@
|
||||
PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
?? ??? 2012, PHP 5.3.19
|
||||
20 Dec 2012, PHP 5.3.20
|
||||
|
||||
- Zend Engine:
|
||||
. Fixed bug #63635 (Segfault in gc_collect_cycles). (Dmitry)
|
||||
. Fixed bug #63512 (parse_ini_file() with INI_SCANNER_RAW removes quotes
|
||||
from value). (Pierrick)
|
||||
. Fixed bug #63468 (wrong called method as callback with inheritance).
|
||||
(Laruence)
|
||||
|
||||
- Core:
|
||||
. Fixed bug #63451 (config.guess file does not have AIX 7 defined,
|
||||
shared objects are not created). (kemcline at au1 dot ibm dot com)
|
||||
. Fixed bug #63377 (Segfault on output buffer).
|
||||
(miau dot jp at gmail dot com, Laruence)
|
||||
|
||||
- Apache2 Handler SAPI:
|
||||
. Enabled Apache 2.4 configure option for Windows (Pierre, Anatoliy)
|
||||
|
||||
- Date:
|
||||
. Fixed bug #63435 (Datetime::format('u') sometimes wrong by 1 microsecond).
|
||||
(Remi)
|
||||
|
||||
- Fileinfo:
|
||||
. Fixed bug #63248 (Load multiple magic files from a directory under Windows).
|
||||
(Anatoliy)
|
||||
. Fixed bug #63590 (Different results in TS and NTS under Windows).
|
||||
(Anatoliy)
|
||||
|
||||
- FPM:
|
||||
. Fixed bug #63581 (Possible null dereference and buffer overflow). (Remi)
|
||||
|
||||
- Imap:
|
||||
. Fixed bug #63126 (DISABLE_AUTHENTICATOR ignores array). (Remi)
|
||||
|
||||
- MySQLnd:
|
||||
. Fixed bug #63398 (Segfault when polling closed link). (Laruence)
|
||||
|
||||
- Reflection:
|
||||
. Fixed Bug #63614 (Fatal error on Reflection). (Laruence)
|
||||
|
||||
- SOAP
|
||||
. Fixed bug #63271 (SOAP wsdl cache is not enabled after initial requests).
|
||||
(John Jawed, Dmitry)
|
||||
|
||||
22 Nov 2012, PHP 5.3.19
|
||||
|
||||
- Core
|
||||
. Fixed bug #63241 (PHP fails to open Windows deduplicated files).
|
||||
|
||||
@@ -484,6 +484,8 @@ UPGRADE NOTES - PHP 5.3
|
||||
must be activated manually with the "extension = php_com_dotnet.dll" directive
|
||||
in php.ini.
|
||||
|
||||
- Apache 2.4 handler is supported as of PHP 5.3.20
|
||||
|
||||
=====================
|
||||
11.1 New in PHP 5.3.4
|
||||
=====================
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
--TEST--
|
||||
Bug #63468 (wrong called method as callback with inheritance)
|
||||
--FILE--
|
||||
<?php
|
||||
class Foo
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
return call_user_func(array('Bar', 'getValue'));
|
||||
}
|
||||
|
||||
private static function getValue()
|
||||
{
|
||||
return 'Foo';
|
||||
}
|
||||
}
|
||||
|
||||
class Bar extends Foo
|
||||
{
|
||||
public static function getValue()
|
||||
{
|
||||
return 'Bar';
|
||||
}
|
||||
}
|
||||
|
||||
$x = new Bar;
|
||||
var_dump($x->run());
|
||||
--EXPECT--
|
||||
string(3) "Bar"
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
--TEST--
|
||||
Bug #63635 (Segfault in gc_collect_cycles)
|
||||
--FILE--
|
||||
<?php
|
||||
class Node {
|
||||
public $parent = NULL;
|
||||
public $childs = array();
|
||||
|
||||
function __construct(Node $parent=NULL) {
|
||||
if ($parent) {
|
||||
$parent->childs[] = $this;
|
||||
}
|
||||
$this->childs[] = $this;
|
||||
}
|
||||
|
||||
function __destruct() {
|
||||
$this->childs = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
define("MAX", 16);
|
||||
|
||||
for ($n = 0; $n < 20; $n++) {
|
||||
$top = new Node();
|
||||
for ($i=0 ; $i<MAX ; $i++) {
|
||||
$ci = new Node($top);
|
||||
for ($j=0 ; $j<MAX ; $j++) {
|
||||
$cj = new Node($ci);
|
||||
for ($k=0 ; $k<MAX ; $k++) {
|
||||
$ck = new Node($cj);
|
||||
}
|
||||
}
|
||||
}
|
||||
echo "$n\n";
|
||||
}
|
||||
echo "ok\n";
|
||||
--EXPECT--
|
||||
0
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
11
|
||||
12
|
||||
13
|
||||
14
|
||||
15
|
||||
16
|
||||
17
|
||||
18
|
||||
19
|
||||
ok
|
||||
+1
-1
@@ -2520,7 +2520,7 @@ static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fca
|
||||
} else if (zend_hash_find(ftable, lmname, mlen+1, (void**)&fcc->function_handler) == SUCCESS) {
|
||||
retval = 1;
|
||||
if ((fcc->function_handler->op_array.fn_flags & ZEND_ACC_CHANGED) &&
|
||||
EG(scope) &&
|
||||
!strict_class && EG(scope) &&
|
||||
instanceof_function(fcc->function_handler->common.scope, EG(scope) TSRMLS_CC)) {
|
||||
zend_function *priv_fbc;
|
||||
|
||||
|
||||
+4
-2
@@ -553,7 +553,8 @@ tail_call:
|
||||
struct _store_object *obj = &EG(objects_store).object_buckets[Z_OBJ_HANDLE_P(pz)].bucket.obj;
|
||||
|
||||
if (obj->buffered == (gc_root_buffer*)GC_WHITE) {
|
||||
GC_SET_BLACK(obj->buffered);
|
||||
/* PURPLE instead of BLACK to prevent buffering in nested gc calls */
|
||||
GC_SET_PURPLE(obj->buffered);
|
||||
|
||||
if (EXPECTED(EG(objects_store).object_buckets[Z_OBJ_HANDLE_P(pz)].valid &&
|
||||
Z_OBJ_HANDLER_P(pz, get_properties) != NULL)) {
|
||||
@@ -598,7 +599,8 @@ static void zobj_collect_white(zval *pz TSRMLS_DC)
|
||||
struct _store_object *obj = &EG(objects_store).object_buckets[Z_OBJ_HANDLE_P(pz)].bucket.obj;
|
||||
|
||||
if (obj->buffered == (gc_root_buffer*)GC_WHITE) {
|
||||
GC_SET_BLACK(obj->buffered);
|
||||
/* PURPLE instead of BLACK to prevent buffering in nested gc calls */
|
||||
GC_SET_PURPLE(obj->buffered);
|
||||
|
||||
if (EXPECTED(EG(objects_store).object_buckets[Z_OBJ_HANDLE_P(pz)].valid &&
|
||||
Z_OBJ_HANDLER_P(pz, get_properties) != NULL)) {
|
||||
|
||||
+1595
-1609
File diff suppressed because it is too large.
Load diff
+25
-18
@@ -347,7 +347,7 @@ DOLLAR_CURLY "${"
|
||||
|
||||
SECTION_RAW_CHARS [^\]\n\r]
|
||||
SINGLE_QUOTED_CHARS [^']
|
||||
RAW_VALUE_CHARS [^"\n\r;\000]
|
||||
RAW_VALUE_CHARS [^\n\r;\000]
|
||||
|
||||
LITERAL_DOLLAR ("$"([^{\000]|("\\"{ANY_CHAR})))
|
||||
VALUE_CHARS ([^$= \t\n\r;&|~()!"'\000]|{LITERAL_DOLLAR})
|
||||
@@ -445,33 +445,40 @@ SECTION_VALUE_CHARS ([^$\n\r;"'\]\\]|("\\"{ANY_CHAR})|{LITERAL_DOLLAR})
|
||||
return '=';
|
||||
}
|
||||
|
||||
<ST_RAW>["] {
|
||||
<ST_RAW>{RAW_VALUE_CHARS} { /* Raw value, only used when SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW. */
|
||||
char *sc = NULL;
|
||||
while (YYCURSOR < YYLIMIT) {
|
||||
switch (*YYCURSOR++) {
|
||||
switch (*YYCURSOR) {
|
||||
case '\n':
|
||||
SCNG(lineno)++;
|
||||
break;
|
||||
case '\r':
|
||||
if (*YYCURSOR != '\n') {
|
||||
SCNG(lineno)++;
|
||||
}
|
||||
goto end_raw_value_chars;
|
||||
break;
|
||||
case '"':
|
||||
yyleng = YYCURSOR - SCNG(yy_text) - 2;
|
||||
SCNG(yy_text)++;
|
||||
RETURN_TOKEN(TC_RAW, yytext, yyleng);
|
||||
case '\\':
|
||||
if (YYCURSOR < YYLIMIT) {
|
||||
YYCURSOR++;
|
||||
case ';':
|
||||
if (sc == NULL) {
|
||||
sc = YYCURSOR;
|
||||
}
|
||||
/* no break */
|
||||
default:
|
||||
YYCURSOR++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
end_raw_value_chars:
|
||||
yyleng = YYCURSOR - SCNG(yy_text);
|
||||
RETURN_TOKEN(TC_RAW, yytext, yyleng);
|
||||
}
|
||||
|
||||
<ST_RAW>{RAW_VALUE_CHARS}+ { /* Raw value, only used when SCNG(scanner_mode) == ZEND_INI_SCANNER_RAW. */
|
||||
/* Eat trailing semicolons */
|
||||
while (yytext[yyleng - 1] == ';') {
|
||||
yyleng--;
|
||||
}
|
||||
|
||||
/* Eat leading and trailing double quotes */
|
||||
if (yytext[0] == '"' && yytext[yyleng - 1] == '"') {
|
||||
SCNG(yy_text)++;
|
||||
yyleng = yyleng - 2;
|
||||
} else if (sc) {
|
||||
YYCURSOR = sc;
|
||||
yyleng = YYCURSOR - SCNG(yy_text);
|
||||
}
|
||||
RETURN_TOKEN(TC_RAW, yytext, yyleng);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Generated by re2c 0.13.5 on Thu Jun 7 17:37:03 2012 */
|
||||
/* Generated by re2c 0.13.5 on Fri Nov 16 17:44:02 2012 */
|
||||
#line 3 "Zend/zend_ini_scanner_defs.h"
|
||||
|
||||
enum YYCONDTYPE {
|
||||
|
||||
Vendored
+1
-1
@@ -532,7 +532,7 @@ EOF
|
||||
echo rs6000-ibm-aix3.2
|
||||
fi
|
||||
exit ;;
|
||||
*:AIX:*:[456])
|
||||
*:AIX:*:[4567])
|
||||
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
|
||||
if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
|
||||
IBM_ARCH=rs6000
|
||||
|
||||
+2
-2
@@ -41,8 +41,8 @@ AC_CONFIG_HEADER(main/php_config.h)
|
||||
|
||||
PHP_MAJOR_VERSION=5
|
||||
PHP_MINOR_VERSION=3
|
||||
PHP_RELEASE_VERSION=19
|
||||
PHP_EXTRA_VERSION="-dev"
|
||||
PHP_RELEASE_VERSION=20
|
||||
PHP_EXTRA_VERSION=""
|
||||
PHP_VERSION="$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION.$PHP_RELEASE_VERSION$PHP_EXTRA_VERSION"
|
||||
PHP_VERSION_ID=`expr [$]PHP_MAJOR_VERSION \* 10000 + [$]PHP_MINOR_VERSION \* 100 + [$]PHP_RELEASE_VERSION`
|
||||
|
||||
|
||||
+600
-568
File diff suppressed because it is too large.
Load diff
+1
-1
@@ -1095,7 +1095,7 @@ static char *date_format(char *format, int format_len, timelib_time *t, int loca
|
||||
case 'H': length = slprintf(buffer, 32, "%02d", (int) t->h); break;
|
||||
case 'i': length = slprintf(buffer, 32, "%02d", (int) t->i); break;
|
||||
case 's': length = slprintf(buffer, 32, "%02d", (int) t->s); break;
|
||||
case 'u': length = slprintf(buffer, 32, "%06d", (int) floor(t->f * 1000000)); break;
|
||||
case 'u': length = slprintf(buffer, 32, "%06d", (int) floor(t->f * 1000000 + 0.5)); break;
|
||||
|
||||
/* timezone */
|
||||
case 'I': length = slprintf(buffer, 32, "%d", localtime ? offset->is_dst : 0); break;
|
||||
|
||||
@@ -9,12 +9,12 @@ $d = date_create_from_format($format, "03-15-2005 12:22:29.000000 PST");
|
||||
echo $d->format($format), "\n";
|
||||
|
||||
$d = date_create_from_format($format, "03-15-2005 12:22:29.001001 PST");
|
||||
echo $d->format($format), " (precision isn't enough to show the 1 here)\n";
|
||||
echo $d->format($format), "\n";
|
||||
|
||||
$d = date_create_from_format($format, "03-15-2005 12:22:29.0010 PST");
|
||||
echo $d->format($format), "\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
03-15-2005 12:22:29.000000 PST
|
||||
03-15-2005 12:22:29.001000 PST (precision isn't enough to show the 1 here)
|
||||
03-15-2005 12:22:29.001001 PST
|
||||
03-15-2005 12:22:29.001000 PST
|
||||
@@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
Bug #63435 Datetime::format('u') sometimes wrong by 1 microsecond
|
||||
--INI--
|
||||
date.timezone=UTC
|
||||
--FILE--
|
||||
<?php
|
||||
for ($i=1 ; $i<999 ; $i++) {
|
||||
$datetime = Datetime::createFromFormat("u", sprintf("%06ld", $i));
|
||||
$res = $datetime->format("u");
|
||||
if ($res != $i) {
|
||||
echo "$i != $res\n";
|
||||
}
|
||||
}
|
||||
echo "Done";
|
||||
--EXPECT--
|
||||
Done
|
||||
+10
-16
@@ -4,22 +4,16 @@
|
||||
ARG_ENABLE("fileinfo", "fileinfo support", "no");
|
||||
|
||||
if (PHP_FILEINFO != 'no') {
|
||||
if (CHECK_HEADER_ADD_INCLUDE("dirent.h", "CFLAGS_FILEINFO") &&
|
||||
CHECK_LIB("dirent_a.lib", "fileinfo", PHP_FILEINFO)) {
|
||||
LIBMAGIC_SOURCES=" apprentice.c apptype.c ascmagic.c \
|
||||
cdf.c cdf_time.c compress.c \
|
||||
encoding.c fsmagic.c funcs.c \
|
||||
is_tar.c magic.c print.c \
|
||||
readcdf.c readelf.c softmagic.c";
|
||||
LIBMAGIC_SOURCES=" apprentice.c apptype.c ascmagic.c \
|
||||
cdf.c cdf_time.c compress.c \
|
||||
encoding.c fsmagic.c funcs.c \
|
||||
is_tar.c magic.c print.c \
|
||||
readcdf.c readelf.c softmagic.c";
|
||||
|
||||
if (VCVERS < 1500) {
|
||||
ADD_FLAG('CFLAGS', '/Zm1000');
|
||||
}
|
||||
if (VCVERS < 1500) {
|
||||
ADD_FLAG('CFLAGS', '/Zm1000');
|
||||
}
|
||||
|
||||
EXTENSION('fileinfo', 'fileinfo.c', true, "/I" + configure_module_dirname + "/libmagic /I" + configure_module_dirname);
|
||||
ADD_SOURCES(configure_module_dirname + '\\libmagic', LIBMAGIC_SOURCES, "fileinfo");
|
||||
} else {
|
||||
WARNING("fileinfo not enabled; libraries and headers not found");
|
||||
PHP_FILEINFO = "no";
|
||||
}
|
||||
EXTENSION('fileinfo', 'fileinfo.c', true, "/I" + configure_module_dirname + "/libmagic /I" + configure_module_dirname);
|
||||
ADD_SOURCES(configure_module_dirname + '\\libmagic', LIBMAGIC_SOURCES, "fileinfo");
|
||||
}
|
||||
+109
-83
@@ -1,6 +1,6 @@
|
||||
diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
--- libmagic.orig/apprentice.c 2012-10-19 11:07:28.000000000 +0800
|
||||
+++ libmagic/apprentice.c 2012-10-19 11:07:35.000000000 +0800
|
||||
--- libmagic.orig/apprentice.c Sat Dec 17 18:17:18 2011
|
||||
+++ libmagic/apprentice.c Tue Nov 27 16:25:57 2012
|
||||
@@ -29,6 +29,8 @@
|
||||
* apprentice - make one pass through /etc/magic, learning its secrets.
|
||||
*/
|
||||
@@ -10,7 +10,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
#include "file.h"
|
||||
|
||||
#ifndef lint
|
||||
@@ -36,18 +38,34 @@
|
||||
@@ -36,18 +38,31 @@
|
||||
#endif /* lint */
|
||||
|
||||
#include "magic.h"
|
||||
@@ -43,13 +43,11 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
-#ifdef QUICK
|
||||
-#include <sys/mman.h>
|
||||
-#endif
|
||||
+#ifndef PHP_WIN32
|
||||
#include <dirent.h>
|
||||
+#endif
|
||||
-#include <dirent.h>
|
||||
|
||||
#define EATAB {while (isascii((unsigned char) *l) && \
|
||||
isspace((unsigned char) *l)) ++l;}
|
||||
@@ -112,12 +130,10 @@
|
||||
@@ -112,12 +127,10 @@
|
||||
private int parse_strength(struct magic_set *, struct magic_entry *, const char *);
|
||||
private int parse_apple(struct magic_set *, struct magic_entry *, const char *);
|
||||
|
||||
@@ -62,7 +60,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
private struct {
|
||||
const char *name;
|
||||
size_t len;
|
||||
@@ -131,38 +147,7 @@
|
||||
@@ -131,38 +144,7 @@
|
||||
{ NULL, 0, NULL }
|
||||
};
|
||||
|
||||
@@ -102,7 +100,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
|
||||
static const struct type_tbl_s {
|
||||
const char name[16];
|
||||
@@ -218,6 +203,10 @@
|
||||
@@ -218,6 +200,10 @@
|
||||
# undef XX_NULL
|
||||
};
|
||||
|
||||
@@ -113,7 +111,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
private int
|
||||
get_type(const char *l, const char **t)
|
||||
{
|
||||
@@ -275,15 +264,17 @@
|
||||
@@ -275,15 +261,17 @@
|
||||
if (rv != 0)
|
||||
return -1;
|
||||
rv = apprentice_compile(ms, &magic, &nmagic, fn);
|
||||
@@ -136,7 +134,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
if (rv != 0)
|
||||
return -1;
|
||||
}
|
||||
@@ -295,11 +286,7 @@
|
||||
@@ -295,11 +283,7 @@
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -149,7 +147,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
|
||||
ml->magic = magic;
|
||||
ml->nmagic = nmagic;
|
||||
@@ -318,7 +305,6 @@
|
||||
@@ -318,7 +302,6 @@
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -157,7 +155,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
}
|
||||
|
||||
protected void
|
||||
@@ -327,22 +313,18 @@
|
||||
@@ -327,22 +310,18 @@
|
||||
if (p == NULL)
|
||||
return;
|
||||
switch (type) {
|
||||
@@ -186,7 +184,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
default:
|
||||
abort();
|
||||
}
|
||||
@@ -355,23 +337,27 @@
|
||||
@@ -355,23 +334,27 @@
|
||||
char *p, *mfn;
|
||||
int file_err, errs = -1;
|
||||
struct mlist *mlist;
|
||||
@@ -223,7 +221,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
mlist->next = mlist->prev = mlist;
|
||||
|
||||
while (fn) {
|
||||
@@ -385,13 +371,13 @@
|
||||
@@ -385,13 +368,13 @@
|
||||
fn = p;
|
||||
}
|
||||
if (errs == -1) {
|
||||
@@ -240,7 +238,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
return mlist;
|
||||
}
|
||||
|
||||
@@ -524,6 +510,7 @@
|
||||
@@ -524,6 +507,7 @@
|
||||
abort();
|
||||
}
|
||||
|
||||
@@ -248,7 +246,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
/*
|
||||
* Magic entries with no description get a bonus because they depend
|
||||
* on subsequent magic entries to print something.
|
||||
@@ -539,8 +526,8 @@
|
||||
@@ -539,8 +523,8 @@
|
||||
private int
|
||||
apprentice_sort(const void *a, const void *b)
|
||||
{
|
||||
@@ -259,7 +257,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
size_t sa = apprentice_magic_strength(ma->mp);
|
||||
size_t sb = apprentice_magic_strength(mb->mp);
|
||||
if (sa == sb)
|
||||
@@ -671,12 +658,22 @@
|
||||
@@ -671,12 +655,22 @@
|
||||
load_1(struct magic_set *ms, int action, const char *fn, int *errs,
|
||||
struct magic_entry **marray, uint32_t *marraycount)
|
||||
{
|
||||
@@ -286,7 +284,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
if (errno != ENOENT)
|
||||
file_error(ms, errno, "cannot read magic file `%s'",
|
||||
fn);
|
||||
@@ -684,9 +681,12 @@
|
||||
@@ -684,9 +678,12 @@
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -302,7 +300,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
if (len == 0) /* null line, garbage, etc */
|
||||
continue;
|
||||
if (line[len - 1] == '\n') {
|
||||
@@ -736,8 +736,7 @@
|
||||
@@ -736,8 +733,7 @@
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -312,7 +310,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -754,23 +753,19 @@
|
||||
@@ -754,23 +750,21 @@
|
||||
apprentice_load(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp,
|
||||
const char *fn, int action)
|
||||
{
|
||||
@@ -325,8 +323,12 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
+ size_t files = 0, maxfiles = 0;
|
||||
+ char **filearr = NULL, mfn[MAXPATHLEN];
|
||||
struct stat st;
|
||||
DIR *dir;
|
||||
struct dirent *d;
|
||||
- DIR *dir;
|
||||
- struct dirent *d;
|
||||
+ php_stream *dir;
|
||||
+ php_stream_dirent d;
|
||||
+
|
||||
+ TSRMLS_FETCH();
|
||||
|
||||
ms->flags |= MAGIC_CHECK; /* Enable checks for parsed files */
|
||||
|
||||
@@ -341,26 +343,33 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
marraycount = 0;
|
||||
|
||||
/* print silly verbose header for USG compat. */
|
||||
@@ -778,14 +773,16 @@
|
||||
@@ -778,22 +772,25 @@
|
||||
(void)fprintf(stderr, "%s\n", usg_hdr);
|
||||
|
||||
/* load directory or file */
|
||||
- if (stat(fn, &st) == 0 && S_ISDIR(st.st_mode)) {
|
||||
- dir = opendir(fn);
|
||||
+ /* FIXME: Read file names and sort them to prevent
|
||||
+ non-determinism. See Debian bug #488562. */
|
||||
+ if (php_sys_stat(fn, &st) == 0 && S_ISDIR(st.st_mode)) {
|
||||
dir = opendir(fn);
|
||||
+ int mflen;
|
||||
+ char mfn[MAXPATHLEN];
|
||||
+
|
||||
+ dir = php_stream_opendir(fn, REPORT_ERRORS, NULL);
|
||||
if (!dir) {
|
||||
errs++;
|
||||
goto out;
|
||||
}
|
||||
while ((d = readdir(dir)) != NULL) {
|
||||
- while ((d = readdir(dir)) != NULL) {
|
||||
- if (asprintf(&mfn, "%s/%s", fn, d->d_name) < 0) {
|
||||
+ if ((mflen = snprintf(mfn, sizeof(mfn), "%s/%s", fn, d->d_name)) < 0) {
|
||||
file_oomem(ms,
|
||||
strlen(fn) + strlen(d->d_name) + 2);
|
||||
- file_oomem(ms,
|
||||
- strlen(fn) + strlen(d->d_name) + 2);
|
||||
+ while (php_stream_readdir(dir, &d)) {
|
||||
+ if ((mflen = snprintf(mfn, sizeof(mfn), "%s/%s", fn, d.d_name)) < 0) {
|
||||
+ file_oomem(ms, strlen(fn) + strlen(d.d_name) + 2);
|
||||
errs++;
|
||||
@@ -793,7 +790,6 @@
|
||||
- closedir(dir);
|
||||
+ php_stream_closedir(dir);
|
||||
goto out;
|
||||
}
|
||||
if (stat(mfn, &st) == -1 || !S_ISREG(st.st_mode)) {
|
||||
@@ -368,12 +377,13 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
continue;
|
||||
}
|
||||
if (files >= maxfiles) {
|
||||
@@ -803,20 +799,19 @@
|
||||
@@ -803,20 +800,19 @@
|
||||
if ((filearr = CAST(char **,
|
||||
realloc(filearr, mlen))) == NULL) {
|
||||
file_oomem(ms, mlen);
|
||||
- free(mfn);
|
||||
closedir(dir);
|
||||
- closedir(dir);
|
||||
+ php_stream_closedir(dir);
|
||||
errs++;
|
||||
goto out;
|
||||
}
|
||||
@@ -381,7 +391,8 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
- filearr[files++] = mfn;
|
||||
+ filearr[files++] = estrndup(mfn, mflen);
|
||||
}
|
||||
closedir(dir);
|
||||
- closedir(dir);
|
||||
+ php_stream_closedir(dir);
|
||||
qsort(filearr, files, sizeof(*filearr), cmpstrp);
|
||||
for (i = 0; i < files; i++) {
|
||||
load_1(ms, action, filearr[i], &errs, &marray,
|
||||
@@ -391,7 +402,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
}
|
||||
free(filearr);
|
||||
} else
|
||||
@@ -882,12 +877,7 @@
|
||||
@@ -882,12 +878,7 @@
|
||||
for (i = 0; i < marraycount; i++)
|
||||
mentrycount += marray[i].cont_count;
|
||||
|
||||
@@ -405,7 +416,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
|
||||
mentrycount = 0;
|
||||
for (i = 0; i < marraycount; i++) {
|
||||
@@ -896,9 +886,14 @@
|
||||
@@ -896,9 +887,14 @@
|
||||
mentrycount += marray[i].cont_count;
|
||||
}
|
||||
out:
|
||||
@@ -423,7 +434,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
if (errs) {
|
||||
*magicp = NULL;
|
||||
*nmagicp = 0;
|
||||
@@ -1175,14 +1170,13 @@
|
||||
@@ -1175,14 +1171,13 @@
|
||||
return -1;
|
||||
}
|
||||
me = &(*mentryp)[*nmentryp - 1];
|
||||
@@ -442,7 +453,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
me->mp = m = nm;
|
||||
me->max_count = CAST(uint32_t, cnt);
|
||||
}
|
||||
@@ -1194,23 +1188,13 @@
|
||||
@@ -1194,23 +1189,13 @@
|
||||
struct magic_entry *mp;
|
||||
|
||||
maxmagic += ALLOC_INCR;
|
||||
@@ -469,7 +480,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
me->mp = m;
|
||||
me->max_count = ALLOC_CHUNK;
|
||||
} else
|
||||
@@ -1353,6 +1337,10 @@
|
||||
@@ -1353,6 +1338,10 @@
|
||||
if (m->type == FILE_INVALID) {
|
||||
if (ms->flags & MAGIC_CHECK)
|
||||
file_magwarn(ms, "type `%s' invalid", l);
|
||||
@@ -480,7 +491,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1361,7 +1349,7 @@
|
||||
@@ -1361,7 +1350,7 @@
|
||||
|
||||
m->mask_op = 0;
|
||||
if (*l == '~') {
|
||||
@@ -489,7 +500,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
m->mask_op |= FILE_OPINVERSE;
|
||||
else if (ms->flags & MAGIC_CHECK)
|
||||
file_magwarn(ms, "'~' invalid for string types");
|
||||
@@ -1370,7 +1358,7 @@
|
||||
@@ -1370,7 +1359,7 @@
|
||||
m->str_range = 0;
|
||||
m->str_flags = m->type == FILE_PSTRING ? PSTRING_1_LE : 0;
|
||||
if ((op = get_op(*l)) != -1) {
|
||||
@@ -498,7 +509,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
uint64_t val;
|
||||
++l;
|
||||
m->mask_op |= op;
|
||||
@@ -1558,11 +1546,6 @@
|
||||
@@ -1558,11 +1547,6 @@
|
||||
if (check_format(ms, m) == -1)
|
||||
return -1;
|
||||
}
|
||||
@@ -510,7 +521,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
m->mimetype[0] = '\0'; /* initialise MIME type to none */
|
||||
if (m->cont_level == 0)
|
||||
++(*nmentryp); /* make room for next */
|
||||
@@ -2195,56 +2178,69 @@
|
||||
@@ -2195,56 +2179,79 @@
|
||||
|
||||
/*
|
||||
* handle a compiled file.
|
||||
@@ -541,6 +552,16 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
+ ret = 3;
|
||||
+ goto internal_loaded;
|
||||
+ }
|
||||
+
|
||||
+#ifdef PHP_WIN32
|
||||
+ /* Don't bother on windows with php_stream_open_wrapper,
|
||||
+ return to give apprentice_load() a chance. */
|
||||
+ if (php_stream_stat_path_ex(fn, 0, &st, NULL) == SUCCESS) {
|
||||
+ if (st.sb.st_mode & S_IFDIR) {
|
||||
+ goto error2;
|
||||
+ }
|
||||
+ }
|
||||
+#endif
|
||||
|
||||
dbname = mkdbname(ms, fn, 0);
|
||||
if (dbname == NULL)
|
||||
@@ -603,7 +624,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
ptr = (uint32_t *)(void *)*magicp;
|
||||
if (*ptr != MAGICNO) {
|
||||
if (swap4(*ptr) != MAGICNO) {
|
||||
@@ -2259,35 +2255,55 @@
|
||||
@@ -2259,35 +2266,55 @@
|
||||
else
|
||||
version = ptr[1];
|
||||
if (version != VERSIONNO) {
|
||||
@@ -675,7 +696,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -2301,42 +2317,49 @@
|
||||
@@ -2301,42 +2328,49 @@
|
||||
apprentice_compile(struct magic_set *ms, struct magic **magicp,
|
||||
uint32_t *nmagicp, const char *fn)
|
||||
{
|
||||
@@ -736,7 +757,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -2349,6 +2372,7 @@
|
||||
@@ -2349,6 +2383,7 @@
|
||||
{
|
||||
const char *p, *q;
|
||||
char *buf;
|
||||
@@ -744,14 +765,18 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
|
||||
if (strip) {
|
||||
if ((p = strrchr(fn, '/')) != NULL)
|
||||
@@ -2370,14 +2394,14 @@
|
||||
@@ -2370,14 +2405,18 @@
|
||||
q++;
|
||||
/* Compatibility with old code that looked in .mime */
|
||||
if (ms->flags & MAGIC_MIME) {
|
||||
- asprintf(&buf, "%.*s.mime%s", (int)(q - fn), fn, ext);
|
||||
- if (access(buf, R_OK) != -1) {
|
||||
+ spprintf(&buf, MAXPATHLEN, "%.*s.mime%s", (int)(q - fn), fn, ext);
|
||||
+#ifdef PHP_WIN32
|
||||
+ if (VCWD_ACCESS(buf, R_OK) == 0) {
|
||||
+#else
|
||||
+ if (VCWD_ACCESS(buf, R_OK) != -1) {
|
||||
+#endif
|
||||
ms->flags &= MAGIC_MIME_TYPE;
|
||||
return buf;
|
||||
}
|
||||
@@ -763,7 +788,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
|
||||
/* Compatibility with old code that looked in .mime */
|
||||
if (strstr(p, ".mime") != NULL)
|
||||
@@ -2467,7 +2491,7 @@
|
||||
@@ -2467,7 +2506,7 @@
|
||||
m->offset = swap4((uint32_t)m->offset);
|
||||
m->in_offset = swap4((uint32_t)m->in_offset);
|
||||
m->lineno = swap4((uint32_t)m->lineno);
|
||||
@@ -773,8 +798,8 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
|
||||
m->str_flags = swap4(m->str_flags);
|
||||
}
|
||||
diff -u libmagic.orig/ascmagic.c libmagic/ascmagic.c
|
||||
--- libmagic.orig/ascmagic.c 2012-10-19 11:07:28.000000000 +0800
|
||||
+++ libmagic/ascmagic.c 2012-10-19 11:07:35.000000000 +0800
|
||||
--- libmagic.orig/ascmagic.c Sat Dec 17 18:17:18 2011
|
||||
+++ libmagic/ascmagic.c Tue Apr 10 09:46:33 2012
|
||||
@@ -139,10 +139,8 @@
|
||||
/* malloc size is a conservative overestimate; could be
|
||||
improved, or at least realloced after conversion. */
|
||||
@@ -799,8 +824,8 @@ diff -u libmagic.orig/ascmagic.c libmagic/ascmagic.c
|
||||
return rv;
|
||||
}
|
||||
diff -u libmagic.orig/cdf.c libmagic/cdf.c
|
||||
--- libmagic.orig/cdf.c 2012-10-19 11:07:28.000000000 +0800
|
||||
+++ libmagic/cdf.c 2012-10-19 11:07:35.000000000 +0800
|
||||
--- libmagic.orig/cdf.c Mon Feb 20 23:35:29 2012
|
||||
+++ libmagic/cdf.c Tue Apr 10 09:46:33 2012
|
||||
@@ -43,7 +43,17 @@
|
||||
#include <err.h>
|
||||
#endif
|
||||
@@ -863,8 +888,8 @@ diff -u libmagic.orig/cdf.c libmagic/cdf.c
|
||||
(void)fprintf(stderr, "timestamp %s\n", buf);
|
||||
} else {
|
||||
diff -u libmagic.orig/cdf.h libmagic/cdf.h
|
||||
--- libmagic.orig/cdf.h 2012-10-19 11:07:28.000000000 +0800
|
||||
+++ libmagic/cdf.h 2012-10-19 11:07:35.000000000 +0800
|
||||
--- libmagic.orig/cdf.h Fri Feb 17 06:28:31 2012
|
||||
+++ libmagic/cdf.h Tue Apr 10 09:46:34 2012
|
||||
@@ -35,7 +35,7 @@
|
||||
#ifndef _H_CDF_
|
||||
#define _H_CDF_
|
||||
@@ -901,8 +926,8 @@ diff -u libmagic.orig/cdf.h libmagic/cdf.h
|
||||
void cdf_swap_header(cdf_header_t *);
|
||||
void cdf_unpack_header(cdf_header_t *, char *);
|
||||
diff -u libmagic.orig/cdf_time.c libmagic/cdf_time.c
|
||||
--- libmagic.orig/cdf_time.c 2012-10-19 11:07:28.000000000 +0800
|
||||
+++ libmagic/cdf_time.c 2012-10-19 11:07:35.000000000 +0800
|
||||
--- libmagic.orig/cdf_time.c Tue Dec 13 14:48:41 2011
|
||||
+++ libmagic/cdf_time.c Tue Apr 10 09:46:34 2012
|
||||
@@ -96,7 +96,7 @@
|
||||
}
|
||||
|
||||
@@ -960,8 +985,8 @@ diff -u libmagic.orig/cdf_time.c libmagic/cdf_time.c
|
||||
static const char *ref = "Sat Apr 23 01:30:00 1977";
|
||||
char *p, *q;
|
||||
diff -u libmagic.orig/compress.c libmagic/compress.c
|
||||
--- libmagic.orig/compress.c 2012-10-19 11:07:28.000000000 +0800
|
||||
+++ libmagic/compress.c 2012-10-19 11:07:35.000000000 +0800
|
||||
--- libmagic.orig/compress.c Sat Dec 17 18:17:18 2011
|
||||
+++ libmagic/compress.c Tue Apr 10 09:46:34 2012
|
||||
@@ -32,6 +32,7 @@
|
||||
* uncompress(method, old, n, newch) - uncompress old into new,
|
||||
* using method, return sizeof new
|
||||
@@ -1123,8 +1148,8 @@ diff -u libmagic.orig/compress.c libmagic/compress.c
|
||||
-#endif
|
||||
+#endif /* if PHP_FILEINFO_UNCOMPRESS */
|
||||
diff -u libmagic.orig/file.h libmagic/file.h
|
||||
--- libmagic.orig/file.h 2012-10-19 11:07:28.000000000 +0800
|
||||
+++ libmagic/file.h 2012-10-19 11:07:35.000000000 +0800
|
||||
--- libmagic.orig/file.h Tue Sep 20 17:30:14 2011
|
||||
+++ libmagic/file.h Mon Apr 23 17:58:54 2012
|
||||
@@ -33,11 +33,9 @@
|
||||
#ifndef __file_h__
|
||||
#define __file_h__
|
||||
@@ -1282,22 +1307,24 @@ diff -u libmagic.orig/file.h libmagic/file.h
|
||||
size_t strlcat(char *dst, const char *src, size_t siz);
|
||||
#endif
|
||||
#ifndef HAVE_GETLINE
|
||||
@@ -500,4 +487,12 @@
|
||||
#define FILE_RCSID(id)
|
||||
@@ -498,6 +485,14 @@
|
||||
#endif
|
||||
|
||||
#else
|
||||
#define FILE_RCSID(id)
|
||||
+#endif
|
||||
+
|
||||
+#ifdef PHP_WIN32
|
||||
+#define FINFO_LSEEK_FUNC _lseek
|
||||
+#define FINFO_READ_FUNC _read
|
||||
+#else
|
||||
+#define FINFO_LSEEK_FUNC lseek
|
||||
+#define FINFO_READ_FUNC read
|
||||
+#endif
|
||||
+
|
||||
#endif
|
||||
|
||||
#endif /* __file_h__ */
|
||||
diff -u libmagic.orig/fsmagic.c libmagic/fsmagic.c
|
||||
--- libmagic.orig/fsmagic.c 2012-10-19 11:07:28.000000000 +0800
|
||||
+++ libmagic/fsmagic.c 2012-10-19 11:07:35.000000000 +0800
|
||||
--- libmagic.orig/fsmagic.c Tue Aug 23 10:57:10 2011
|
||||
+++ libmagic/fsmagic.c Tue Apr 10 09:46:34 2012
|
||||
@@ -59,27 +59,21 @@
|
||||
# define minor(dev) ((dev) & 0xff)
|
||||
#endif
|
||||
@@ -1508,10 +1535,10 @@ diff -u libmagic.orig/fsmagic.c libmagic/fsmagic.c
|
||||
-#else
|
||||
- if (file_printf(ms, "block special") == -1)
|
||||
- return -1;
|
||||
-#endif
|
||||
#endif
|
||||
- }
|
||||
- return 1;
|
||||
#endif
|
||||
-#endif
|
||||
- /* TODO add code to handle V7 MUX and Blit MUX files */
|
||||
+
|
||||
#ifdef S_IFIFO
|
||||
@@ -1621,8 +1648,8 @@ diff -u libmagic.orig/fsmagic.c libmagic/fsmagic.c
|
||||
|
||||
/*
|
||||
diff -u libmagic.orig/funcs.c libmagic/funcs.c
|
||||
--- libmagic.orig/funcs.c 2012-10-19 11:07:28.000000000 +0800
|
||||
+++ libmagic/funcs.c 2012-10-19 11:07:35.000000000 +0800
|
||||
--- libmagic.orig/funcs.c Sat Dec 17 18:17:18 2011
|
||||
+++ libmagic/funcs.c Mon Apr 23 17:58:54 2012
|
||||
@@ -41,52 +41,42 @@
|
||||
#if defined(HAVE_WCTYPE_H)
|
||||
#include <wctype.h>
|
||||
@@ -1916,10 +1943,9 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c
|
||||
+ return rep_cnt;
|
||||
}
|
||||
+
|
||||
Common subdirectories: libmagic.orig/.libs and libmagic/.libs
|
||||
diff -u libmagic.orig/magic.c libmagic/magic.c
|
||||
--- libmagic.orig/magic.c 2012-10-19 11:07:28.000000000 +0800
|
||||
+++ libmagic/magic.c 2012-10-19 11:07:35.000000000 +0800
|
||||
--- libmagic.orig/magic.c Thu May 26 03:27:59 2011
|
||||
+++ libmagic/magic.c Tue Apr 10 09:46:34 2012
|
||||
@@ -25,11 +25,6 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
@@ -2296,8 +2322,8 @@ diff -u libmagic.orig/magic.c libmagic/magic.c
|
||||
public const char *
|
||||
magic_error(struct magic_set *ms)
|
||||
diff -u libmagic.orig/magic.h libmagic/magic.h
|
||||
--- libmagic.orig/magic.h 2012-10-19 11:07:28.000000000 +0800
|
||||
+++ libmagic/magic.h 2012-10-19 11:07:35.000000000 +0800
|
||||
--- libmagic.orig/magic.h Sun Dec 18 15:54:43 2011
|
||||
+++ libmagic/magic.h Tue Apr 10 09:46:34 2012
|
||||
@@ -85,6 +85,7 @@
|
||||
|
||||
const char *magic_getpath(const char *, int);
|
||||
@@ -2315,8 +2341,8 @@ diff -u libmagic.orig/magic.h libmagic/magic.h
|
||||
int magic_errno(magic_t);
|
||||
|
||||
diff -u libmagic.orig/print.c libmagic/print.c
|
||||
--- libmagic.orig/print.c 2012-10-19 11:07:28.000000000 +0800
|
||||
+++ libmagic/print.c 2012-10-19 11:07:35.000000000 +0800
|
||||
--- libmagic.orig/print.c Tue Sep 20 17:28:09 2011
|
||||
+++ libmagic/print.c Tue Nov 27 16:24:35 2012
|
||||
@@ -29,6 +29,9 @@
|
||||
* print.c - debugging printout routines
|
||||
*/
|
||||
@@ -2510,8 +2536,8 @@ diff -u libmagic.orig/print.c libmagic/print.c
|
||||
|
||||
protected const char *
|
||||
diff -u libmagic.orig/readcdf.c libmagic/readcdf.c
|
||||
--- libmagic.orig/readcdf.c 2012-10-19 11:07:28.000000000 +0800
|
||||
+++ libmagic/readcdf.c 2012-10-19 11:07:35.000000000 +0800
|
||||
--- libmagic.orig/readcdf.c Mon Feb 20 21:04:58 2012
|
||||
+++ libmagic/readcdf.c Tue Apr 10 09:46:34 2012
|
||||
@@ -30,7 +30,11 @@
|
||||
#endif
|
||||
|
||||
@@ -2558,8 +2584,8 @@ diff -u libmagic.orig/readcdf.c libmagic/readcdf.c
|
||||
if ((ec = strchr(c, '\n')) != NULL)
|
||||
*ec = '\0';
|
||||
diff -u libmagic.orig/readelf.c libmagic/readelf.c
|
||||
--- libmagic.orig/readelf.c 2012-10-19 11:07:28.000000000 +0800
|
||||
+++ libmagic/readelf.c 2012-10-19 11:07:35.000000000 +0800
|
||||
--- libmagic.orig/readelf.c Tue Aug 23 10:57:10 2011
|
||||
+++ libmagic/readelf.c Tue Apr 10 09:46:34 2012
|
||||
@@ -49,7 +49,7 @@
|
||||
off_t, int *, int);
|
||||
private int doshn(struct magic_set *, int, int, int, off_t, int, size_t,
|
||||
@@ -2715,8 +2741,8 @@ diff -u libmagic.orig/readelf.c libmagic/readelf.c
|
||||
|
||||
if (fstat(fd, &st) == -1) {
|
||||
diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
|
||||
--- libmagic.orig/softmagic.c 2012-10-19 11:07:28.000000000 +0800
|
||||
+++ libmagic/softmagic.c 2012-10-19 11:07:35.000000000 +0800
|
||||
--- libmagic.orig/softmagic.c Sat Dec 17 18:17:18 2011
|
||||
+++ libmagic/softmagic.c Fri May 25 09:59:25 2012
|
||||
@@ -41,6 +41,11 @@
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
||||
@@ -63,9 +63,6 @@ FILE_RCSID("@(#)$File: apprentice.c,v 1.173 2011/12/08 12:38:24 rrt Exp $")
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
#include <fcntl.h>
|
||||
#ifndef PHP_WIN32
|
||||
#include <dirent.h>
|
||||
#endif
|
||||
|
||||
#define EATAB {while (isascii((unsigned char) *l) && \
|
||||
isspace((unsigned char) *l)) ++l;}
|
||||
@@ -759,8 +756,10 @@ apprentice_load(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp,
|
||||
size_t files = 0, maxfiles = 0;
|
||||
char **filearr = NULL, mfn[MAXPATHLEN];
|
||||
struct stat st;
|
||||
DIR *dir;
|
||||
struct dirent *d;
|
||||
php_stream *dir;
|
||||
php_stream_dirent d;
|
||||
|
||||
TSRMLS_FETCH();
|
||||
|
||||
ms->flags |= MAGIC_CHECK; /* Enable checks for parsed files */
|
||||
|
||||
@@ -776,17 +775,19 @@ apprentice_load(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp,
|
||||
/* FIXME: Read file names and sort them to prevent
|
||||
non-determinism. See Debian bug #488562. */
|
||||
if (php_sys_stat(fn, &st) == 0 && S_ISDIR(st.st_mode)) {
|
||||
dir = opendir(fn);
|
||||
int mflen;
|
||||
char mfn[MAXPATHLEN];
|
||||
|
||||
dir = php_stream_opendir(fn, REPORT_ERRORS, NULL);
|
||||
if (!dir) {
|
||||
errs++;
|
||||
goto out;
|
||||
}
|
||||
while ((d = readdir(dir)) != NULL) {
|
||||
if ((mflen = snprintf(mfn, sizeof(mfn), "%s/%s", fn, d->d_name)) < 0) {
|
||||
file_oomem(ms,
|
||||
strlen(fn) + strlen(d->d_name) + 2);
|
||||
while (php_stream_readdir(dir, &d)) {
|
||||
if ((mflen = snprintf(mfn, sizeof(mfn), "%s/%s", fn, d.d_name)) < 0) {
|
||||
file_oomem(ms, strlen(fn) + strlen(d.d_name) + 2);
|
||||
errs++;
|
||||
closedir(dir);
|
||||
php_stream_closedir(dir);
|
||||
goto out;
|
||||
}
|
||||
if (stat(mfn, &st) == -1 || !S_ISREG(st.st_mode)) {
|
||||
@@ -799,14 +800,14 @@ apprentice_load(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp,
|
||||
if ((filearr = CAST(char **,
|
||||
realloc(filearr, mlen))) == NULL) {
|
||||
file_oomem(ms, mlen);
|
||||
closedir(dir);
|
||||
php_stream_closedir(dir);
|
||||
errs++;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
filearr[files++] = estrndup(mfn, mflen);
|
||||
}
|
||||
closedir(dir);
|
||||
php_stream_closedir(dir);
|
||||
qsort(filearr, files, sizeof(*filearr), cmpstrp);
|
||||
for (i = 0; i < files; i++) {
|
||||
load_1(ms, action, filearr[i], &errs, &marray,
|
||||
@@ -2204,6 +2205,16 @@ apprentice_map(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp,
|
||||
goto internal_loaded;
|
||||
}
|
||||
|
||||
#ifdef PHP_WIN32
|
||||
/* Don't bother on windows with php_stream_open_wrapper,
|
||||
return to give apprentice_load() a chance. */
|
||||
if (php_stream_stat_path_ex(fn, 0, &st, NULL) == SUCCESS) {
|
||||
if (st.sb.st_mode & S_IFDIR) {
|
||||
goto error2;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
dbname = mkdbname(ms, fn, 0);
|
||||
if (dbname == NULL)
|
||||
goto error2;
|
||||
@@ -2395,7 +2406,11 @@ mkdbname(struct magic_set *ms, const char *fn, int strip)
|
||||
/* Compatibility with old code that looked in .mime */
|
||||
if (ms->flags & MAGIC_MIME) {
|
||||
spprintf(&buf, MAXPATHLEN, "%.*s.mime%s", (int)(q - fn), fn, ext);
|
||||
#ifdef PHP_WIN32
|
||||
if (VCWD_ACCESS(buf, R_OK) == 0) {
|
||||
#else
|
||||
if (VCWD_ACCESS(buf, R_OK) != -1) {
|
||||
#endif
|
||||
ms->flags &= MAGIC_MIME_TYPE;
|
||||
return buf;
|
||||
}
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
--TEST--
|
||||
Test finfo_file() function : regex rules
|
||||
--SKIPIF--
|
||||
<?php require_once(dirname(__FILE__) . '/skipif.inc');
|
||||
if (substr(PHP_OS, 0, 3) != 'WIN') {
|
||||
die('skip.. only for Windows');
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
/**
|
||||
* Works with the unix file command:
|
||||
* $ file -m magic resources/test.awk
|
||||
* resources/test.awk: awk script, ASCII text
|
||||
*/
|
||||
$magicFile = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'magic';
|
||||
$finfo = finfo_open( FILEINFO_MIME, $magicFile );
|
||||
|
||||
echo "*** Testing finfo_file() : regex rules ***\n";
|
||||
|
||||
// Calling finfo_file() with all possible arguments
|
||||
$file = __DIR__ . '/resources/test.awk';
|
||||
var_dump( finfo_file( $finfo, $file ) );
|
||||
var_dump( finfo_file( $finfo, $file, FILEINFO_CONTINUE ) );
|
||||
|
||||
// Windows uses libfileinfo 1.0.5-dev
|
||||
// this may be causing the slightly different output from the first
|
||||
// finfo_file() call
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing finfo_file() : regex rules ***
|
||||
string(10) "text/plain"
|
||||
string(22) "awk script, ASCII text"
|
||||
===DONE===
|
||||
@@ -2,9 +2,6 @@
|
||||
Test finfo_file() function : regex rules
|
||||
--SKIPIF--
|
||||
<?php require_once(dirname(__FILE__) . '/skipif.inc');
|
||||
if (substr(PHP_OS, 0, 3) == 'WIN') {
|
||||
die('skip.. only for Non Windows Systems');
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
--TEST--
|
||||
Test finfo_open() function : error functionality
|
||||
--SKIPIF--
|
||||
<?php require_once(dirname(__FILE__) . '/skipif.inc');
|
||||
if(substr(PHP_OS, 0, 3) != 'WIN' )
|
||||
die("skip Not Valid for Linux");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : resource finfo_open([int options [, string arg]])
|
||||
* Description: Create a new fileinfo resource.
|
||||
* Source code: ext/fileinfo/fileinfo.c
|
||||
* Alias to functions:
|
||||
*/
|
||||
|
||||
$magicFile = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'magic';
|
||||
|
||||
echo "*** Testing finfo_open() : error functionality ***\n";
|
||||
|
||||
var_dump( finfo_open( FILEINFO_MIME, 'foobarfile' ) );
|
||||
var_dump( finfo_open( array(), $magicFile ) );
|
||||
var_dump( finfo_open( FILEINFO_MIME, $magicFile, 'extraArg' ) );
|
||||
var_dump( finfo_open( PHP_INT_MAX - 1, $magicFile ) );
|
||||
var_dump( finfo_open( 'foobar' ) );
|
||||
|
||||
var_dump( new finfo('foobar') );
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECTF--
|
||||
*** Testing finfo_open() : error functionality ***
|
||||
bool(false)
|
||||
|
||||
Warning: finfo_open() expects parameter 1 to be long, array given in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: finfo_open() expects at most 2 parameters, 3 given in %s on line %d
|
||||
bool(false)
|
||||
resource(%d) of type (file_info)
|
||||
|
||||
Warning: finfo_open() expects parameter 1 to be long, %unicode_string_optional% given in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: finfo::finfo() expects parameter 1 to be long, %unicode_string_optional% given in %s on line %d
|
||||
NULL
|
||||
===DONE===
|
||||
@@ -2,9 +2,6 @@
|
||||
Test finfo_open() function : error functionality
|
||||
--SKIPIF--
|
||||
<?php require_once(dirname(__FILE__) . '/skipif.inc');
|
||||
if(substr(PHP_OS, 0, 3) == 'WIN' )
|
||||
die("skip Not Valid for Windows");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype : resource finfo_open([int options [, string arg]])
|
||||
|
||||
@@ -107,8 +107,10 @@
|
||||
if (len < 1) { \
|
||||
RETURN_VALIDATION_FAILED \
|
||||
} \
|
||||
while (p[len-1] == ' ' || p[len-1] == '\t' || p[len-1] == '\r' || p[len-1] == '\v' || p[len-1] == '\n') { \
|
||||
len--; \
|
||||
if (len > 0) { \
|
||||
while (p[len-1] == ' ' || p[len-1] == '\t' || p[len-1] == '\r' || p[len-1] == '\v' || p[len-1] == '\n') { \
|
||||
len--; \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1191,7 +1191,7 @@ static void php_imap_do_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
|
||||
if (zend_hash_index_find(Z_ARRVAL_PP(disabled_auth_method), i, (void **) &z_auth_method) == SUCCESS) {
|
||||
if (Z_TYPE_PP(z_auth_method) == IS_STRING) {
|
||||
if (Z_STRLEN_PP(z_auth_method) > 1) {
|
||||
mail_parameters (NIL, DISABLE_AUTHENTICATOR, (void *)Z_STRVAL_PP(disabled_auth_method));
|
||||
mail_parameters (NIL, DISABLE_AUTHENTICATOR, (void *)Z_STRVAL_PP(z_auth_method));
|
||||
}
|
||||
} else {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid argument, expect string or array of strings");
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
--TEST--
|
||||
imap_open() DISABLE_AUTHENTICATOR ignores array param
|
||||
--SKIPIF--
|
||||
<?php
|
||||
extension_loaded('imap') or die('skip imap extension not available in this build');
|
||||
|
||||
require_once(dirname(__FILE__).'/imap_include.inc');
|
||||
|
||||
$in = imap_open($default_mailbox, $username, $password, OP_HALFOPEN, 1);
|
||||
if (!$in) {
|
||||
die("skip could not connect to mailbox $default_mailbox");
|
||||
}
|
||||
$kerberos = false;
|
||||
if (is_array($errors = imap_errors())) {
|
||||
foreach ($errors as $err) {
|
||||
if (strstr($err, 'GSSAPI') || strstr($err, 'Kerberos')) {
|
||||
$kerberos = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!$kerberos) {
|
||||
die("skip need a GSSAPI/Kerberos aware server");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$tests = array(
|
||||
'Array' => array('DISABLE_AUTHENTICATOR' => array('GSSAPI','NTLM')),
|
||||
'String' => array('DISABLE_AUTHENTICATOR' => 'GSSAPI'),
|
||||
);
|
||||
require_once(dirname(__FILE__).'/imap_include.inc');
|
||||
foreach ($tests as $name => $testparams) {
|
||||
echo "Test for $name\n";
|
||||
$in = imap_open($default_mailbox, $username, $password, OP_HALFOPEN, 1, $testparams);
|
||||
if ($in) {
|
||||
if (is_array($errors = imap_errors())) {
|
||||
foreach ($errors as $err) {
|
||||
if (strstr($err, 'GSSAPI') || strstr($err, 'Kerberos')) {
|
||||
echo "$err\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
echo "Can't connect\n";
|
||||
}
|
||||
}
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Test for Array
|
||||
Test for String
|
||||
Done
|
||||
@@ -607,7 +607,7 @@ static int mysqlnd_zval_array_from_mysqlnd_array(MYSQLND **in_array, zval *out_a
|
||||
MYSQLND **p = in_array;
|
||||
HashTable *new_hash;
|
||||
zval **elem, **dest_elem;
|
||||
int ret = 0;
|
||||
int ret = 0, i = 0;
|
||||
|
||||
ALLOC_HASHTABLE(new_hash);
|
||||
zend_hash_init(new_hash, zend_hash_num_elements(Z_ARRVAL_P(out_array)), NULL, ZVAL_PTR_DTOR, 0);
|
||||
@@ -616,13 +616,19 @@ static int mysqlnd_zval_array_from_mysqlnd_array(MYSQLND **in_array, zval *out_a
|
||||
zend_hash_get_current_data(Z_ARRVAL_P(out_array), (void **) &elem) == SUCCESS;
|
||||
zend_hash_move_forward(Z_ARRVAL_P(out_array)))
|
||||
{
|
||||
i++;
|
||||
if (Z_TYPE_PP(elem) != IS_OBJECT || !instanceof_function(Z_OBJCE_PP(elem), mysqli_link_class_entry TSRMLS_CC)) {
|
||||
continue;
|
||||
}
|
||||
{
|
||||
MY_MYSQL *mysql;
|
||||
MYSQLI_RESOURCE *my_res;
|
||||
mysqli_object *intern = (mysqli_object *)zend_object_store_get_object(*elem TSRMLS_CC);
|
||||
mysql = (MY_MYSQL *) ((MYSQLI_RESOURCE *)intern->ptr)->ptr;
|
||||
if (!(my_res = (MYSQLI_RESOURCE *)intern->ptr)) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "[%d] Couldn't fetch %s", i, intern->zo.ce->name);
|
||||
continue;
|
||||
}
|
||||
mysql = (MY_MYSQL *) my_res->ptr;
|
||||
if (mysql->mysql == *p) {
|
||||
zend_hash_next_index_insert(new_hash, (void *)elem, sizeof(zval *), (void **)&dest_elem);
|
||||
if (dest_elem) {
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
--TEST--
|
||||
Bug #63398 (Segfault when polling closed link)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
require_once("connect.inc");
|
||||
if (!$IS_MYSQLND) {
|
||||
die("skip mysqlnd only test");
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$link = new mysqli('localhost', 'test', NULL, 'test');
|
||||
|
||||
mysqli_close($link);
|
||||
|
||||
$read = $error = $reject = array();
|
||||
$read[] = $error[] = $reject[] = $link;
|
||||
|
||||
mysqli_poll($read, $error, $reject, 1);
|
||||
|
||||
echo "okey";
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: mysqli_poll(): [1] Couldn't fetch mysqli in %sbug63398.php on line %d
|
||||
|
||||
Warning: mysqli_poll(): [1] Couldn't fetch mysqli in %sbug63398.php on line %d
|
||||
|
||||
Warning: mysqli_poll(): No stream arrays were passed in %sbug63398.php on line %d
|
||||
|
||||
Warning: mysqli_poll(): [1] Couldn't fetch mysqli in %sbug63398.php on line %d
|
||||
|
||||
Warning: mysqli_poll(): [1] Couldn't fetch mysqli in %sbug63398.php on line %d
|
||||
okey
|
||||
@@ -9,6 +9,9 @@ if (!in_array('SHA-256', $arr)) die("skip hash extension loaded shared"); ?>
|
||||
--INI--
|
||||
phar.require_hash=0
|
||||
phar.readonly=0
|
||||
--ENV--
|
||||
TEMP=.
|
||||
TMP=.
|
||||
--FILE--
|
||||
<?php
|
||||
$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.tar';
|
||||
|
||||
@@ -1733,7 +1733,7 @@ ZEND_METHOD(reflection_function, getStaticVariables)
|
||||
/* Return an empty array in case no static variables exist */
|
||||
array_init(return_value);
|
||||
if (fptr->type == ZEND_USER_FUNCTION && fptr->op_array.static_variables != NULL) {
|
||||
zend_hash_apply_with_argument(fptr->op_array.static_variables, (apply_func_arg_t) zval_update_constant, (void*)1 TSRMLS_CC);
|
||||
zend_hash_apply_with_argument(fptr->op_array.static_variables, (apply_func_arg_t) zval_update_constant_inline_change, fptr->common.scope TSRMLS_CC);
|
||||
zend_hash_copy(Z_ARRVAL_P(return_value), fptr->op_array.static_variables, (copy_ctor_func_t) zval_add_ref, (void *) &tmp_copy, sizeof(zval *));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
--TEST--
|
||||
Bug #63614 (Fatal error on Reflection)
|
||||
--FILE--
|
||||
<?php
|
||||
function dummy() {
|
||||
static $a = array();
|
||||
}
|
||||
|
||||
class Test
|
||||
{
|
||||
const A = 0;
|
||||
|
||||
public function func()
|
||||
{
|
||||
static $a = array(
|
||||
self::A => 'a'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$reflect = new ReflectionFunction("dummy");
|
||||
print_r($reflect->getStaticVariables());
|
||||
$reflect = new ReflectionMethod('Test', 'func');
|
||||
print_r($reflect->getStaticVariables());
|
||||
?>
|
||||
--EXPECT--
|
||||
Array
|
||||
(
|
||||
[a] => Array
|
||||
(
|
||||
)
|
||||
|
||||
)
|
||||
Array
|
||||
(
|
||||
[a] => Array
|
||||
(
|
||||
[0] => a
|
||||
)
|
||||
|
||||
)
|
||||
+3
-21
@@ -552,19 +552,6 @@ ZEND_GET_MODULE(soap)
|
||||
# define OnUpdateLong OnUpdateInt
|
||||
#endif
|
||||
|
||||
ZEND_INI_MH(OnUpdateCacheEnabled)
|
||||
{
|
||||
if (OnUpdateBool(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC) == FAILURE) {
|
||||
return FAILURE;
|
||||
}
|
||||
if (SOAP_GLOBAL(cache_enabled)) {
|
||||
SOAP_GLOBAL(cache) = SOAP_GLOBAL(cache_mode);
|
||||
} else {
|
||||
SOAP_GLOBAL(cache) = 0;
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
ZEND_INI_MH(OnUpdateCacheMode)
|
||||
{
|
||||
char *p;
|
||||
@@ -578,16 +565,11 @@ ZEND_INI_MH(OnUpdateCacheMode)
|
||||
|
||||
*p = (char)atoi(new_value);
|
||||
|
||||
if (SOAP_GLOBAL(cache_enabled)) {
|
||||
SOAP_GLOBAL(cache) = SOAP_GLOBAL(cache_mode);
|
||||
} else {
|
||||
SOAP_GLOBAL(cache) = 0;
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
PHP_INI_BEGIN()
|
||||
STD_PHP_INI_ENTRY("soap.wsdl_cache_enabled", "1", PHP_INI_ALL, OnUpdateCacheEnabled,
|
||||
STD_PHP_INI_ENTRY("soap.wsdl_cache_enabled", "1", PHP_INI_ALL, OnUpdateBool,
|
||||
cache_enabled, zend_soap_globals, soap_globals)
|
||||
STD_PHP_INI_ENTRY("soap.wsdl_cache_dir", "/tmp", PHP_INI_ALL, OnUpdateString,
|
||||
cache_dir, zend_soap_globals, soap_globals)
|
||||
@@ -1220,7 +1202,7 @@ PHP_METHOD(SoapServer, SoapServer)
|
||||
memset(service, 0, sizeof(soapService));
|
||||
service->send_errors = 1;
|
||||
|
||||
cache_wsdl = SOAP_GLOBAL(cache);
|
||||
cache_wsdl = SOAP_GLOBAL(cache_enabled) ? SOAP_GLOBAL(cache_mode) : 0;
|
||||
|
||||
if (options != NULL) {
|
||||
HashTable *ht = Z_ARRVAL_P(options);
|
||||
@@ -2512,7 +2494,7 @@ PHP_METHOD(SoapClient, SoapClient)
|
||||
php_error_docref(NULL TSRMLS_CC, E_ERROR, "$wsdl must be string or null");
|
||||
}
|
||||
|
||||
cache_wsdl = SOAP_GLOBAL(cache);
|
||||
cache_wsdl = SOAP_GLOBAL(cache_enabled) ? SOAP_GLOBAL(cache_mode) : 0;
|
||||
|
||||
if (options != NULL) {
|
||||
HashTable *ht = Z_ARRVAL_P(options);
|
||||
|
||||
@@ -15,7 +15,7 @@ $ini = parse_ini_string("ini=\r\niniraw", null, INI_SCANNER_RAW);
|
||||
var_dump($ini['ini']);
|
||||
--EXPECTF--
|
||||
string(7) "ini;raw"
|
||||
string(8) ""ini;raw"
|
||||
string(4) ""ini"
|
||||
string(3) "ini"
|
||||
string(7) "ini"raw"
|
||||
string(0) ""
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
--TEST--
|
||||
Fixed bug #63512 (parse_ini_file() with INI_SCANNER_RAW removes quotes from value).
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$array = parse_ini_string('
|
||||
int = 123
|
||||
constant = INSTALL_ROOT
|
||||
quotedString = "string"
|
||||
a = INSTALL_ROOT "waa"
|
||||
b = "INSTALL_ROOT"
|
||||
c = "waa" INSTALL_ROOT
|
||||
d = INSTALL_ROOT "INSTALL_ROOT"', false, INI_SCANNER_RAW);
|
||||
|
||||
var_dump($array);
|
||||
--EXPECTF--
|
||||
array(7) {
|
||||
["int"]=>
|
||||
string(3) "123"
|
||||
["constant"]=>
|
||||
string(12) "INSTALL_ROOT"
|
||||
["quotedString"]=>
|
||||
string(6) "string"
|
||||
["a"]=>
|
||||
string(18) "INSTALL_ROOT "waa""
|
||||
["b"]=>
|
||||
string(12) "INSTALL_ROOT"
|
||||
["c"]=>
|
||||
string(18) ""waa" INSTALL_ROOT"
|
||||
["d"]=>
|
||||
string(27) "INSTALL_ROOT "INSTALL_ROOT""
|
||||
}
|
||||
|
||||
@@ -2,6 +2,11 @@
|
||||
Test lstat() and stat() functions: usage variations - invalid filenames
|
||||
--CREDITS--
|
||||
Dave Kelsey <d_kelsey@uk.ibm.com>
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (substr(PHP_OS, 0, 3) == 'WIN') {
|
||||
die('skip ... not for Windows');
|
||||
}
|
||||
--FILE--
|
||||
<?php
|
||||
/* Prototype: array lstat ( string $filename );
|
||||
@@ -46,4 +51,4 @@ bool(false)
|
||||
|
||||
Warning: lstat(): Lstat failed for | in %s on line %d
|
||||
bool(false)
|
||||
Done
|
||||
Done
|
||||
+1
-1
@@ -607,7 +607,7 @@ PHPAPI int php_ob_handler_used(char *handler_name TSRMLS_DC)
|
||||
static inline void php_ob_append(const char *text, uint text_length TSRMLS_DC)
|
||||
{
|
||||
char *target;
|
||||
int original_ob_text_length;
|
||||
uint original_ob_text_length;
|
||||
|
||||
original_ob_text_length=OG(active_ob_buffer).text_length;
|
||||
|
||||
|
||||
+4
-4
@@ -2,7 +2,7 @@
|
||||
/* edit configure.in to change version number */
|
||||
#define PHP_MAJOR_VERSION 5
|
||||
#define PHP_MINOR_VERSION 3
|
||||
#define PHP_RELEASE_VERSION 19
|
||||
#define PHP_EXTRA_VERSION "-dev"
|
||||
#define PHP_VERSION "5.3.19-dev"
|
||||
#define PHP_VERSION_ID 50319
|
||||
#define PHP_RELEASE_VERSION 20
|
||||
#define PHP_EXTRA_VERSION ""
|
||||
#define PHP_VERSION "5.3.20"
|
||||
#define PHP_VERSION_ID 50320
|
||||
@@ -37,3 +37,22 @@ if (PHP_APACHE2_2HANDLER != "no") {
|
||||
WARNING("Could not find apache2.2 libraries/headers");
|
||||
}
|
||||
}
|
||||
|
||||
ARG_ENABLE('apache2-4handler', 'Build Apache 2.4.x handler', 'no');
|
||||
if (PHP_APACHE2_4HANDLER != "no") {
|
||||
if (PHP_ZTS == "no") {
|
||||
WARNING("Apache 2.4 module requires an --enable-zts build of PHP on windows");
|
||||
} else if (CHECK_HEADER_ADD_INCLUDE("httpd.h", "CFLAGS_APACHE2_4HANDLER", PHP_PHP_BUILD + "\\include\\apache2_4") &&
|
||||
CHECK_LIB("libhttpd.lib", "apache2_4handler", PHP_PHP_BUILD + "\\lib\\apache2_4") &&
|
||||
CHECK_LIB("libapr-1.lib", "apache2_4handler", PHP_PHP_BUILD + "\\lib\\apache2_4") &&
|
||||
CHECK_LIB("libaprutil-1.lib", "apache2_4handler", PHP_PHP_BUILD + "\\lib\\apache2_4")
|
||||
) {
|
||||
SAPI('apache2_4handler', 'mod_php5.c sapi_apache2.c apache_config.c php_functions.c',
|
||||
'php' + PHP_VERSION + 'apache2_4.dll',
|
||||
'/D PHP_APACHE2_EXPORTS /I win32',
|
||||
'sapi\\apache2handler');
|
||||
} else {
|
||||
WARNING("Could not find apache 2.4 libraries/headers");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -188,7 +188,9 @@ static int fpm_event_queue_del(struct fpm_event_queue_s **queue, struct fpm_even
|
||||
}
|
||||
if (q == *queue) {
|
||||
*queue = q->next;
|
||||
(*queue)->prev = NULL;
|
||||
if (*queue) {
|
||||
(*queue)->prev = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* ask the event module to remove the fd from its own queue */
|
||||
@@ -432,7 +434,9 @@ void fpm_event_loop(int err) /* {{{ */
|
||||
}
|
||||
if (q == fpm_event_queue_timer) {
|
||||
fpm_event_queue_timer = q->next;
|
||||
fpm_event_queue_timer->prev = NULL;
|
||||
if (fpm_event_queue_timer) {
|
||||
fpm_event_queue_timer->prev = NULL;
|
||||
}
|
||||
}
|
||||
q = q->next;
|
||||
free(q2);
|
||||
|
||||
@@ -96,7 +96,7 @@ int fpm_log_init_child(struct fpm_worker_pool_s *wp) /* {{{ */
|
||||
int fpm_log_write(char *log_format TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
char *s, *b;
|
||||
char buffer[FPM_LOG_BUFFER];
|
||||
char buffer[FPM_LOG_BUFFER+1];
|
||||
int token, test;
|
||||
size_t len, len2;
|
||||
struct fpm_scoreboard_proc_s proc, *proc_p;
|
||||
@@ -146,9 +146,10 @@ int fpm_log_write(char *log_format TSRMLS_DC) /* {{{ */
|
||||
s = log_format;
|
||||
|
||||
while (*s != '\0') {
|
||||
if (len > FPM_LOG_BUFFER) {
|
||||
/* Test is we have place for 1 more char. */
|
||||
if (len >= FPM_LOG_BUFFER) {
|
||||
zlog(ZLOG_NOTICE, "the log buffer is full (%d). The access log request has been truncated.", FPM_LOG_BUFFER);
|
||||
len = FPM_LOG_BUFFER - 1;
|
||||
len = FPM_LOG_BUFFER;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,10 @@ Bug #12647 (Locale settings affecting float parsing)
|
||||
precision=14
|
||||
--SKIPIF--
|
||||
<?php # try to activate a german locale
|
||||
if (substr(PHP_OS, 0, 3) == 'WIN') {
|
||||
/* skip on windows until #63688 was fixed */
|
||||
die('skip');
|
||||
}
|
||||
if (setlocale(LC_NUMERIC, "de_DE.UTF-8", "de_DE", "de", "german", "ge", "de_DE.ISO-8859-1") === FALSE) {
|
||||
print "skip Can't find german locale";
|
||||
}
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
Bug #30638 (localeconv returns wrong LC_NUMERIC settings) (ok to fail on MacOS X)
|
||||
--SKIPIF--
|
||||
<?php # try to activate a german locale
|
||||
if (substr(PHP_OS, 0, 3) == 'WIN') {
|
||||
/* skip on windows until #63688 was fixed */
|
||||
die('skip');
|
||||
}
|
||||
if (setlocale(LC_NUMERIC, "de_DE.UTF-8", "de_DE", "de", "german", "ge", "de_DE.ISO-8859-1") === FALSE) {
|
||||
print "skip setlocale() failed";
|
||||
} elseif (strtolower(php_uname('s')) == 'darwin') {
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
--TEST--
|
||||
Bug #63377 (Segfault on output buffer > 2GB)
|
||||
--SKIPF--
|
||||
<?php
|
||||
$zend_mm_enabled = getenv("USE_ZEND_ALLOC");
|
||||
if ($zend_mm_enabled === "0") {
|
||||
die("skip Zend MM disabled");
|
||||
}
|
||||
|
||||
if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
|
||||
// check the available memory
|
||||
if (PHP_OS == 'Linux') {
|
||||
$lines = file('/proc/meminfo');
|
||||
$infos = array();
|
||||
foreach ($lines as $line) {
|
||||
$tmp = explode(":", $line);
|
||||
$index = strtolower($tmp[0]);
|
||||
$value = (int)ltrim($tmp[1], " ")*1024;
|
||||
$infos[$index] = $value;
|
||||
}
|
||||
$freeMemory = $infos['memfree']+$infos['buffers']+$infos['cached'];
|
||||
if ($freeMemory < 2100*1024*1024) {
|
||||
die('skip Not enough memory.');
|
||||
}
|
||||
}
|
||||
elseif (PHP_OS == 'FreeBSD') {
|
||||
$lines = explode("\n",`sysctl -a`);
|
||||
$infos = array();
|
||||
foreach ($lines as $line) {
|
||||
if(!$line){
|
||||
continue;
|
||||
}
|
||||
$tmp = explode(":", $line);
|
||||
$index = strtolower($tmp[0]);
|
||||
$value = trim($tmp[1], " ");
|
||||
$infos[$index] = $value;
|
||||
}
|
||||
$freeMemory = ($infos['vm.stats.vm.v_inactive_count']*$infos['hw.pagesize'])
|
||||
+($infos['vm.stats.vm.v_cache_count']*$infos['hw.pagesize'])
|
||||
+($infos['vm.stats.vm.v_free_count']*$infos['hw.pagesize']);
|
||||
if ($freeMemory < 2100*1024*1024) {
|
||||
die('skip Not enough memory.');
|
||||
}
|
||||
}
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
ini_set('memory_limit', '3072M');
|
||||
|
||||
ob_start();
|
||||
for ($i = 0; $i < 22; $i++) {
|
||||
echo str_repeat('a', 100 * 1024 * 1024);
|
||||
}
|
||||
ob_end_clean();
|
||||
echo "okey";
|
||||
?>
|
||||
--EXPECTF--
|
||||
okey
|
||||
@@ -5,6 +5,9 @@ openbase_dir runtime tightning
|
||||
if (substr(PHP_OS, 0, 3) == 'WIN') {
|
||||
die('skip.. only for unix');
|
||||
}
|
||||
if (!is_dir("/usr/local/bin")) {
|
||||
die('skip.. no /usr/local/bin on this machine');
|
||||
}
|
||||
--INI--
|
||||
open_basedir=/usr/local
|
||||
--FILE--
|
||||
|
||||
Reference in new issue
Block a user