1
0
mirror of https://github.com/php/php-src.git synced 2026-04-22 07:28:09 +02:00

Merge branch 'PHP-5.3' of git.php.net:php-src into PHP-5.3

* 'PHP-5.3' of git.php.net:php-src:
  Fixed bug #63590 Fileinfo delivers ifferent results in TS and NTS under Windows
  This test isn't supposed to pass on windows
  Fixed Bug #63614 (Fatal error on Reflection)
This commit is contained in:
Remi Collet
2012-11-28 10:24:32 +01:00
10 changed files with 84 additions and 109 deletions
+9
View File
@@ -7,17 +7,26 @@ PHP NEWS
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)
- Apache2 Handler SAPI:
. Enabled Apache 2.4 configure option for Windows (Pierre, Anatoliy)
- 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)
- Imap:
. Fixed Bug #63126 DISABLE_AUTHENTICATOR ignores array (Remi)
- Reflection:
. Fixed Bug #63614 (Fatal error on Reflection). (Laruence)
22 Nov 2012, PHP 5.3.19
+23 -19
View File
@@ -1,6 +1,6 @@
diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
--- libmagic.orig/apprentice.c Sat Dec 17 18:17:18 2011
+++ libmagic/apprentice.c Fri Nov 23 13:04:15 2012
+++ libmagic/apprentice.c Tue Nov 27 16:25:57 2012
@@ -29,6 +29,8 @@
* apprentice - make one pass through /etc/magic, learning its secrets.
*/
@@ -267,11 +267,11 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
- ssize_t len;
+ size_t len;
+ size_t lineno = 0;
+
+ php_stream *stream;
- FILE *f = fopen(ms->file = fn, "r");
- if (f == NULL) {
+ php_stream *stream;
+
+ TSRMLS_FETCH();
+
+#if PHP_API_VERSION < 20100412
@@ -765,14 +765,18 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
if (strip) {
if ((p = strrchr(fn, '/')) != NULL)
@@ -2370,14 +2405,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;
}
@@ -784,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 +2502,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);
@@ -795,7 +799,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
}
diff -u libmagic.orig/ascmagic.c libmagic/ascmagic.c
--- libmagic.orig/ascmagic.c Sat Dec 17 18:17:18 2011
+++ libmagic/ascmagic.c Wed Mar 28 15:35:25 2012
+++ 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. */
@@ -821,7 +825,7 @@ diff -u libmagic.orig/ascmagic.c libmagic/ascmagic.c
}
diff -u libmagic.orig/cdf.c libmagic/cdf.c
--- libmagic.orig/cdf.c Mon Feb 20 23:35:29 2012
+++ libmagic/cdf.c Mon Apr 2 17:43:23 2012
+++ libmagic/cdf.c Tue Apr 10 09:46:33 2012
@@ -43,7 +43,17 @@
#include <err.h>
#endif
@@ -885,7 +889,7 @@ diff -u libmagic.orig/cdf.c libmagic/cdf.c
} else {
diff -u libmagic.orig/cdf.h libmagic/cdf.h
--- libmagic.orig/cdf.h Fri Feb 17 06:28:31 2012
+++ libmagic/cdf.h Wed Mar 28 15:35:25 2012
+++ libmagic/cdf.h Tue Apr 10 09:46:34 2012
@@ -35,7 +35,7 @@
#ifndef _H_CDF_
#define _H_CDF_
@@ -923,7 +927,7 @@ diff -u libmagic.orig/cdf.h libmagic/cdf.h
void cdf_unpack_header(cdf_header_t *, char *);
diff -u libmagic.orig/cdf_time.c libmagic/cdf_time.c
--- libmagic.orig/cdf_time.c Tue Dec 13 14:48:41 2011
+++ libmagic/cdf_time.c Wed Mar 28 15:35:25 2012
+++ libmagic/cdf_time.c Tue Apr 10 09:46:34 2012
@@ -96,7 +96,7 @@
}
@@ -982,7 +986,7 @@ diff -u libmagic.orig/cdf_time.c libmagic/cdf_time.c
char *p, *q;
diff -u libmagic.orig/compress.c libmagic/compress.c
--- libmagic.orig/compress.c Sat Dec 17 18:17:18 2011
+++ libmagic/compress.c Mon Apr 2 17:43:23 2012
+++ 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
@@ -1145,7 +1149,7 @@ diff -u libmagic.orig/compress.c libmagic/compress.c
+#endif /* if PHP_FILEINFO_UNCOMPRESS */
diff -u libmagic.orig/file.h libmagic/file.h
--- libmagic.orig/file.h Tue Sep 20 17:30:14 2011
+++ libmagic/file.h Sun Apr 22 20:06:21 2012
+++ libmagic/file.h Mon Apr 23 17:58:54 2012
@@ -33,11 +33,9 @@
#ifndef __file_h__
#define __file_h__
@@ -1320,7 +1324,7 @@ diff -u libmagic.orig/file.h libmagic/file.h
#endif /* __file_h__ */
diff -u libmagic.orig/fsmagic.c libmagic/fsmagic.c
--- libmagic.orig/fsmagic.c Tue Aug 23 10:57:10 2011
+++ libmagic/fsmagic.c Wed Mar 28 15:35:26 2012
+++ libmagic/fsmagic.c Tue Apr 10 09:46:34 2012
@@ -59,27 +59,21 @@
# define minor(dev) ((dev) & 0xff)
#endif
@@ -1645,7 +1649,7 @@ diff -u libmagic.orig/fsmagic.c libmagic/fsmagic.c
/*
diff -u libmagic.orig/funcs.c libmagic/funcs.c
--- libmagic.orig/funcs.c Sat Dec 17 18:17:18 2011
+++ libmagic/funcs.c Sun Apr 22 20:06:21 2012
+++ libmagic/funcs.c Mon Apr 23 17:58:54 2012
@@ -41,52 +41,42 @@
#if defined(HAVE_WCTYPE_H)
#include <wctype.h>
@@ -1941,7 +1945,7 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c
+
diff -u libmagic.orig/magic.c libmagic/magic.c
--- libmagic.orig/magic.c Thu May 26 03:27:59 2011
+++ libmagic/magic.c Mon Apr 2 12:38:04 2012
+++ libmagic/magic.c Tue Apr 10 09:46:34 2012
@@ -25,11 +25,6 @@
* SUCH DAMAGE.
*/
@@ -2319,7 +2323,7 @@ diff -u libmagic.orig/magic.c libmagic/magic.c
magic_error(struct magic_set *ms)
diff -u libmagic.orig/magic.h libmagic/magic.h
--- libmagic.orig/magic.h Sun Dec 18 15:54:43 2011
+++ libmagic/magic.h Wed Mar 28 15:35:26 2012
+++ libmagic/magic.h Tue Apr 10 09:46:34 2012
@@ -85,6 +85,7 @@
const char *magic_getpath(const char *, int);
@@ -2338,7 +2342,7 @@ diff -u libmagic.orig/magic.h libmagic/magic.h
diff -u libmagic.orig/print.c libmagic/print.c
--- libmagic.orig/print.c Tue Sep 20 17:28:09 2011
+++ libmagic/print.c Thu Apr 5 10:22:12 2012
+++ libmagic/print.c Tue Nov 27 16:24:35 2012
@@ -29,6 +29,9 @@
* print.c - debugging printout routines
*/
@@ -2533,7 +2537,7 @@ 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 Mon Feb 20 21:04:58 2012
+++ libmagic/readcdf.c Wed Mar 28 15:35:26 2012
+++ libmagic/readcdf.c Tue Apr 10 09:46:34 2012
@@ -30,7 +30,11 @@
#endif
@@ -2581,7 +2585,7 @@ diff -u libmagic.orig/readcdf.c libmagic/readcdf.c
*ec = '\0';
diff -u libmagic.orig/readelf.c libmagic/readelf.c
--- libmagic.orig/readelf.c Tue Aug 23 10:57:10 2011
+++ libmagic/readelf.c Mon Apr 2 17:43:23 2012
+++ 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,
@@ -2738,7 +2742,7 @@ 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 Sat Dec 17 18:17:18 2011
+++ libmagic/softmagic.c Fri May 25 09:48:22 2012
+++ libmagic/softmagic.c Fri May 25 09:59:25 2012
@@ -41,6 +41,11 @@
#include <stdlib.h>
#include <time.h>
+4
View File
@@ -2406,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===
-3
View File
@@ -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===
-3
View File
@@ -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]])
+1 -1
View File
@@ -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 *));
}
}
+41
View File
@@ -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
)
)
@@ -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