Compare commits

..
Author SHA1 Message Date
Stanislav Malyshev e961c76a0b 5.4.4 2012-06-12 21:54:23 -07:00
Stanislav Malyshev d939ce5d1b merge NEWS, add #61755 2012-06-12 11:59:02 -07:00
Stanislav Malyshev 4c3575fa02 merge NEWS entries 2012-06-06 23:25:40 -07:00
Stanislav Malyshev 10d2b26a76 fix test 2012-05-29 23:52:07 -07:00
Stanislav Malyshev e6bdd5bad4 fix test 2012-05-29 23:42:37 -07:00
Stanislav Malyshev 85585b2ebb 5.4.4 rc2 2012-05-29 23:18:57 -07:00
Stanislav Malyshev bc1c1beea5 fix CVE-2012-2143 2012-05-29 23:15:10 -07:00
Stanislav Malyshev 460f932ea9 add CVE 2012-05-28 18:59:31 -07:00
Stanislav Malyshev 523bf03cd8 fix unchecked emalloc 2012-05-28 18:59:10 -07:00
Stanislav Malyshev 9b3358599f update NEWS 2012-05-28 18:17:21 -07:00
Johannes Schlüter bb963a5f50 Fix bug #62146 com_dotnet cannot be built shared, tested by Anatoliy 2012-05-28 17:39:39 -07:00
Gustavo André dos Santos Lopes 78ff9ebb6b Fixed bug #62097
This fixes the fix for bug #54547 in 32-bit machines by accepting
float comparisons in 32-bit machines as long as the integer is
not larger than the mantissa.
2012-05-23 19:00:27 -05:00
Stanislav Malyshev 9ab21b15af update NEWS 2012-05-23 18:50:06 -05:00
Xinchen Hui 1a90173f27 Revert "Implemented FR #61602 Allow access to name of constant used as default value"
This reverts commit 054f3e3ce5.

See: http://news.php.net/php.cvs/69137 and the author confirmed.
Will commit later after the author fixed this then make a new PR.

Conflicts:

	ext/reflection/php_reflection.c
2012-05-23 18:48:49 -05:00
Xinchen Hui b233c19579 Fix typo while resolving conflicts 2012-05-23 18:45:21 -05:00
Xinchen Hui 0eb02b874d Revert "Implemented FR #61602 Allow access to name of constant used as default value"
This reverts commit 054f3e3ce5.

See: http://news.php.net/php.cvs/69137 and the author confirmed.
Will commit later after the author fixed this then make a new PR.

Conflicts:

	ext/reflection/php_reflection.c
2012-05-23 18:45:03 -05:00
Gustavo André dos Santos Lopes b595b775f7 Fixed bug #62082
This was a buffer overflow in internal function
get_icu_disp_value_src_php().
2012-05-23 18:25:27 -05:00
Stanislav Malyshev 169c9ac0c5 add news for new pg_ functions 2012-05-21 16:14:36 -07:00
Stanislav Malyshev ee66edb17a Revert "Update test to fix breakage caused by the previous commit."
This reverts commit 05c8d4766c.
Connected to revert 7bbd5521d2.
2012-05-15 23:28:00 -07:00
Stanislav Malyshev a624992809 fix test 2012-05-15 23:27:54 -07:00
Stanislav Malyshev 5bc82d4305 update NEWS 2012-05-15 22:43:06 -07:00
Stanislav Malyshev de26b5561f fd fix 2012-05-15 22:42:11 -07:00
Stanislav Malyshev 1fdece54d9 fix bug #61065 2012-05-15 22:42:03 -07:00
Stanislav Malyshev e6dc487a2b prepare for 5.4.4 2012-05-15 22:13:24 -07:00
78 changed files with 482 additions and 1437 deletions

No files matched your search

+29 -38
View File
@@ -1,9 +1,6 @@
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? 2012, PHP 5.4.4
- COM:
. Fixed bug #62146 com_dotnet cannot be built shared. (Johannes)
14 Jun 2012, PHP 5.4.4
- CLI Server:
. Implemented FR #61977 (Need CLI web-server support for files with .htm &
@@ -14,17 +11,15 @@ PHP NEWS
. Fixed bug #61546 (functions related to current script failed when chdir()
in cli sapi). (Laruence, reeze.xia@gmail.com)
- CURL:
. Fixed bug #61948 (CURLOPT_COOKIEFILE '' raises open_basedir restriction).
(Laruence)
- COM:
. Fixed bug #62146 com_dotnet cannot be built shared. (Johannes)
- Core:
. Fixed missing bound check in iptcparse(). (chris at chiappa.net)
. Fixed CVE-2012-2143. (Solar Designer)
. Fixed bug #62097 (fix for for bug #54547). (Gustavo)
. Fixed bug #62005 (unexpected behavior when incrementally assigning to a
member of a null object). (Laruence)
. Fixed bug #61998 (Using traits with method aliases appears to result in
crash during execution). (Dmitry)
. Fixed bug #61978 (Object recursion not detected for classes that implement
JsonSerializable). (Felipe)
. Fixed bug #61991 (long overflow in realpath_cache_get()). (Anatoliy)
@@ -48,47 +43,35 @@ PHP NEWS
set to null). (Anatoliy)
. Changed php://fd to be available only for CLI.
- CURL:
. Fixed bug #61948 (CURLOPT_COOKIEFILE '' raises open_basedir restriction).
(Laruence)
- Intl:
. Fixed bug #62082 (Memory corruption in internal function
get_icu_disp_value_src_php()). (Gustavo)
- PDO:
. Fixed bug #61755 (A parsing bug in the prepared statements can lead to
access violations). (Johannes)
- Phar:
. Fix bug #61065 (Secunia SA44335, CVE-2012-2386). (Rasmus)
- Pgsql:
. Added pg_escape_identifier/pg_escape_literal. (Yasuo Ohgaki)
- Fileinfo
- FPM
. Fixed bug #61812 (Uninitialised value used in libmagic).
(Laruence, Gustavo)
- FPM
. Fixed bug #61045 (fpm don't send error log to fastcgi clients). (fat)
. Fixed bug #61835 (php-fpm is not allowed to run as root). (fat)
. Fixed bug #61295 (php-fpm should not fail with commented 'user'
for non-root start). (fat)
. Fixed bug #61839 (Unable to cross-compile PHP with --enable-fpm). (fat)
. Fixed bug #61026 (FPM pools can listen on the same address). (fat)
. Fixed bug #62033 (php-fpm exits with status 0 on some failures to start).
(fat)
. Fixed bug #62153 (when using unix sockets, multiples FPM instances
can be launched without errors). (fat)
. Fixed bug #62160 (Add process.priority to set nice(2) priorities). (fat)
. Fixed bug #61218 (FPM drops connection while receiving some binary values
in FastCGI requests). (fat)
- Intl
. ResourceBundle constructor now accepts NULL for the first two arguments.
(Gustavo)
. Fixed bug #62082 (Memory corruption in internal function
get_icu_disp_value_src_php()). (Gustavo)
. Fixed bug #61565 where php_stream_open_wrapper_ex tries to open a
directory descriptor under windows. (Anatoliy)
. Fixed bug #61566 failure caused by the posix lseek and read versions
under windows in cdf_read(). (Anatoliy)
- Libxml:
. Fixed bug #61617 (Libxml tests failed(ht is already destroyed)).
(Laruence)
- Sockets:
. Fixed bug #62025 (__ss_family was changed on AIX 5.3). (Felipe)
- XML Writer:
. Fixed bug #62064 (memory leak in the XML Writer module).
(jean-pierre dot lozi at lip6 dot fr)
- Zlib:
. Fixed bug #61820 (using ob_gzhandler will complain about headers already
@@ -674,6 +657,14 @@ PHP NEWS
. Fixed bug #55544 (ob_gzhandler always conflicts with zlib.output_compression).
(Mike)
08 May 2012, PHP 5.3.13
- CGI
. Improve fix for PHP-CGI query string parameter vulnerability, CVE-2012-2311.
(Stas)
03 May 2012, PHP 5.3.12
- Fix PHP-CGI query string parameter vulnerability, CVE-2012-1823. (Rasmus)
26 Apr 2012, PHP 5.3.11
- Core:
+10 -15
View File
@@ -37,9 +37,9 @@ PHP 5.4 UPGRADE NOTES
=============================
- PHP 5.4 now checks at compile time if /dev/urandom or /dev/arandom
are present. If either is available, session.entropy_file now
are present. If either is available, session.entropy_file now
defaults to that file and session.entropy_length defaults to 32.
This provides non-blocking entropy to session id generation. If you
This provides non-blocking entropy to session id generation. If you
do not want extra entropy for your session ids, add:
session.entropy_file=
@@ -89,9 +89,9 @@ PHP 5.4 UPGRADE NOTES
session.upload_progress.min_freq
- Added a zend.multibyte directive as a replacement of the PHP compile time
configuration option --enable-zend-multibyte. Now the Zend Engine always
configuration option --enable-zend-multibyte. Now the Zend Engine always
contains code for multibyte support, which can be enabled or disabled at
runtime. Note: It doesn't make a lot of sense to enable this option if
runtime. Note: It doesn't make a lot of sense to enable this option if
ext/mbstring is not enabled, because most functionality is implemented by
mbstrings callbacks.
@@ -107,7 +107,7 @@ PHP 5.4 UPGRADE NOTES
in a stream fashion (through php://input) without having it copied in memory
multiple times.
- Added windows_show_crt_warning. This directive shows the CRT warnings when
- Added windows_show_crt_warning. This directive shows the CRT warnings when
enabled. These warnings were displayed by default until now. It is disabled
by default.
@@ -162,7 +162,7 @@ PHP 5.4 UPGRADE NOTES
- Non-numeric string offsets, e.g. $a['foo'] where $a is a string, now
return false on isset() and true on empty(), and produce warning if
trying to use them. Offsets of types double, bool and null produce
trying to use them. Offsets of types double, bool and null produce
notice. Numeric strings ($a['2']) still work as before.
Note that offsets like '12.3' and '5 and a half' are considered
@@ -207,7 +207,7 @@ PHP 5.4 UPGRADE NOTES
- htmlentities() and htmlspecialchars() are stricter in the code units they
accept for the asian encodings. For Big5-HKSCS, the octets 0x80 and 0xFF are
rejected. For GB2312/EUC-CN, the octets 0x8E, 0x8F, 0xA0 and 0xFF are
rejected. For GB2312/EUC-CN, the octets 0x8E, 0x8F, 0xA0 and 0xFF are
rejected. For SJIS, the octets 0x80, 0xA0, 0xFD, 0xFE and 0xFF are rejected,
except maybe after a valid starting byte. For EUC-JP, the octets 0xA0 and
0xFF are rejected.
@@ -233,7 +233,7 @@ PHP 5.4 UPGRADE NOTES
checks on the validity of the entities. Numerical entities are checked for a
valid range (0 to 0x10FFFF); if the flag ENT_DISALLOWED is given, the
validity of such numerical entity in the target document type is also
checked. Named entities are checked for necessary existence in the target
checked. Named entities are checked for necessary existence in the target
document type instead of only checking whether they were constituted by
alphanumeric characters.
@@ -341,8 +341,6 @@ PHP 5.4 UPGRADE NOTES
- Since 5.4.4, "php://fd" stream syntax is available only in CLI build.
- Since 5.4.5, resourcebundle_create() accepts null for the first two arguments.
==============================
5. Changes to existing classes
==============================
@@ -375,9 +373,6 @@ PHP 5.4 UPGRADE NOTES
- FilesystemIterator, GlobIterator and (Recursive)DirectoryIterator now use
the default stream context.
- Since 5.4.5, the constructor of ResourceBundle accepts NULL for the first two
arguments.
===========================
7. Deprecated Functionality
===========================
@@ -436,7 +431,7 @@ d. Removed hash algorithms
a. Extensions no longer maintained
- ext/sqlite is no longer part of the base distribution and has been moved
to PECL. Use sqlite3 or PDO_SQLITE instead.
to PECL. Use sqlite3 or PDO_SQLITE instead.
b. Extensions with changed behavior
@@ -490,7 +485,7 @@ b. Extensions with changed behavior
===========================
- A REQUEST_TIME_FLOAT value returns a floating point number indicating the
time with microsecond precision. All SAPIs providing this value should be
time with microsecond precision. All SAPIs providing this value should be
returning float and not time_t.
- apache_child_terminate(), getallheaders(), apache_request_headers()
-68
View File
@@ -1,68 +0,0 @@
--TEST--
Bug #61998 (Using traits with method aliases appears to result in crash during execution)
--FILE--
<?php
class Foo {
use T1 {
func as newFunc;
}
public function func() {
echo "From Foo\n";
}
}
trait T1 {
public function func() {
echo "From T1\n";
}
}
class Bar {
public function func() {
echo "From Bar\n";
}
public function func2() {
echo "From Bar\n";
}
public function func3() {
echo "From Bar\n";
}
use T1 {
func as newFunc;
func as func2;
}
use T2 {
func2 as newFunc2;
func2 as newFunc3;
func2 as func3;
}
}
trait T2 {
public function func2() {
echo "From T2\n";
}
}
$f = new Foo();
$f->newFunc(); //from T1
$f->func(); //from Foo
$b = new Bar();
$b->newFunc(); //from T1
$b->func(); //from Bar
$b->func2(); //from Bar
$b->newFunc2(); //from T2
$b->newFunc3(); //from T2
$b->func3(); //from Bar
--EXPECTF--
From T1
From Foo
From T1
From Bar
From Bar
From T2
From T2
From Bar
+9 -10
View File
@@ -3619,7 +3619,6 @@ ZEND_API void zend_do_implement_trait(zend_class_entry *ce, zend_class_entry *tr
}
}
ce->traits[ce->num_traits++] = trait;
trait->refcount++;
}
}
/* }}} */
@@ -3871,8 +3870,8 @@ static int zend_traits_copy_functions(zend_function *fn TSRMLS_DC, int num_args,
fn_copy = *fn;
function_add_ref(&fn_copy);
/* this function_name is never destroyed, because its refcount
greater than 1 and classes are always destoyed before the
traits they use */
greater than 1, classes are always destoyed in reverse order
and trait is declared early than this class */
fn_copy.common.function_name = aliases[i]->alias;
/* if it is 0, no modifieres has been changed */
@@ -4077,14 +4076,14 @@ static void zend_do_traits_method_binding(zend_class_entry *ce TSRMLS_DC) /* {{{
size_t i;
/* prepare copies of trait function tables for combination */
function_tables = emalloc(sizeof(HashTable*) * ce->num_traits);
resulting_table = (HashTable *)emalloc(sizeof(HashTable));
function_tables = malloc(sizeof(HashTable*) * ce->num_traits);
resulting_table = (HashTable *) malloc(sizeof(HashTable));
/* TODO: revisit this start size, may be its not optimal */
zend_hash_init_ex(resulting_table, 10, NULL, NULL, 0, 0);
zend_hash_init_ex(resulting_table, 10, NULL, NULL, 1, 0);
for (i = 0; i < ce->num_traits; i++) {
function_tables[i] = (HashTable *)emalloc(sizeof(HashTable));
function_tables[i] = (HashTable *) malloc(sizeof(HashTable));
zend_hash_init_ex(function_tables[i], ce->traits[i]->function_table.nNumOfElements, NULL, NULL, 1, 0);
if (ce->trait_precedences) {
@@ -4117,14 +4116,14 @@ static void zend_do_traits_method_binding(zend_class_entry *ce TSRMLS_DC) /* {{{
for (i = 0; i < ce->num_traits; i++) {
/* zend_hash_destroy(function_tables[i]); */
zend_hash_graceful_destroy(function_tables[i]);
efree(function_tables[i]);
free(function_tables[i]);
}
efree(function_tables);
free(function_tables);
/* free temporary resulting table */
/* zend_hash_destroy(resulting_table); */
zend_hash_graceful_destroy(resulting_table);
efree(resulting_table);
free(resulting_table);
}
/* }}} */
+1 -1
View File
@@ -168,7 +168,7 @@ ZEND_API const zend_encoding *zend_multibyte_get_script_encoding(TSRMLS_D)
ZEND_API int zend_multibyte_set_script_encoding(const zend_encoding **encoding_list, size_t encoding_list_size TSRMLS_DC)
{
if (CG(script_encoding_list)) {
free(CG(script_encoding_list));
efree(CG(script_encoding_list));
}
CG(script_encoding_list) = encoding_list;
CG(script_encoding_list_size) = encoding_list_size;
-6
View File
@@ -215,12 +215,6 @@ ZEND_API int zend_cleanup_class_data(zend_class_entry **pce TSRMLS_DC)
void _destroy_zend_class_traits_info(zend_class_entry *ce)
{
if (ce->num_traits > 0 && ce->traits) {
size_t i;
for (i = 0; i < ce->num_traits; i++) {
if (ce->traits[i]) {
destroy_zend_class(&ce->traits[i]);
}
}
efree(ce->traits);
}
+2 -2
View File
@@ -119,8 +119,8 @@ int zend_sprintf(char *buffer, const char *format, ...);
PHP_MAJOR_VERSION=5
PHP_MINOR_VERSION=4
PHP_RELEASE_VERSION=5
PHP_EXTRA_VERSION="-dev"
PHP_RELEASE_VERSION=4
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`
-25
View File
@@ -1,25 +0,0 @@
--TEST--
Bug #61948 (CURLOPT_COOKIEFILE '' raises open_basedir restriction)
--SKIPIF--
<?php if (!extension_loaded("curl")) print "skip";
if(substr(PHP_OS, 0, 3) != 'WIN' )
die("skip Not Valid for Linux");
?>
--INI--
open_basedir="c:/tmp"
--FILE--
<?php
$ch = curl_init();
var_dump(curl_setopt($ch, CURLOPT_COOKIEFILE, ""));
var_dump(curl_setopt($ch, CURLOPT_COOKIEFILE, "c:/tmp/foo"));
var_dump(curl_setopt($ch, CURLOPT_COOKIEFILE, "c:/xxx/bar"));
curl_close($ch);
?>
--EXPECTF--
%a
Warning: curl_setopt(): open_basedir restriction in effect. File(c:/tmp/foo) is not within the allowed path(s): (c:/tmp) in %sbug61948-win32.php on line %d
bool(false)
Warning: curl_setopt(): open_basedir restriction in effect. File(c:/xxx/bar) is not within the allowed path(s): (c:/tmp) in %sbug61948-win32.php on line %d
bool(false)
+1 -4
View File
@@ -1,10 +1,7 @@
--TEST--
Bug #61948 (CURLOPT_COOKIEFILE '' raises open_basedir restriction)
--SKIPIF--
<?php if (!extension_loaded("curl")) print "skip";
if(substr(PHP_OS, 0, 3) == 'WIN' )
die("skip Not Valid for Windows");
?>
<?php if (!extension_loaded("curl")) print "skip"; ?>
--INI--
open_basedir="/tmp"
--FILE--
+74 -50
View File
@@ -1,6 +1,6 @@
diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
--- libmagic.orig/apprentice.c 2012-05-29 14:40:41.710960045 +0200
+++ libmagic/apprentice.c 2012-04-22 18:57:16.215980866 +0200
--- libmagic.orig/apprentice.c 2012-04-22 19:30:43.182305355 +0800
+++ libmagic/apprentice.c 2012-04-22 19:28:57.346309536 +0800
@@ -29,6 +29,8 @@
* apprentice - make one pass through /etc/magic, learning its secrets.
*/
@@ -729,8 +729,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-05-29 14:40:41.710960045 +0200
+++ libmagic/ascmagic.c 2012-04-22 18:57:16.215980866 +0200
--- libmagic.orig/ascmagic.c 2012-04-22 19:30:43.182305355 +0800
+++ libmagic/ascmagic.c 2012-04-22 19:28:57.330309533 +0800
@@ -139,10 +139,8 @@
/* malloc size is a conservative overestimate; could be
improved, or at least realloced after conversion. */
@@ -755,8 +755,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-05-29 14:40:41.710960045 +0200
+++ libmagic/cdf.c 2012-04-22 18:57:16.219978162 +0200
--- libmagic.orig/cdf.c 2012-04-22 19:30:43.182305355 +0800
+++ libmagic/cdf.c 2012-04-22 19:28:57.370309531 +0800
@@ -43,7 +43,17 @@
#include <err.h>
#endif
@@ -819,8 +819,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-05-29 14:40:41.710960045 +0200
+++ libmagic/cdf.h 2012-04-22 18:57:16.219978162 +0200
--- libmagic.orig/cdf.h 2012-04-22 19:30:43.182305355 +0800
+++ libmagic/cdf.h 2012-04-22 19:28:57.370309531 +0800
@@ -35,7 +35,7 @@
#ifndef _H_CDF_
#define _H_CDF_
@@ -857,8 +857,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-05-29 14:40:41.710960045 +0200
+++ libmagic/cdf_time.c 2012-04-22 18:57:16.219978162 +0200
--- libmagic.orig/cdf_time.c 2012-04-22 19:30:43.182305355 +0800
+++ libmagic/cdf_time.c 2012-04-22 19:28:57.326309537 +0800
@@ -96,7 +96,7 @@
}
@@ -916,8 +916,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-05-29 14:40:41.710960045 +0200
+++ libmagic/compress.c 2012-04-22 18:57:16.219978162 +0200
--- libmagic.orig/compress.c 2012-04-22 19:30:43.182305355 +0800
+++ libmagic/compress.c 2012-04-22 19:28:57.314309548 +0800
@@ -32,6 +32,7 @@
* uncompress(method, old, n, newch) - uncompress old into new,
* using method, return sizeof new
@@ -1079,8 +1079,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-05-29 14:40:41.710960045 +0200
+++ libmagic/file.h 2012-04-22 18:57:16.219978162 +0200
--- libmagic.orig/file.h 2012-04-22 19:30:43.186305188 +0800
+++ libmagic/file.h 2012-04-22 19:49:58.922256776 +0800
@@ -33,11 +33,9 @@
#ifndef __file_h__
#define __file_h__
@@ -1252,8 +1252,8 @@ 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 2012-05-29 14:40:41.710960045 +0200
+++ libmagic/fsmagic.c 2012-04-22 18:57:16.219978162 +0200
--- libmagic.orig/fsmagic.c 2012-04-22 19:30:43.186305188 +0800
+++ libmagic/fsmagic.c 2012-04-22 19:28:57.298309521 +0800
@@ -59,27 +59,21 @@
# define minor(dev) ((dev) & 0xff)
#endif
@@ -1577,8 +1577,8 @@ diff -u libmagic.orig/fsmagic.c libmagic/fsmagic.c
/*
diff -u libmagic.orig/funcs.c libmagic/funcs.c
--- libmagic.orig/funcs.c 2012-05-29 14:40:41.710960045 +0200
+++ libmagic/funcs.c 2012-04-22 18:57:16.219978162 +0200
--- libmagic.orig/funcs.c 2012-04-22 19:30:43.186305188 +0800
+++ libmagic/funcs.c 2012-04-22 19:28:57.370309531 +0800
@@ -41,52 +41,42 @@
#if defined(HAVE_WCTYPE_H)
#include <wctype.h>
@@ -1872,9 +1872,11 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c
+ return rep_cnt;
}
+
Only in libmagic.orig: funcs.c.orig
Only in libmagic.orig: funcs.c.rej
diff -u libmagic.orig/magic.c libmagic/magic.c
--- libmagic.orig/magic.c 2012-05-29 14:40:41.710960045 +0200
+++ libmagic/magic.c 2012-04-22 18:57:16.219978162 +0200
--- libmagic.orig/magic.c 2012-04-22 19:30:43.186305188 +0800
+++ libmagic/magic.c 2012-04-22 19:28:57.370309531 +0800
@@ -25,11 +25,6 @@
* SUCH DAMAGE.
*/
@@ -2251,8 +2253,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-05-29 14:40:41.710960045 +0200
+++ libmagic/magic.h 2012-04-22 18:57:16.219978162 +0200
--- libmagic.orig/magic.h 2012-04-22 19:30:43.190305058 +0800
+++ libmagic/magic.h 2012-04-22 19:28:57.326309537 +0800
@@ -85,6 +85,7 @@
const char *magic_getpath(const char *, int);
@@ -2270,8 +2272,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-05-29 14:40:41.710960045 +0200
+++ libmagic/print.c 2012-05-29 14:34:03.770376387 +0200
--- libmagic.orig/print.c 2012-04-22 19:30:43.190305058 +0800
+++ libmagic/print.c 2012-04-22 19:28:57.326309537 +0800
@@ -29,6 +29,9 @@
* print.c - debugging printout routines
*/
@@ -2465,8 +2467,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-05-29 14:40:41.710960045 +0200
+++ libmagic/readcdf.c 2012-04-22 18:57:16.219978162 +0200
--- libmagic.orig/readcdf.c 2012-04-22 19:30:43.190305058 +0800
+++ libmagic/readcdf.c 2012-04-22 19:28:57.326309537 +0800
@@ -30,7 +30,11 @@
#endif
@@ -2513,8 +2515,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-05-29 14:40:41.710960045 +0200
+++ libmagic/readelf.c 2012-04-22 18:57:16.219978162 +0200
--- libmagic.orig/readelf.c 2012-04-22 19:30:43.190305058 +0800
+++ libmagic/readelf.c 2012-04-22 19:28:57.378309534 +0800
@@ -49,7 +49,7 @@
off_t, int *, int);
private int doshn(struct magic_set *, int, int, int, off_t, int, size_t,
@@ -2670,8 +2672,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-05-29 14:40:41.710960045 +0200
+++ libmagic/softmagic.c 2012-05-29 14:34:31.900417647 +0200
--- libmagic.orig/softmagic.c 2012-04-22 19:30:43.194304945 +0800
+++ libmagic/softmagic.c 2012-04-22 19:28:57.286309597 +0800
@@ -41,6 +41,11 @@
#include <stdlib.h>
#include <time.h>
@@ -2858,7 +2860,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
}
}
@@ -1669,6 +1642,42 @@
@@ -1669,6 +1642,65 @@
return file_strncmp(a, b, len, flags);
}
@@ -2874,6 +2876,29 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
+
+ for (i=0; i<Z_STRLEN_P(pattern); i++, j++) {
+ switch (Z_STRVAL_P(pattern)[i]) {
+ case '?':
+ t[j] = '.';
+ break;
+ case '*':
+ t[j++] = '.';
+ t[j] = '*';
+ break;
+ case '.':
+ t[j++] = '\\';
+ t[j] = '.';
+ break;
+ case '\\':
+ t[j++] = '\\';
+ t[j] = '\\';
+ break;
+ case '(':
+ t[j++] = '\\';
+ t[j] = '(';
+ break;
+ case ')':
+ t[j++] = '\\';
+ t[j] = ')';
+ break;
+ case '~':
+ t[j++] = '\\';
+ t[j] = '~';
@@ -2901,7 +2926,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
private int
magiccheck(struct magic_set *ms, struct magic *m)
{
@@ -1825,67 +1834,163 @@
@@ -1825,67 +1857,163 @@
break;
}
case FILE_REGEX: {
@@ -2912,23 +2937,6 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
- if (ms->search.s == NULL)
- return 0;
-
- l = 0;
- rc = regcomp(&rx, m->value.s,
- REG_EXTENDED|REG_NEWLINE|
- ((m->str_flags & STRING_IGNORE_CASE) ? REG_ICASE : 0));
- if (rc) {
- (void)regerror(rc, &rx, errmsg, sizeof(errmsg));
- file_magerror(ms, "regex error %d, (%s)",
- rc, errmsg);
- v = (uint64_t)-1;
- }
- else {
- regmatch_t pmatch[1];
-#ifndef REG_STARTEND
-#define REG_STARTEND 0
- size_t l = ms->search.s_len - 1;
- char c = ms->search.s[l];
- ((char *)(intptr_t)ms->search.s)[l] = '\0';
+ zval *pattern;
+ int options = 0;
+ pcre_cache_entry *pce;
@@ -2945,7 +2953,23 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
+
+ convert_libmagic_pattern(pattern, options);
+
+ l = v = 0;
l = 0;
- rc = regcomp(&rx, m->value.s,
- REG_EXTENDED|REG_NEWLINE|
- ((m->str_flags & STRING_IGNORE_CASE) ? REG_ICASE : 0));
- if (rc) {
- (void)regerror(rc, &rx, errmsg, sizeof(errmsg));
- file_magerror(ms, "regex error %d, (%s)",
- rc, errmsg);
- v = (uint64_t)-1;
- }
- else {
- regmatch_t pmatch[1];
-#ifndef REG_STARTEND
-#define REG_STARTEND 0
- size_t l = ms->search.s_len - 1;
- char c = ms->search.s[l];
- ((char *)(intptr_t)ms->search.s)[l] = '\0';
+#if (PHP_MAJOR_VERSION < 6)
+ if ((pce = pcre_get_compiled_regex_cache(Z_STRVAL_P(pattern), Z_STRLEN_P(pattern) TSRMLS_CC)) == NULL) {
#else
+24 -1
View File
@@ -1654,6 +1654,29 @@ convert_libmagic_pattern(zval *pattern, int options)
for (i=0; i<Z_STRLEN_P(pattern); i++, j++) {
switch (Z_STRVAL_P(pattern)[i]) {
case '?':
t[j] = '.';
break;
case '*':
t[j++] = '.';
t[j] = '*';
break;
case '.':
t[j++] = '\\';
t[j] = '.';
break;
case '\\':
t[j++] = '\\';
t[j] = '\\';
break;
case '(':
t[j++] = '\\';
t[j] = '(';
break;
case ')':
t[j++] = '\\';
t[j] = ')';
break;
case '~':
t[j++] = '\\';
t[j] = '~';
@@ -1850,7 +1873,7 @@ magiccheck(struct magic_set *ms, struct magic *m)
convert_libmagic_pattern(pattern, options);
l = v = 0;
l = 0;
#if (PHP_MAJOR_VERSION < 6)
if ((pce = pcre_get_compiled_regex_cache(Z_STRVAL_P(pattern), Z_STRLEN_P(pattern) TSRMLS_CC)) == NULL) {
#else
+1 -3
View File
@@ -18,11 +18,9 @@ ksort($results);
var_dump($results);
?>
--EXPECTF--
array(7) {
array(6) {
["%s/resources/dir.zip"]=>
string(15) "application/zip"
["%s/resources/test.awk"]=>
string(10) "text/plain"
["%s/resources/test.bmp"]=>
string(14) "image/x-ms-bmp"
["%s/resources/test.gif"]=>
@@ -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===
-32
View File
@@ -1,32 +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 Non Windows Systems');
}
?>
--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 ) );
?>
===DONE===
--EXPECTF--
*** Testing finfo_file() : regex rules ***
string(28) "text/plain; charset=us-ascii"
string(22) "awk script, ASCII text"
===DONE===
@@ -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===
+1 -4
View File
@@ -1,10 +1,7 @@
--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 Windows");
?>
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
/* Prototype : resource finfo_open([int options [, string arg]])
-1
View File
@@ -1 +0,0 @@
BEGIN { print "START" }
-90
View File
@@ -1,90 +0,0 @@
--TEST--
gmp_gcdext() basic tests
--SKIPIF--
<?php if (!extension_loaded("gmp")) print "skip";
if(substr(PHP_OS, 0, 3) != 'WIN' ) {
die('skip windows only test');
}
?>
--FILE--
<?php
$n = gmp_init("34293864345");
$n1 = gmp_init("23434293864345");
$a = array(
array(123,45),
array(4341,9734),
array(23487,333),
array(-234234,-123123),
array(-100,-2234),
array(345,"34587345"),
array(345,"0"),
array("345556456",345873),
array("34545345556456","323432445873"),
array($n, $n1),
);
foreach ($a as $val) {
$r = gmp_gcdext($val[0],$val[1]);
var_dump(gmp_strval($r['g']));
var_dump(gmp_strval($r['s']));
var_dump(gmp_strval($r['t']));
}
var_dump(gmp_gcdext($val[0],array()));
var_dump(gmp_gcdext(array(),array()));
var_dump(gmp_gcdext(array(),array(),1));
var_dump(gmp_gcdext(array()));
var_dump(gmp_gcdext());
echo "Done\n";
?>
--EXPECTF--
string(1) "3"
string(2) "41"
string(4) "-112"
string(1) "1"
string(4) "-805"
string(3) "359"
string(1) "3"
string(2) "32"
string(5) "-2257"
string(4) "3003"
string(3) "-10"
string(2) "19"
string(1) "2"
string(2) "67"
string(2) "-3"
string(2) "15"
string(7) "-601519"
string(1) "6"
string(3) "345"
string(1) "1"
string(1) "0"
string(1) "1"
string(5) "84319"
string(9) "-84241831"
string(1) "1"
string(12) "167180205823"
string(15) "-17856272782919"
string(3) "195"
string(15) "-23387298979862"
string(11) "34225091793"
Warning: gmp_gcdext(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
Warning: gmp_gcdext(): Unable to convert variable to GMP - wrong type in %s on line %d
bool(false)
Warning: gmp_gcdext() expects exactly 2 parameters, 3 given in %s on line %d
NULL
Warning: gmp_gcdext() expects exactly 2 parameters, 1 given in %s on line %d
NULL
Warning: gmp_gcdext() expects exactly 2 parameters, 0 given in %s on line %d
NULL
Done
+1 -5
View File
@@ -1,11 +1,7 @@
--TEST--
gmp_gcdext() basic tests
--SKIPIF--
<?php if (!extension_loaded("gmp")) print "skip";
if (substr(PHP_OS, 0, 3) == 'WIN') {
die('skip.. only for Non Windows Systems');
}
?>
<?php if (!extension_loaded("gmp")) print "skip"; ?>
--FILE--
<?php
-45
View File
@@ -1,45 +0,0 @@
--TEST--
gmp_nextprime()
--SKIPIF--
<?php if (!extension_loaded("gmp")) print "skip";
if(substr(PHP_OS, 0, 3) != 'WIN' ) {
die('skip windows only test');
}
?>
--FILE--
<?php
$n = gmp_nextprime(-1);
var_dump(gmp_strval($n));
$n = gmp_nextprime(0);
var_dump(gmp_strval($n));
$n = gmp_nextprime(-1000);
var_dump(gmp_strval($n));
$n = gmp_nextprime(1000);
var_dump(gmp_strval($n));
$n = gmp_nextprime(100000);
var_dump(gmp_strval($n));
$n = gmp_nextprime(array());
var_dump(gmp_strval($n));
$n = gmp_nextprime("");
var_dump(gmp_strval($n));
$n = gmp_nextprime(new stdclass());
var_dump(gmp_strval($n));
echo "Done\n";
?>
--EXPECTF--
string(1) "2"
string(1) "2"
string(4) "-997"
string(4) "1009"
string(6) "100003"
Warning: gmp_nextprime(): Unable to convert variable to GMP - wrong type in %s on line %d
string(1) "0"
string(1) "0"
Warning: gmp_nextprime(): Unable to convert variable to GMP - wrong type in %s on line %d
string(1) "0"
Done
+1 -5
View File
@@ -1,11 +1,7 @@
--TEST--
gmp_nextprime()
--SKIPIF--
<?php if (!extension_loaded("gmp")) print "skip";
if (substr(PHP_OS, 0, 3) == 'WIN') {
die('skip.. only for Non Windows Systems');
}
?>
<?php if (!extension_loaded("gmp")) print "skip"; ?>
--FILE--
<?php
+1 -3
View File
@@ -594,8 +594,6 @@ PHP_FUNCTION( collator_get_sort_key )
RETURN_FALSE;
}
/* ucol_getSortKey is exception in that the key length includes the
* NUL terminator*/
key_len = ucol_getSortKey(co->ucoll, ustr, ustr_len, key, 0);
if(!key_len) {
efree( ustr );
@@ -607,7 +605,7 @@ PHP_FUNCTION( collator_get_sort_key )
if(!key_len) {
RETURN_FALSE;
}
RETURN_STRINGL((char *)key, key_len - 1, 0);
RETURN_STRINGL((char *)key, key_len, 0);
}
/* }}} */
+20 -64
View File
@@ -99,46 +99,17 @@ static void datefmt_ctor(INTERNAL_FUNCTION_PARAMETERS)
}
INTL_CHECK_LOCALE_LEN_OBJ(locale_len, return_value);
if (calendar != UCAL_TRADITIONAL && calendar != UCAL_GREGORIAN) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "datefmt_create: "
"invalid value for calendar type; it must be one of "
"IntlDateFormatter::TRADITIONAL (locale's default calendar) "
"or IntlDateFormatter::GREGORIAN", 0 TSRMLS_CC);
goto error;
}
DATE_FORMAT_METHOD_FETCH_OBJECT;
if (DATE_FORMAT_OBJECT(dfo) != NULL) {
intl_errors_set(INTL_DATA_ERROR_P(dfo), U_ILLEGAL_ARGUMENT_ERROR,
"datefmt_create: cannot call constructor twice", 0 TSRMLS_CC);
return;
}
/* Convert pattern (if specified) to UTF-16. */
if( pattern_str && pattern_str_len>0 ){
intl_convert_utf8_to_utf16(&svalue, &slength,
pattern_str, pattern_str_len, &INTL_DATA_ERROR_CODE(dfo));
if (U_FAILURE(INTL_DATA_ERROR_CODE(dfo))) {
/* object construction -> only set global error */
intl_error_set(NULL, INTL_DATA_ERROR_CODE(dfo), "datefmt_create: "
"error converting pattern to UTF-16", 0 TSRMLS_CC);
goto error;
}
intl_convert_utf8_to_utf16(&svalue, &slength, pattern_str, pattern_str_len, &INTL_DATA_ERROR_CODE(dfo));
INTL_CTOR_CHECK_STATUS(dfo, "datefmt_create: error converting pattern to UTF-16");
}
/* resources allocated from now on */
/* Convert pattern (if specified) to UTF-16. */
if( timezone_str && timezone_str_len >0 ){
intl_convert_utf8_to_utf16(&timezone_utf16, &timezone_utf16_len,
timezone_str, timezone_str_len, &INTL_DATA_ERROR_CODE(dfo));
if (U_FAILURE(INTL_DATA_ERROR_CODE(dfo))) {
intl_error_set(NULL, INTL_DATA_ERROR_CODE(dfo), "datefmt_create: "
"error converting timezone_str to UTF-16", 0 TSRMLS_CC);
goto error;
}
intl_convert_utf8_to_utf16(&timezone_utf16, &timezone_utf16_len, timezone_str, timezone_str_len, &INTL_DATA_ERROR_CODE(dfo));
INTL_CTOR_CHECK_STATUS(dfo, "datefmt_create: error converting timezone_str to UTF-16" );
}
if(locale_len == 0) {
@@ -151,24 +122,24 @@ static void datefmt_ctor(INTERNAL_FUNCTION_PARAMETERS)
DATE_FORMAT_OBJECT(dfo) = udat_open(time_type, date_type, locale, timezone_utf16, timezone_utf16_len, svalue, slength, &INTL_DATA_ERROR_CODE(dfo));
}
if (!U_FAILURE(INTL_DATA_ERROR_CODE(dfo))) {
if (calendar != UCAL_TRADITIONAL) {
ucal_obj = ucal_open(timezone_utf16, timezone_utf16_len, locale,
calendar, &INTL_DATA_ERROR_CODE(dfo));
if (!U_FAILURE(INTL_DATA_ERROR_CODE(dfo))) {
udat_setCalendar(DATE_FORMAT_OBJECT(dfo), ucal_obj);
ucal_close(ucal_obj);
} else {
intl_error_set(NULL, INTL_DATA_ERROR_CODE(dfo), "datefmt_create"
": error opening calendar", 0 TSRMLS_CC);
goto error;
}
/* Set the calendar if passed */
if(!U_FAILURE(INTL_DATA_ERROR_CODE(dfo)) && calendar) {
ucal_obj = ucal_open( timezone_utf16, timezone_utf16_len, locale, calendar, &INTL_DATA_ERROR_CODE(dfo) );
if(!U_FAILURE(INTL_DATA_ERROR_CODE(dfo))) {
udat_setCalendar( DATE_FORMAT_OBJECT(dfo), ucal_obj );
}
} else {
intl_error_set(NULL, INTL_DATA_ERROR_CODE(dfo), "datefmt_create: date "
"formatter creation failed", 0 TSRMLS_CC);
goto error;
}
if(svalue)
{
efree(svalue);
}
if(timezone_utf16)
{
efree(timezone_utf16);
}
INTL_CTOR_CHECK_STATUS(dfo, "datefmt_create: date formatter creation failed");
/* Set the class variables */
dfo->date_type = date_type;
@@ -177,19 +148,6 @@ static void datefmt_ctor(INTERNAL_FUNCTION_PARAMETERS)
if( timezone_str && timezone_str_len > 0){
dfo->timezone_id = estrndup( timezone_str, timezone_str_len);
}
error:
if (svalue) {
efree(svalue);
}
if (timezone_utf16) {
efree(timezone_utf16);
}
if (U_FAILURE(intl_error_get_code(NULL TSRMLS_CC))) {
/* free_object handles partially constructed instances fine */
zval_dtor(return_value);
RETVAL_NULL();
}
}
/* }}} */
@@ -211,8 +169,6 @@ PHP_FUNCTION( datefmt_create )
*/
PHP_METHOD( IntlDateFormatter, __construct )
{
/* return_value param is being changed, therefore we will always return
* NULL here */
return_value = getThis();
datefmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU);
}
-1
View File
@@ -822,7 +822,6 @@ PHP_FUNCTION(grapheme_extract)
}
else {
/* initialize next */
zval_dtor(next);
ZVAL_LONG(next, lstart);
}
}
+7 -17
View File
@@ -91,7 +91,7 @@ static void resourcebundle_ctor(INTERNAL_FUNCTION_PARAMETERS)
intl_error_reset( NULL TSRMLS_CC );
if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "s!s!|b",
if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "ss|b",
&locale, &locale_len, &bundlename, &bundlename_len, &fallback ) == FAILURE )
{
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
@@ -101,10 +101,6 @@ static void resourcebundle_ctor(INTERNAL_FUNCTION_PARAMETERS)
}
INTL_CHECK_LOCALE_LEN_OBJ(locale_len, return_value);
if (locale == NULL) {
locale = INTL_G(default_locale);
}
if (fallback) {
rb->me = ures_open(bundlename, locale, &INTL_DATA_ERROR_CODE(rb));
@@ -114,17 +110,13 @@ static void resourcebundle_ctor(INTERNAL_FUNCTION_PARAMETERS)
INTL_CTOR_CHECK_STATUS(rb, "resourcebundle_ctor: Cannot load libICU resource bundle");
if (!fallback && (INTL_DATA_ERROR_CODE(rb) == U_USING_FALLBACK_WARNING ||
INTL_DATA_ERROR_CODE(rb) == U_USING_DEFAULT_WARNING)) {
intl_errors_set_code(NULL, INTL_DATA_ERROR_CODE(rb) TSRMLS_CC);
spprintf(&pbuf, 0, "resourcebundle_ctor: Cannot load libICU resource "
"'%s' without fallback from %s to %s",
bundlename ? bundlename : "(default data)", locale,
ures_getLocaleByType(
rb->me, ULOC_ACTUAL_LOCALE, &INTL_DATA_ERROR_CODE(rb)));
intl_errors_set_custom_msg(INTL_DATA_ERROR_P(rb), pbuf, 1 TSRMLS_CC);
if (!fallback && (INTL_DATA_ERROR_CODE(rb) == U_USING_FALLBACK_WARNING || INTL_DATA_ERROR_CODE(rb) == U_USING_DEFAULT_WARNING)) {
intl_errors_set_code( NULL, INTL_DATA_ERROR_CODE(rb) TSRMLS_CC );
spprintf( &pbuf, 0, "resourcebundle_ctor: Cannot load libICU resource '%s' without fallback from %s to %s",
bundlename, locale, ures_getLocaleByType( rb->me, ULOC_ACTUAL_LOCALE, &INTL_DATA_ERROR_CODE(rb)) );
intl_errors_set_custom_msg( INTL_DATA_ERROR_P(rb), pbuf, 1 TSRMLS_CC );
efree(pbuf);
zval_dtor(return_value);
zval_dtor( return_value );
RETURN_NULL();
}
}
@@ -435,8 +427,6 @@ void resourcebundle_register_class( TSRMLS_D )
ResourceBundle_object_handlers.clone_obj = NULL; /* ICU ResourceBundle has no clone implementation */
ResourceBundle_object_handlers.read_dimension = resourcebundle_array_get;
ResourceBundle_object_handlers.count_elements = resourcebundle_array_count;
zend_class_implements(ResourceBundle_ce_ptr TSRMLS_CC, 1, zend_ce_traversable);
}
/* }}} */
-22
View File
@@ -1,22 +0,0 @@
--TEST--
Bug #62017: datefmt_create with incorrectly encoded timezone leaks pattern
--SKIPIF--
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
--FILE--
<?php
ini_set('intl.error_level', E_WARNING);
var_dump(
datefmt_create('', IntlDateFormatter::NONE, IntlDateFormatter::NONE, "\xFF",
IntlDateFormatter::GREGORIAN, 'a'));
var_dump(
new IntlDateFormatter('', IntlDateFormatter::NONE, IntlDateFormatter::NONE, "Europe/Lisbon",
IntlDateFormatter::GREGORIAN, "\x80"));
--EXPECTF--
Warning: datefmt_create(): datefmt_create: error converting timezone_str to UTF-16 in %s on line %d
NULL
Warning: IntlDateFormatter::__construct(): datefmt_create: error converting pattern to UTF-16 in %s on line %d
NULL
-16
View File
@@ -1,16 +0,0 @@
--TEST--
Bug #62070: Collator::getSortKey() returns garbage
--SKIPIF--
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
--FILE--
<?php
$s1 = 'Hello';
$coll = collator_create('en_US');
$res = collator_get_sort_key($coll, $s1);
echo urlencode($res);
--EXPECT--
5%2F%3D%3DC%01%09%01%8F%08
-14
View File
@@ -1,14 +0,0 @@
--TEST--
Bug #62081: IntlDateFormatter leaks memory if called twice
--SKIPIF--
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
--FILE--
<?php
ini_set('intl.error_level', E_WARNING);
$x = new IntlDateFormatter(1,1,1,1,1);
var_dump($x->__construct(1,1,1,1,1));
--EXPECTF--
Warning: IntlDateFormatter::__construct(): datefmt_create: cannot call constructor twice in %s on line %d
NULL
-12
View File
@@ -1,12 +0,0 @@
--TEST--
Bug #62083: grapheme_extract() leaks memory
--SKIPIF--
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
--FILE--
<?php
$arr1 = array();
var_dump(grapheme_extract(-1, -1, -1,-1, $arr1));
--EXPECT--
bool(false)
-45
View File
@@ -1,45 +0,0 @@
--TEST--
IntlDateFormatter, calendars and time zone
--INI--
date.timezone=Atlantic/Azores
--SKIPIF--
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
$fmt1 = new IntlDateFormatter('en_US',
IntlDateFormatter::FULL,
IntlDateFormatter::FULL,
'GMT+05:12',
IntlDateFormatter::TRADITIONAL);
$fmt2 = new IntlDateFormatter('en_US',
IntlDateFormatter::FULL,
IntlDateFormatter::FULL,
'GMT+05:12',
IntlDateFormatter::GREGORIAN);
$fmt3 = new IntlDateFormatter('en_US@calendar=hebrew',
IntlDateFormatter::FULL,
IntlDateFormatter::FULL,
'GMT+05:12',
IntlDateFormatter::TRADITIONAL);
var_dump($fmt1->format(strtotime('2012-01-01 00:00:00 +0000')));
var_dump($fmt2->format(strtotime('2012-01-01 00:00:00 +0000')));
var_dump($fmt3->format(strtotime('2012-01-01 00:00:00 +0000')));
new IntlDateFormatter('en_US@calendar=hebrew',
IntlDateFormatter::FULL,
IntlDateFormatter::FULL,
'GMT+05:12',
-1);
?>
==DONE==
--EXPECTF--
string(44) "Sunday, January 1, 2012 5:12:00 AM GMT+05:12"
string(44) "Sunday, January 1, 2012 5:12:00 AM GMT+05:12"
string(42) "Sunday, Tevet 6, 5772 5:12:00 AM GMT+05:12"
Warning: IntlDateFormatter::__construct(): datefmt_create: invalid value for calendar type; it must be one of IntlDateFormatter::TRADITIONAL (locale's default calendar) or IntlDateFormatter::GREGORIAN in %s on line %d
==DONE==
@@ -1,26 +0,0 @@
--TEST--
IntlCalendar::setTime() basic test
--INI--
date.timezone=Atlantic/Azores
--SKIPIF--
<?php
if (!extension_loaded('intl'))
die('skip intl extension not enabled');
--FILE--
<?php
ini_set("intl.error_level", E_WARNING);
$r = new ResourceBundle('en_US', NULL);
$c = $r->get('calendar')->get('gregorian')->get('DateTimePatterns')->get(0);
var_dump($c);
ini_set('intl.default_locale', 'pt_PT');
$r = new ResourceBundle(NULL, NULL);
$c = $r->get('calendar')->get('gregorian')->get('DateTimePatterns')->get(0);
var_dump($c);
?>
==DONE==
--EXPECT--
string(14) "h:mm:ss a zzzz"
string(12) "H:mm:ss zzzz"
==DONE==
@@ -1,23 +0,0 @@
--TEST--
Bug #55610: ResourceBundle does not implement Traversable
--SKIPIF--
<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
--FILE--
<?php
include "resourcebundle.inc";
$r = new ResourceBundle( 'es', BUNDLE );
var_dump($r instanceof Traversable);
var_dump(iterator_to_array($r->get('testarray')));
?>
--EXPECTF--
bool(true)
array(3) {
[0]=>
string(8) "cadena 1"
[1]=>
string(8) "cadena 2"
[2]=>
string(8) "cadena 3"
}
+2 -3
View File
@@ -4,12 +4,11 @@ Bug #61367: open_basedir bypass in libxml RSHUTDOWN: read test
<?php if(!extension_loaded('dom')) echo 'skip'; ?>
--INI--
open_basedir=.
; Suppress spurious "Trying to get property of non-object" notices
error_reporting=E_ALL & ~E_NOTICE
--FILE--
<?php
/*
* Note: Using error_reporting=E_ALL & ~E_NOTICE to supress "Trying to get property of non-object" notices.
*/
class StreamExploiter {
public function stream_close ( ) {
$doc = new DOMDocument;
+2
View File
@@ -4,6 +4,8 @@ Bug #61367: open_basedir bypass in libxml RSHUTDOWN: write test
<?php if(!extension_loaded('dom')) echo 'skip'; ?>
--INI--
open_basedir=.
; Suppress spurious "Trying to get property of non-object" notices
error_reporting=E_ALL & ~E_NOTICE
--FILE--
<?php
-40
View File
@@ -1,40 +0,0 @@
--TEST--
Bug #62046 mysqli@mysqlnd can't iterate over stored sets after call to mysqli_stmt_reset()
--SKIPIF--
<?php
require_once('skipif.inc');
require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
require_once("connect.inc");
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
}
if (FALSE === ($stmt = $link->prepare('SELECT 42'))) {
printf("[002] Prepare failed, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
}
if (FALSE === $stmt->execute()) {
printf("[003] Execute failed, [%d] %s\n", $stmt->errorno, $stmt->error);
}
if (FALSE === $stmt->store_result()) {
printf("[004] store_result failed, [%d] %s\n", $stmt->errorno, $stmt->error);
}
$one = NULL;
if (FALSE === $stmt->bind_result($one)) {
printf("[005] bind_result failed, [%d] %s\n", $stmt->errorno, $stmt->error);
}
if (FALSE === $stmt->reset()) {
printf("[006] bind_result failed, [%d] %s\n", $stmt->errorno, $stmt->error);
}
while ($stmt->fetch()) {
var_dump($one);
}
$stmt->close();
$link->close();
echo "done!";
?>
--EXPECT--
int(42)
done!
+4 -2
View File
@@ -636,8 +636,6 @@ MYSQLND_METHOD(mysqlnd_stmt, execute)(MYSQLND_STMT * const s TSRMLS_DC)
have it again.
*/
stmt->result->m.free_result_buffers(stmt->result TSRMLS_CC);
stmt->state = MYSQLND_STMT_PREPARED;
} else if (stmt->state < MYSQLND_STMT_PREPARED) {
/* Only initted - error */
SET_CLIENT_ERROR(*conn->error_info, CR_COMMANDS_OUT_OF_SYNC, UNKNOWN_SQLSTATE,
@@ -1223,6 +1221,8 @@ MYSQLND_METHOD(mysqlnd_stmt, reset)(MYSQLND_STMT * const s TSRMLS_DC)
COPY_CLIENT_ERROR(*stmt->error_info, *conn->error_info);
}
*stmt->upsert_status = *conn->upsert_status;
stmt->state = MYSQLND_STMT_PREPARED;
}
DBG_INF(ret == PASS? "PASS":"FAIL");
DBG_RETURN(ret);
@@ -1261,6 +1261,8 @@ MYSQLND_METHOD(mysqlnd_stmt, flush)(MYSQLND_STMT * const s TSRMLS_DC)
stmt->result->m.skip_result(stmt->result TSRMLS_CC);
}
} while (mysqlnd_stmt_more_results(s) && mysqlnd_stmt_next_result(s) == PASS);
stmt->state = MYSQLND_STMT_PREPARED;
}
DBG_INF(ret == PASS? "PASS":"FAIL");
DBG_RETURN(ret);
+1 -1
View File
@@ -15,4 +15,4 @@ Content-type: text/html; charset=UTF-8
--EXPECTF--
string(9) "\Web\View"
Parse error: syntax error, unexpected %s, expecting %s in phar://%r([A-Za-z]:)?%r/%sfatal_error_webphar.php/Web/View.php on line 380
Parse error: syntax error, unexpected %s, expecting %s in phar:///%sfatal_error_webphar.php/Web/View.php on line 380
-15
View File
@@ -27,21 +27,6 @@ if test "$PHP_SOCKETS" != "no"; then
[AC_DEFINE(MISSING_MSGHDR_MSGFLAGS, 1, [ ])]
)
AC_DEFINE([HAVE_SOCKETS], 1, [ ])
dnl Check for fied ss_family in sockaddr_storage (missing in AIX until 5.3)
AC_CACHE_CHECK([for field ss_family in struct sockaddr_storage], ac_cv_ss_family,
[
AC_TRY_COMPILE([
#include <sys/socket.h>
#include <sys/types.h>
#include <netdb.h>
], [struct sockaddr_storage sa_store; sa_store.ss_family = AF_INET6;],
ac_cv_ss_family=yes, ac_cv_ss_family=no)
])
if test "$ac_cv_ss_family" = yes; then
AC_DEFINE(HAVE_SA_SS_FAMILY,1,[Whether you have sockaddr_storage.ss_family])
fi
PHP_NEW_EXTENSION([sockets], [sockets.c multicast.c], [$ext_shared])
PHP_INSTALL_HEADERS([ext/sockets/], [php_sockets.h])
-3
View File
@@ -77,9 +77,6 @@
# define IS_INVALID_SOCKET(a) (a->bsd_socket < 0)
# define set_errno(a) (errno = a)
# include "php_sockets.h"
# if defined(_AIX) && !defined(HAVE_SA_SS_FAMILY)
# define ss_family __ss_family
# endif
# if HAVE_IF_NAMETOINDEX
# include <net/if.h>
# endif
+1 -1
View File
@@ -953,7 +953,7 @@ static int spl_heap_it_get_current_key(zend_object_iterator *iter, char **str_ke
{
spl_heap_it *iterator = (spl_heap_it *)iter;
*int_key = (ulong) iterator->object->heap->count - 1;
*int_key = (ulong) iterator->object->heap->count;
return HASH_KEY_IS_LONG;
}
/* }}} */
-22
View File
@@ -1,22 +0,0 @@
--TEST--
Bug #62073 (different ways of iterating over an SplMaxHeap result in different keys)
--FILE--
<?php
$heap = new SplMaxHeap();
$heap->insert(42);
foreach ($heap as $key => $value) {
var_dump($key);
var_dump($value);
break;
}
$heap = new SplMaxHeap();
$heap->insert(42);
var_dump($heap->key());
var_dump($heap->current());
?>
--EXPECT--
int(0)
int(42)
int(0)
int(42)
+100 -100
View File
@@ -18,104 +18,104 @@ foreach ($h as $k => $o) {
===DONE===
<?php exit(0); ?>
--EXPECTF--
99 => 1
98 => 2
97 => 3
96 => 4
95 => 5
94 => 6
93 => 7
92 => 8
91 => 9
90 => 10
89 => 11
88 => 12
87 => 13
86 => 14
85 => 15
84 => 16
83 => 17
82 => 18
81 => 19
80 => 20
79 => 21
78 => 22
77 => 23
76 => 24
75 => 25
74 => 26
73 => 27
72 => 28
71 => 29
70 => 30
69 => 31
68 => 32
67 => 33
66 => 34
65 => 35
64 => 36
63 => 37
62 => 38
61 => 39
60 => 40
59 => 41
58 => 42
57 => 43
56 => 44
55 => 45
54 => 46
53 => 47
52 => 48
51 => 49
50 => 50
49 => 51
48 => 52
47 => 53
46 => 54
45 => 55
44 => 56
43 => 57
42 => 58
41 => 59
40 => 60
39 => 61
38 => 62
37 => 63
36 => 64
35 => 65
34 => 66
33 => 67
32 => 68
31 => 69
30 => 70
29 => 71
28 => 72
27 => 73
26 => 74
25 => 75
24 => 76
23 => 77
22 => 78
21 => 79
20 => 80
19 => 81
18 => 82
17 => 83
16 => 84
15 => 85
14 => 86
13 => 87
12 => 88
11 => 89
10 => 90
9 => 91
8 => 92
7 => 93
6 => 94
5 => 95
4 => 96
3 => 97
2 => 98
1 => 99
0 => 100
100 => 1
99 => 2
98 => 3
97 => 4
96 => 5
95 => 6
94 => 7
93 => 8
92 => 9
91 => 10
90 => 11
89 => 12
88 => 13
87 => 14
86 => 15
85 => 16
84 => 17
83 => 18
82 => 19
81 => 20
80 => 21
79 => 22
78 => 23
77 => 24
76 => 25
75 => 26
74 => 27
73 => 28
72 => 29
71 => 30
70 => 31
69 => 32
68 => 33
67 => 34
66 => 35
65 => 36
64 => 37
63 => 38
62 => 39
61 => 40
60 => 41
59 => 42
58 => 43
57 => 44
56 => 45
55 => 46
54 => 47
53 => 48
52 => 49
51 => 50
50 => 51
49 => 52
48 => 53
47 => 54
46 => 55
45 => 56
44 => 57
43 => 58
42 => 59
41 => 60
40 => 61
39 => 62
38 => 63
37 => 64
36 => 65
35 => 66
34 => 67
33 => 68
32 => 69
31 => 70
30 => 71
29 => 72
28 => 73
27 => 74
26 => 75
25 => 76
24 => 77
23 => 78
22 => 79
21 => 80
20 => 81
19 => 82
18 => 83
17 => 84
16 => 85
15 => 86
14 => 87
13 => 88
12 => 89
11 => 90
10 => 91
9 => 92
8 => 93
7 => 94
6 => 95
5 => 96
4 => 97
3 => 98
2 => 99
1 => 100
===DONE===
+100 -100
View File
@@ -18,104 +18,104 @@ foreach ($h as $k => $o) {
===DONE===
<?php exit(0); ?>
--EXPECTF--
99 => 100
98 => 99
97 => 98
96 => 97
95 => 96
94 => 95
93 => 94
92 => 93
91 => 92
90 => 91
89 => 90
88 => 89
87 => 88
86 => 87
85 => 86
84 => 85
83 => 84
82 => 83
81 => 82
80 => 81
79 => 80
78 => 79
77 => 78
76 => 77
75 => 76
74 => 75
73 => 74
72 => 73
71 => 72
70 => 71
69 => 70
68 => 69
67 => 68
66 => 67
65 => 66
64 => 65
63 => 64
62 => 63
61 => 62
60 => 61
59 => 60
58 => 59
57 => 58
56 => 57
55 => 56
54 => 55
53 => 54
52 => 53
51 => 52
50 => 51
49 => 50
48 => 49
47 => 48
46 => 47
45 => 46
44 => 45
43 => 44
42 => 43
41 => 42
40 => 41
39 => 40
38 => 39
37 => 38
36 => 37
35 => 36
34 => 35
33 => 34
32 => 33
31 => 32
30 => 31
29 => 30
28 => 29
27 => 28
26 => 27
25 => 26
24 => 25
23 => 24
22 => 23
21 => 22
20 => 21
19 => 20
18 => 19
17 => 18
16 => 17
15 => 16
14 => 15
13 => 14
12 => 13
11 => 12
10 => 11
9 => 10
8 => 9
7 => 8
6 => 7
5 => 6
4 => 5
3 => 4
2 => 3
1 => 2
0 => 1
100 => 100
99 => 99
98 => 98
97 => 97
96 => 96
95 => 95
94 => 94
93 => 93
92 => 92
91 => 91
90 => 90
89 => 89
88 => 88
87 => 87
86 => 86
85 => 85
84 => 84
83 => 83
82 => 82
81 => 81
80 => 80
79 => 79
78 => 78
77 => 77
76 => 76
75 => 75
74 => 74
73 => 73
72 => 72
71 => 71
70 => 70
69 => 69
68 => 68
67 => 67
66 => 66
65 => 65
64 => 64
63 => 63
62 => 62
61 => 61
60 => 60
59 => 59
58 => 58
57 => 57
56 => 56
55 => 55
54 => 54
53 => 53
52 => 52
51 => 51
50 => 50
49 => 49
48 => 48
47 => 47
46 => 46
45 => 45
44 => 44
43 => 43
42 => 42
41 => 41
40 => 40
39 => 39
38 => 38
37 => 37
36 => 36
35 => 35
34 => 34
33 => 33
32 => 32
31 => 31
30 => 30
29 => 29
28 => 28
27 => 27
26 => 26
25 => 25
24 => 24
23 => 23
22 => 22
21 => 21
20 => 20
19 => 19
18 => 18
17 => 17
16 => 16
15 => 15
14 => 14
13 => 13
12 => 12
11 => 11
10 => 10
9 => 9
8 => 8
7 => 7
6 => 6
5 => 5
4 => 4
3 => 3
2 => 2
1 => 1
===DONE===
+12 -12
View File
@@ -63,34 +63,34 @@ foreach ($pq3 as $k=>$v) {
<?php exit(0); ?>
--EXPECTF--
Exception: Can't extract from an empty heap
2=>b
1=>a
0=>c
3=>b
2=>a
1=>c
EXTR_BOTH
2=>Array
3=>Array
(
[data] => b
[priority] => 2
)
1=>Array
2=>Array
(
[data] => a
[priority] => 1
)
0=>Array
1=>Array
(
[data] => c
[priority] => 0
)
EXTR_DATA
2=>b
1=>a
0=>c
3=>b
2=>a
1=>c
EXTR_PRIORITY
2=>2
1=>1
0=>0
3=>2
2=>1
1=>0
===DONE===
+2 -18
View File
@@ -1097,9 +1097,7 @@ PHPAPI char *_php_math_number_format(double d, int dec, char dec_point, char tho
return _php_math_number_format_ex(d, dec, &dec_point, 1, &thousand_sep, 1);
}
static char *_php_math_number_format_ex_len(double d, int dec, char *dec_point,
size_t dec_point_len, char *thousand_sep, size_t thousand_sep_len,
int *result_len)
PHPAPI char *_php_math_number_format_ex(double d, int dec, char *dec_point, size_t dec_point_len, char *thousand_sep, size_t thousand_sep_len)
{
char *tmpbuf = NULL, *resbuf;
char *s, *t; /* source, target */
@@ -1207,19 +1205,8 @@ static char *_php_math_number_format_ex_len(double d, int dec, char *dec_point,
efree(tmpbuf);
if (result_len) {
*result_len = reslen;
}
return resbuf;
}
PHPAPI char *_php_math_number_format_ex(double d, int dec, char *dec_point,
size_t dec_point_len, char *thousand_sep, size_t thousand_sep_len)
{
return _php_math_number_format_ex_len(d, dec, dec_point, dec_point_len,
thousand_sep, thousand_sep_len, NULL);
}
/* }}} */
/* {{{ proto string number_format(float number [, int num_decimal_places [, string dec_seperator, string thousands_seperator]])
@@ -1254,10 +1241,7 @@ PHP_FUNCTION(number_format)
thousand_sep_len = 1;
}
Z_TYPE_P(return_value) = IS_STRING;
Z_STRVAL_P(return_value) = _php_math_number_format_ex_len(num, dec,
dec_point, dec_point_len, thousand_sep, thousand_sep_len,
&Z_STRLEN_P(return_value));
RETURN_STRING(_php_math_number_format_ex(num, dec, dec_point, dec_point_len, thousand_sep, thousand_sep_len), 0);
break;
default:
WRONG_PARAM_COUNT;
+1 -1
View File
@@ -56,7 +56,7 @@
/* This symbol is defined in ext/standard/config.m4.
* Essentially, it is set if you HAVE_FORK || PHP_WIN32
* Other platforms may modify that configure check and add suitable #ifdefs
* Otherplatforms may modify that configure check and add suitable #ifdefs
* around the alternate code.
* */
#ifdef PHP_CAN_SUPPORT_PROC_OPEN
@@ -45,23 +45,23 @@ echo "Done";
*** Testing dir() : checking with wildcard characters ***
-- wildcard = '*' --
Warning: dir(%s/dir_var*,%s/dir_var*): %r(No such file or directory|The system cannot find the path specified. \(code: 3\))%r in %s on line %d
Warning: dir(%s/dir_var*,%s/dir_var*): No such file or directory in %s on line %d
Warning: dir(%s/dir_var*): failed to open dir: %s in %s on line %d
bool(false)
Warning: dir(%s/*,%s/*): %r(No such file or directory|The system cannot find the path specified. \(code: 3\))%r in %s on line %d
Warning: dir(%s/*,%s/*): No such file or directory in %s on line %d
Warning: dir(%s/*): failed to open dir: %s in %s on line %d
bool(false)
-- wildcard = '?' --
Warning: dir(%s/dir_variation81/sub_dir?,%s/dir_variation81/sub_dir?): %r(No such file or directory|The system cannot find the path specified. \(code: 3\))%r in %s on line %d
Warning: dir(%s/dir_variation81/sub_dir?,%s/dir_variation81/sub_dir?): No such file or directory in %s on line %d
Warning: dir(%s/dir_variation81/sub_dir?): failed to open dir: %s in %s on line %d
bool(false)
Warning: dir(%s/dir_variation81/sub?dir1,%s/dir_variation81/sub?dir1): %r(No such file or directory|The system cannot find the path specified. \(code: 3\))%r in %s on line %d
Warning: dir(%s/dir_variation81/sub?dir1,%s/dir_variation81/sub?dir1): No such file or directory in %s on line %d
Warning: dir(%s/dir_variation81/sub?dir1): failed to open dir: %s in %s on line %d
bool(false)
@@ -39,10 +39,7 @@ $arr = array("ggg", "ddd", "aaa", "sss");
//
// since we can't depend on PHP.ini being set a certain way,
// have to put the absolute path here.
$sysroot = exec('echo %SYSTEMROOT%');
$file_handle = popen("$sysroot/system32/sort", "w");
$file_handle = popen("/windows/system32/sort", "w");
$newline = "\n";
foreach($arr as $str) {
fwrite($file_handle, (binary)$str);
@@ -93,13 +93,13 @@ File created in => temp dir
Warning: tempnam() expects parameter 1 to be a valid path, string given in %stempnam_variation7-win32.php on line %d
-- File is not created --
Warning: unlink(): %r(Invalid argument|No such file or directory)%r in %s on line %d
Warning: unlink(): Invalid argument in %s on line %d
-- Iteration 7 --
Warning: tempnam() expects parameter 1 to be a valid path, array given in %s on line %d
-- File is not created --
Warning: unlink(): %r(Invalid argument|No such file or directory)%r in %s on line %d
Warning: unlink(): Invalid argument in %s on line %d
-- Iteration 8 --
File name is => %s%et%s
File permissions are => 100666
-10
View File
@@ -1,15 +1,5 @@
<?php
extension_loaded('imap') or die('skip imap extension not available in this build');
if( substr(PHP_OS, 0, 3) == 'WIN' && extension_loaded('sockets')) {
// be sure mail server is accessible... on PHP 5.3.13 release build, using test-pack PHP-5.3-r1af8b3f,
// the code below didn't skip test even though there was no mail server
// test then failed (no mail server to test against)
$socket = socket_create(AF_INET, SOCK_RAW, 1);
socket_set_option($socket, SOL_SOCKET, SO_RCVTIMEO, array('sec' => 10, 'usec' => 10));
// imap uses tcp port 143
socket_connect($socket, "localhost", 143) or die ("skip can't socket to mail server");
}
// Change these to make tests run successfully
$mailbox = '{localhost}';
Binary file not shown.
+1 -1
View File
@@ -6,7 +6,7 @@ tidy_diagnose()
<?php
$a = tidy_parse_string('<HTML></HTML>');
var_dump(tidy_diagnose($a));
echo str_replace("\r", "", tidy_get_error_buffer($a));
echo tidy_get_error_buffer($a);
$html = <<< HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
-2
View File
@@ -614,7 +614,6 @@ static char *_xmlwriter_get_valid_file_path(char *source, char *resolved_path, i
/* absolute file uris - libxml only supports localhost or empty host */
if (strncasecmp(source, "file:///", 8) == 0) {
if (source[sizeof("file:///") - 1] == '\0') {
xmlFreeURI(uri);
return NULL;
}
isFileUri = 1;
@@ -625,7 +624,6 @@ static char *_xmlwriter_get_valid_file_path(char *source, char *resolved_path, i
#endif
} else if (strncasecmp(source, "file://localhost/",17) == 0) {
if (source[sizeof("file://localhost/") - 1] == '\0') {
xmlFreeURI(uri);
return NULL;
}
+3 -3
View File
@@ -2,7 +2,7 @@
/* edit configure.in to change version number */
#define PHP_MAJOR_VERSION 5
#define PHP_MINOR_VERSION 4
#define PHP_RELEASE_VERSION 5
#define PHP_EXTRA_VERSION "-dev"
#define PHP_VERSION "5.4.5-dev"
#define PHP_RELEASE_VERSION 4
#define PHP_EXTRA_VERSION ""
#define PHP_VERSION "5.4.4"
#define PHP_VERSION_ID 50404
+2 -2
View File
@@ -751,7 +751,7 @@ enable_dl = Off
; will look for to know it is OK to continue execution. Setting this variable MAY
; cause security issues, KNOW WHAT YOU ARE DOING FIRST.
; http://php.net/cgi.redirect-status-env
;cgi.redirect_status_env =
;cgi.redirect_status_env = ;
; cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI. PHP's
; previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not grok
@@ -768,7 +768,7 @@ enable_dl = Off
; does not currently support this feature (03/17/2002)
; Set to 1 if running under IIS. Default is zero.
; http://php.net/fastcgi.impersonate
;fastcgi.impersonate = 1
;fastcgi.impersonate = 1;
; Disable logging through FastCGI connection. PHP's default behavior is to enable
; this feature.
+2 -2
View File
@@ -751,7 +751,7 @@ enable_dl = Off
; will look for to know it is OK to continue execution. Setting this variable MAY
; cause security issues, KNOW WHAT YOU ARE DOING FIRST.
; http://php.net/cgi.redirect-status-env
;cgi.redirect_status_env =
;cgi.redirect_status_env = ;
; cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI. PHP's
; previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not grok
@@ -768,7 +768,7 @@ enable_dl = Off
; does not currently support this feature (03/17/2002)
; Set to 1 if running under IIS. Default is zero.
; http://php.net/fastcgi.impersonate
;fastcgi.impersonate = 1
;fastcgi.impersonate = 1;
; Disable logging through FastCGI connection. PHP's default behavior is to enable
; this feature.
+4 -1
View File
@@ -239,7 +239,10 @@ $ini_overwrites = array(
'magic_quotes_runtime=0',
'ignore_repeated_errors=0',
'precision=14',
'memory_limit=128M',
'unicode.runtime_encoding=ISO-8859-1',
'unicode.script_encoding=UTF-8',
'unicode.output_encoding=UTF-8',
'unicode.from_error_mode=U_INVALID_SUBSTITUTE',
);
function write_information($show_html)
+1 -3
View File
@@ -1,7 +1,5 @@
--TEST--
apache_request_headers() stack overflow.
--INI--
default_charset="UTF-8"
--SKIPIF--
<?php
include "skipif.inc";
@@ -31,7 +29,7 @@ echo "Done\n";
?>
--EXPECTF--
X-Powered-By: PHP/%s
Content-type: text/html; charset=UTF-8
Content-type: text/html
Array
(
+1 -10
View File
@@ -2,22 +2,13 @@
Bug #61546 (functions related to current script failed when chdir() in cli sapi)
--FILE--
<?php
// reference doc for getmyinode() on php.net states that it returns an integer or FALSE on error
// on Windows, getmyinode() returns 0 which normally casts to FALSE
// however, the implementation of getmyinode() (in pageinfo.c) returns an explicit FALSE in the
// event that the internal page_inode structure is less than 0, otherwise it returns the long value
// of page_inode. therefore, an explicit 0 should be a passing value for this test.
//
// the ext/standard/tests/file/statpage.phpt test also tests getmyinode() returns an integer and will
// pass even if that integer is 0. on Windows, the getmyinode() call in statpage.phpt returns 0 and
// passes on Windows.
$php = getenv("TEST_PHP_EXECUTABLE");
$test_code = <<<PHP
<?php
chdir('..');
var_dump(get_current_user() != "");
chdir('..');
var_dump(getmyinode() !== false);
var_dump(getmyinode() != false);
var_dump(getlastmod() != false);
PHP;
-5
View File
@@ -16,7 +16,6 @@ AC_DEFUN([AC_FPM_STDLIBS],
AC_CHECK_HEADERS([errno.h fcntl.h stdio.h stdlib.h unistd.h sys/uio.h])
AC_CHECK_HEADERS([sys/select.h sys/socket.h sys/time.h])
AC_CHECK_HEADERS([arpa/inet.h netinet/in.h])
AC_CHECK_HEADERS([sysexits.h])
])
AC_DEFUN([AC_FPM_PRCTL],
@@ -193,8 +192,6 @@ AC_DEFUN([AC_FPM_TRACE],
have_ptrace=no
have_broken_ptrace=yes
AC_MSG_RESULT([no])
], [
AC_MSG_RESULT([skipped (cross compiling)])
])
fi
@@ -267,8 +264,6 @@ AC_DEFUN([AC_FPM_TRACE],
], [
proc_mem_file=""
AC_MSG_RESULT([no])
], [
AC_MSG_RESULT([skipped (cross compiling)])
])
fi
+5 -9
View File
@@ -399,7 +399,7 @@ static inline int fcgi_param_get_eff_len( unsigned char *p, unsigned char *end,
{
int ret = 1;
int zero_found = 0;
*eff_len = 0;
*eff_len = 0;
for (; p != end; ++p) {
if (*p == '\0') {
zero_found = 1;
@@ -427,7 +427,7 @@ static int fcgi_get_params(fcgi_request *req, unsigned char *p, unsigned char *e
char *tmp = buf;
size_t buf_size = sizeof(buf);
int name_len, val_len;
uint eff_name_len;
uint eff_name_len, eff_val_len;
char *s;
int ret = 1;
size_t bytes_consumed;
@@ -453,12 +453,8 @@ static int fcgi_get_params(fcgi_request *req, unsigned char *p, unsigned char *e
ret = 0;
break;
}
/*
* get the effective length of the name in case it's not a valid string
* don't do this on the value because it can be binary data
*/
if (!fcgi_param_get_eff_len(p, p+name_len, &eff_name_len)){
if (!fcgi_param_get_eff_len(p, p+name_len, &eff_name_len) ||
!fcgi_param_get_eff_len(p+name_len, p+name_len+val_len, &eff_val_len)) {
/* Malicious request */
ret = 0;
break;
@@ -477,7 +473,7 @@ static int fcgi_get_params(fcgi_request *req, unsigned char *p, unsigned char *e
}
memcpy(tmp, p, eff_name_len);
tmp[eff_name_len] = 0;
s = estrndup((char*)p + name_len, val_len);
s = estrndup((char*)p + name_len, eff_val_len);
if (s == NULL) {
ret = 0;
break;
+3 -6
View File
@@ -37,12 +37,10 @@ struct fpm_globals_s fpm_globals = {
.max_requests = 0,
.is_child = 0,
.test_successful = 0,
.heartbeat = 0,
.run_as_root = 0,
.send_config_signal = 0,
.heartbeat = 0
};
int fpm_init(int argc, char **argv, char *config, char *prefix, char *pid, int test_conf, int run_as_root) /* {{{ */
int fpm_init(int argc, char **argv, char *config, char *prefix, char *pid, int test_conf) /* {{{ */
{
fpm_globals.argc = argc;
fpm_globals.argv = argv;
@@ -51,7 +49,6 @@ int fpm_init(int argc, char **argv, char *config, char *prefix, char *pid, int t
}
fpm_globals.prefix = prefix;
fpm_globals.pid = pid;
fpm_globals.run_as_root = run_as_root;
if (0 > fpm_php_init_main() ||
0 > fpm_stdio_init_main() ||
@@ -67,7 +64,7 @@ int fpm_init(int argc, char **argv, char *config, char *prefix, char *pid, int t
0 > fpm_event_init_main()) {
if (fpm_globals.test_successful) {
exit(FPM_EXIT_OK);
exit(0);
} else {
zlog(ZLOG_ERROR, "FPM initialization failed");
return -1;
+1 -32
View File
@@ -7,37 +7,8 @@
#include <unistd.h>
#ifdef HAVE_SYSEXITS_H
#include <sysexits.h>
#endif
#ifdef EX_OK
#define FPM_EXIT_OK EX_OK
#else
#define FPM_EXIT_OK 0
#endif
#ifdef EX_USAGE
#define FPM_EXIT_USAGE EX_USAGE
#else
#define FPM_EXIT_USAGE 64
#endif
#ifdef EX_SOFTWARE
#define FPM_EXIT_SOFTWARE EX_SOFTWARE
#else
#define FPM_EXIT_SOFTWARE 70
#endif
#ifdef EX_CONFIG
#define FPM_EXIT_CONFIG EX_CONFIG
#else
#define FPM_EXIT_CONFIG 78
#endif
int fpm_run(int *max_requests);
int fpm_init(int argc, char **argv, char *config, char *prefix, char *pid, int test_conf, int run_as_root);
int fpm_init(int argc, char **argv, char *config, char *prefix, char *pid, int test_conf);
struct fpm_globals_s {
pid_t parent_pid;
@@ -54,8 +25,6 @@ struct fpm_globals_s {
int is_child;
int test_successful;
int heartbeat;
int run_as_root;
int send_config_signal;
};
extern struct fpm_globals_s fpm_globals;
+2 -2
View File
@@ -156,7 +156,7 @@ static void fpm_child_init(struct fpm_worker_pool_s *wp) /* {{{ */
0 > fpm_php_init_child(wp)) {
zlog(ZLOG_ERROR, "[pool %s] child failed to initialize", wp->config->name);
exit(FPM_EXIT_SOFTWARE);
exit(255);
}
}
/* }}} */
@@ -198,7 +198,7 @@ void fpm_children_bury() /* {{{ */
restart_child = 0;
}
if (WEXITSTATUS(status) != FPM_EXIT_OK) {
if (WEXITSTATUS(status) != 0) {
severity = ZLOG_WARNING;
}
+3 -41
View File
@@ -70,7 +70,6 @@ struct fpm_global_config_s fpm_global_config = {
.syslog_facility = -1,
#endif
.process_max = 0,
.process_priority = 64, /* 64 means unset */
};
static struct fpm_worker_pool_s *current_wp = NULL;
static int ini_recursion = 0;
@@ -93,7 +92,6 @@ static struct ini_value_parser_s ini_fpm_global_options[] = {
{ "emergency_restart_interval", &fpm_conf_set_time, GO(emergency_restart_interval) },
{ "process_control_timeout", &fpm_conf_set_time, GO(process_control_timeout) },
{ "process.max", &fpm_conf_set_integer, GO(process_max) },
{ "process.priority", &fpm_conf_set_integer, GO(process_priority) },
{ "daemonize", &fpm_conf_set_boolean, GO(daemonize) },
{ "rlimit_files", &fpm_conf_set_integer, GO(rlimit_files) },
{ "rlimit_core", &fpm_conf_set_rlimit_core, GO(rlimit_core) },
@@ -114,7 +112,6 @@ static struct ini_value_parser_s ini_fpm_pool_options[] = {
{ "listen.group", &fpm_conf_set_string, WPO(listen_group) },
{ "listen.mode", &fpm_conf_set_string, WPO(listen_mode) },
{ "listen.allowed_clients", &fpm_conf_set_string, WPO(listen_allowed_clients) },
{ "process.priority", &fpm_conf_set_integer, WPO(process_priority) },
{ "pm", &fpm_conf_set_pm, WPO(pm) },
{ "pm.max_children", &fpm_conf_set_integer, WPO(pm_max_children) },
{ "pm.start_servers", &fpm_conf_set_integer, WPO(pm_start_servers) },
@@ -580,7 +577,6 @@ static void *fpm_worker_pool_config_alloc() /* {{{ */
memset(wp->config, 0, sizeof(struct fpm_worker_pool_config_s));
wp->config->listen_backlog = FPM_BACKLOG_DEFAULT;
wp->config->pm_process_idle_timeout = 10; /* 10s by default */
wp->config->process_priority = 64; /* 64 means unset */
if (!fpm_worker_all_pools) {
fpm_worker_all_pools = wp;
@@ -708,7 +704,7 @@ static int fpm_evaluate_full_path(char **path, struct fpm_worker_pool_s *wp, cha
static int fpm_conf_process_all_pools() /* {{{ */
{
struct fpm_worker_pool_s *wp, *wp2;
struct fpm_worker_pool_s *wp;
if (!fpm_worker_all_pools) {
zlog(ZLOG_ERROR, "No pool defined. at least one pool section must be specified in config file");
@@ -727,8 +723,8 @@ static int fpm_conf_process_all_pools() /* {{{ */
}
}
/* alert if user is not set only if we are not root*/
if (!wp->config->user && !geteuid()) {
/* user */
if (!wp->config->user) {
zlog(ZLOG_ALERT, "[pool %s] user has not been defined", wp->config->name);
return -1;
}
@@ -745,11 +741,6 @@ static int fpm_conf_process_all_pools() /* {{{ */
return -1;
}
if (wp->config->process_priority != 64 && (wp->config->process_priority < -19 || wp->config->process_priority > 20)) {
zlog(ZLOG_ERROR, "[pool %s] process.priority must be included into [-19,20]", wp->config->name);
return -1;
}
/* pm */
if (wp->config->pm != PM_STYLE_STATIC && wp->config->pm != PM_STYLE_DYNAMIC && wp->config->pm != PM_STYLE_ONDEMAND) {
zlog(ZLOG_ALERT, "[pool %s] the process manager is missing (static, dynamic or ondemand)", wp->config->name);
@@ -1053,20 +1044,6 @@ static int fpm_conf_process_all_pools() /* {{{ */
}
}
}
/* ensure 2 pools do not use the same listening address */
for (wp = fpm_worker_all_pools; wp; wp = wp->next) {
for (wp2 = fpm_worker_all_pools; wp2; wp2 = wp2->next) {
if (wp == wp2) {
continue;
}
if (wp->config->listen_address && *wp->config->listen_address && wp2->config->listen_address && *wp2->config->listen_address && !strcmp(wp->config->listen_address, wp2->config->listen_address)) {
zlog(ZLOG_ERROR, "[pool %s] unable to set listen address as it's already used in another pool '%s'", wp2->config->name, wp->config->name);
return -1;
}
}
}
return 0;
}
/* }}} */
@@ -1126,11 +1103,6 @@ static int fpm_conf_post_process(TSRMLS_D) /* {{{ */
return -1;
}
if (fpm_global_config.process_priority != 64 && (fpm_global_config.process_priority < -19 || fpm_global_config.process_priority > 20)) {
zlog(ZLOG_ERROR, "process.priority must be included into [-19,20]");
return -1;
}
if (!fpm_global_config.error_log) {
fpm_global_config.error_log = strdup("log/php-fpm.log");
}
@@ -1513,11 +1485,6 @@ static void fpm_conf_dump() /* {{{ */
zlog(ZLOG_NOTICE, "\temergency_restart_threshold = %d", fpm_global_config.emergency_restart_threshold);
zlog(ZLOG_NOTICE, "\tprocess_control_timeout = %ds", fpm_global_config.process_control_timeout);
zlog(ZLOG_NOTICE, "\tprocess.max = %d", fpm_global_config.process_max);
if (fpm_global_config.process_priority == 64) {
zlog(ZLOG_NOTICE, "\tprocess.priority = undefined");
} else {
zlog(ZLOG_NOTICE, "\tprocess.priority = %d", fpm_global_config.process_priority);
}
zlog(ZLOG_NOTICE, "\tdaemonize = %s", BOOL2STR(fpm_global_config.daemonize));
zlog(ZLOG_NOTICE, "\trlimit_files = %d", fpm_global_config.rlimit_files);
zlog(ZLOG_NOTICE, "\trlimit_core = %d", fpm_global_config.rlimit_core);
@@ -1537,11 +1504,6 @@ static void fpm_conf_dump() /* {{{ */
zlog(ZLOG_NOTICE, "\tlisten.group = %s", STR2STR(wp->config->listen_group));
zlog(ZLOG_NOTICE, "\tlisten.mode = %s", STR2STR(wp->config->listen_mode));
zlog(ZLOG_NOTICE, "\tlisten.allowed_clients = %s", STR2STR(wp->config->listen_allowed_clients));
if (wp->config->process_priority == 64) {
zlog(ZLOG_NOTICE, "\tprocess.priority = undefined");
} else {
zlog(ZLOG_NOTICE, "\tprocess.priority = %d", wp->config->process_priority);
}
zlog(ZLOG_NOTICE, "\tpm = %s", PM2STR(wp->config->pm));
zlog(ZLOG_NOTICE, "\tpm.max_children = %d", wp->config->pm_max_children);
zlog(ZLOG_NOTICE, "\tpm.start_servers = %d", wp->config->pm_start_servers);
-2
View File
@@ -35,7 +35,6 @@ struct fpm_global_config_s {
int emergency_restart_interval;
int process_control_timeout;
int process_max;
int process_priority;
int daemonize;
int rlimit_files;
int rlimit_core;
@@ -58,7 +57,6 @@ struct fpm_worker_pool_config_s {
char *listen_group;
char *listen_mode;
char *listen_allowed_clients;
int process_priority;
int pm;
int pm_max_children;
int pm_start_servers;
+26 -64
View File
@@ -154,7 +154,6 @@ static const opt_struct OPTIONS[] = {
{'t', 0, "test"},
{'p', 1, "prefix"},
{'g', 1, "pid"},
{'R', 0, "allow-to-run-as-root"},
{'-', 0, NULL} /* end of args */
};
@@ -647,38 +646,12 @@ static void sapi_cgi_register_variables(zval *track_vars_array TSRMLS_DC)
}
}
/* {{{ sapi_cgi_log_fastcgi
*
* Ignore level, we want to send all messages through fastcgi
*/
void sapi_cgi_log_fastcgi(int level, char *message, size_t len)
static void sapi_cgi_log_message(char *message TSRMLS_DC)
{
TSRMLS_FETCH();
fcgi_request *request = (fcgi_request*) SG(server_context);
/* ensure we want:
* - to log (fastcgi.logging in php.ini)
* - we are currently dealing with a request
* - the message is not empty
*/
if (CGIG(fcgi_logging) && request && message && len > 0) {
char *buf = malloc(len + 2);
memcpy(buf, message, len);
memcpy(buf + len, "\n", sizeof("\n"));
fcgi_write(request, FCGI_STDERR, buf, len+1);
free(buf);
if (CGIG(fcgi_logging)) {
zlog(ZLOG_NOTICE, "PHP message: %s", message);
}
}
/* }}} */
/* {{{ sapi_cgi_log_message
*/
static void sapi_cgi_log_message(char *message)
{
zlog(ZLOG_NOTICE, "PHP message: %s", message);
}
/* }}} */
/* {{{ php_cgi_ini_activate_user_config
*/
@@ -927,9 +900,7 @@ static void php_cgi_usage(char *argv0)
" Specify the PID file location.\n"
" -y, --fpm-config <file>\n"
" Specify alternative path to FastCGI process manager config file.\n"
" -t, --test Test FPM configuration and exit\n"
" -R, --allow-to-run-as-root\n"
" Allow pool to run as root (disabled by default)\n",
" -t, --test Test FPM configuration and exit\n",
prog, PHP_PREFIX);
}
/* }}} */
@@ -1528,7 +1499,7 @@ static zend_module_entry cgi_module_entry = {
*/
int main(int argc, char *argv[])
{
int exit_status = FPM_EXIT_OK;
int exit_status = SUCCESS;
int cgi = 0, c, use_extended_info = 0;
zend_file_handle file_handle;
@@ -1551,7 +1522,6 @@ int main(int argc, char *argv[])
char *fpm_pid = NULL;
int test_conf = 0;
int php_information = 0;
int php_allow_to_run_as_root = 0;
#ifdef HAVE_SIGNAL_H
#if defined(SIGPIPE) && defined(SIG_IGN)
@@ -1659,17 +1629,13 @@ int main(int argc, char *argv[])
php_output_end_all(TSRMLS_C);
php_output_deactivate(TSRMLS_C);
fcgi_shutdown();
exit_status = FPM_EXIT_OK;
exit_status = 0;
goto out;
case 'i': /* php info & quit */
php_information = 1;
break;
case 'R': /* allow to run as root */
php_allow_to_run_as_root = 1;
break;
default:
case 'h':
case '?':
@@ -1680,7 +1646,7 @@ int main(int argc, char *argv[])
php_output_end_all(TSRMLS_C);
php_output_deactivate(TSRMLS_C);
fcgi_shutdown();
exit_status = (c == 'h') ? FPM_EXIT_OK : FPM_EXIT_USAGE;
exit_status = 0;
goto out;
case 'v': /* show php version & quit */
@@ -1688,7 +1654,7 @@ int main(int argc, char *argv[])
if (php_request_startup(TSRMLS_C) == FAILURE) {
SG(server_context) = NULL;
php_module_shutdown(TSRMLS_C);
return FPM_EXIT_SOFTWARE;
return FAILURE;
}
SG(headers_sent) = 1;
SG(request_info).no_headers = 1;
@@ -1700,7 +1666,7 @@ int main(int argc, char *argv[])
#endif
php_request_shutdown((void *) 0);
fcgi_shutdown();
exit_status = FPM_EXIT_OK;
exit_status = 0;
goto out;
}
}
@@ -1711,14 +1677,14 @@ int main(int argc, char *argv[])
if (php_request_startup(TSRMLS_C) == FAILURE) {
SG(server_context) = NULL;
php_module_shutdown(TSRMLS_C);
return FPM_EXIT_SOFTWARE;
return FAILURE;
}
SG(headers_sent) = 1;
SG(request_info).no_headers = 1;
php_print_info(0xFFFFFFFF TSRMLS_CC);
php_request_shutdown((void *) 0);
fcgi_shutdown();
exit_status = FPM_EXIT_OK;
exit_status = 0;
goto out;
}
@@ -1731,7 +1697,7 @@ int main(int argc, char *argv[])
php_output_end_all(TSRMLS_C);
php_output_deactivate(TSRMLS_C);
fcgi_shutdown();
exit_status = FPM_EXIT_USAGE;
exit_status = 0;
goto out;
}
@@ -1750,7 +1716,7 @@ int main(int argc, char *argv[])
#ifdef ZTS
tsrm_shutdown();
#endif
return FPM_EXIT_SOFTWARE;
return FAILURE;
}
if (use_extended_info) {
@@ -1793,31 +1759,19 @@ consult the installation file that came with this distribution, or visit \n\
*/
tsrm_shutdown();
#endif
return FPM_EXIT_SOFTWARE;
return FAILURE;
}
}
if (0 > fpm_init(argc, argv, fpm_config ? fpm_config : CGIG(fpm_config), fpm_prefix, fpm_pid, test_conf, php_allow_to_run_as_root)) {
if (fpm_globals.send_config_signal) {
zlog(ZLOG_DEBUG, "Sending SIGUSR2 (error) to parent %d", getppid());
kill(getppid(), SIGUSR2);
}
return FPM_EXIT_CONFIG;
if (0 > fpm_init(argc, argv, fpm_config ? fpm_config : CGIG(fpm_config), fpm_prefix, fpm_pid, test_conf)) {
return FAILURE;
}
if (fpm_globals.send_config_signal) {
zlog(ZLOG_DEBUG, "Sending SIGUSR1 (OK) to parent %d", getppid());
kill(getppid(), SIGUSR1);
}
fpm_is_running = 1;
fcgi_fd = fpm_run(&max_requests);
parent = 0;
/* onced forked tell zlog to also send messages through sapi_cgi_log_fastcgi() */
zlog_set_external_logger(sapi_cgi_log_fastcgi);
/* make php call us to get _ENV vars */
php_php_import_environment_variables = php_import_environment_variables;
php_import_environment_variables = cgi_php_import_environment_variables;
@@ -1841,7 +1795,7 @@ consult the installation file that came with this distribution, or visit \n\
fcgi_finish_request(&request, 1);
SG(server_context) = NULL;
php_module_shutdown(TSRMLS_C);
return FPM_EXIT_SOFTWARE;
return FAILURE;
}
/* check if request_method has been sent.
@@ -1929,9 +1883,17 @@ fastcgi_request_done:
php_request_shutdown((void *) 0);
if (exit_status == 0) {
exit_status = EG(exit_status);
}
requests++;
if (max_requests && (requests == max_requests)) {
fcgi_finish_request(&request, 1);
if (max_requests != 1) {
/* no need to return exit_status of the last request */
exit_status = 0;
}
break;
}
/* end of fastcgi loop */
@@ -1945,7 +1907,7 @@ fastcgi_request_done:
free(cgi_sapi_module.ini_entries);
}
} zend_catch {
exit_status = FPM_EXIT_SOFTWARE;
exit_status = 255;
} zend_end_try();
out:
+2 -2
View File
@@ -71,7 +71,7 @@ static void fpm_pctl_exit() /* {{{ */
fpm_conf_unlink_pid();
fpm_cleanups_run(FPM_CLEANUP_PARENT_EXIT_MAIN);
exit(FPM_EXIT_OK);
exit(0);
}
/* }}} */
@@ -100,7 +100,7 @@ static void fpm_pctl_exec() /* {{{ */
fpm_cleanups_run(FPM_CLEANUP_PARENT_EXEC);
execvp(saved_argv[0], saved_argv);
zlog(ZLOG_SYSERROR, "failed to reload: execvp() failed");
exit(FPM_EXIT_SOFTWARE);
exit(1);
}
/* }}} */
-12
View File
@@ -249,15 +249,3 @@ int fpm_signals_get_fd() /* {{{ */
}
/* }}} */
void fpm_signals_sighandler_exit_ok(pid_t pid) /* {{{ */
{
exit(FPM_EXIT_OK);
}
/* }}} */
void fpm_signals_sighandler_exit_config(pid_t pid) /* {{{ */
{
exit(FPM_EXIT_CONFIG);
}
/* }}} */
-3
View File
@@ -11,9 +11,6 @@ int fpm_signals_init_main();
int fpm_signals_init_child();
int fpm_signals_get_fd();
void fpm_signals_sighandler_exit_ok(pid_t pid);
void fpm_signals_sighandler_exit_config(pid_t pid);
extern const char *fpm_signal_names[NSIG + 1];
#endif
-25
View File
@@ -179,10 +179,6 @@ static int fpm_sockets_new_listening_socket(struct fpm_worker_pool_s *wp, struct
setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &flags, sizeof(flags));
if (wp->listen_address_domain == FPM_AF_UNIX) {
if (fpm_socket_unix_test_connect((struct sockaddr_un *)sa, socklen) == 0) {
zlog(ZLOG_ERROR, "An another FPM instance seems to already listen on %s", ((struct sockaddr_un *) sa)->sun_path);
return -1;
}
unlink( ((struct sockaddr_un *) sa)->sun_path);
saved_umask = umask(0777 ^ wp->socket_mode);
}
@@ -454,24 +450,3 @@ int fpm_socket_get_listening_queue(int sock, unsigned *cur_lq, unsigned *max_lq)
}
#endif
int fpm_socket_unix_test_connect(struct sockaddr_un *sun, size_t socklen) /* {{{ */
{
int fd;
if (!sun || sun->sun_family != AF_UNIX) {
return -1;
}
if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
return -1;
}
if (connect(fd, (struct sockaddr *)sun, socklen) == -1) {
return -1;
}
close(fd);
return 0;
}
/* }}} */
-3
View File
@@ -5,8 +5,6 @@
#ifndef FPM_MISC_H
#define FPM_MISC_H 1
#include <sys/types.h>
#include <sys/socket.h>
#include <unistd.h>
#include <fcntl.h>
@@ -24,7 +22,6 @@
enum fpm_address_domain fpm_sockets_domain_from_address(char *addr);
int fpm_sockets_init_main();
int fpm_socket_get_listening_queue(int sock, unsigned *cur_lq, unsigned *max_lq);
int fpm_socket_unix_test_connect(struct sockaddr_un *sun, size_t socklen);
static inline int fd_set_blocked(int fd, int blocked) /* {{{ */
+10 -92
View File
@@ -23,7 +23,6 @@
#include "fpm_clock.h"
#include "fpm_stdio.h"
#include "fpm_unix.h"
#include "fpm_signals.h"
#include "zlog.h"
size_t fpm_pagesize;
@@ -113,12 +112,12 @@ static int fpm_unix_conf_wp(struct fpm_worker_pool_s *wp) /* {{{ */
}
}
if (!fpm_globals.run_as_root) {
if (wp->set_uid == 0 || wp->set_gid == 0) {
zlog(ZLOG_ERROR, "[pool %s] please specify user and group other than root", wp->config->name);
return -1;
}
#ifndef I_REALLY_WANT_ROOT_PHP
if (wp->set_uid == 0 || wp->set_gid == 0) {
zlog(ZLOG_ERROR, "[pool %s] please specify user and group other than root", wp->config->name);
return -1;
}
#endif
} else { /* not root */
if (wp->config->user && *wp->config->user) {
zlog(ZLOG_WARNING, "[pool %s] 'user' directive is ignored when FPM is not running as root", wp->config->name);
@@ -129,9 +128,6 @@ static int fpm_unix_conf_wp(struct fpm_worker_pool_s *wp) /* {{{ */
if (wp->config->chroot && *wp->config->chroot) {
zlog(ZLOG_WARNING, "[pool %s] 'chroot' directive is ignored when FPM is not running as root", wp->config->name);
}
if (wp->config->process_priority != 64) {
zlog(ZLOG_WARNING, "[pool %s] 'process.priority' directive is ignored when FPM is not running as root", wp->config->name);
}
/* set up HOME and USER anyway */
pwd = getpwuid(getuid());
@@ -187,14 +183,6 @@ int fpm_unix_init_child(struct fpm_worker_pool_s *wp) /* {{{ */
}
if (is_root) {
if (wp->config->process_priority != 64) {
if (setpriority(PRIO_PROCESS, 0, wp->config->process_priority) < 0) {
zlog(ZLOG_SYSERROR, "[pool %s] Unable to set priority for this new process", wp->config->name);
return -1;
}
}
if (wp->set_gid) {
if (0 > setgid(wp->set_gid)) {
zlog(ZLOG_SYSERROR, "[pool %s] failed to setgid(%d)", wp->config->name, wp->set_gid);
@@ -229,7 +217,6 @@ int fpm_unix_init_child(struct fpm_worker_pool_s *wp) /* {{{ */
int fpm_unix_init_main() /* {{{ */
{
struct fpm_worker_pool_s *wp;
int is_root = !geteuid();
if (fpm_global_config.rlimit_files) {
struct rlimit r;
@@ -255,92 +242,23 @@ int fpm_unix_init_main() /* {{{ */
fpm_pagesize = getpagesize();
if (fpm_global_config.daemonize) {
/*
* If daemonize, the calling process will die soon
* and the master process continues to initialize itself.
*
* The parent process has then to wait for the master
* process to initialize to return a consistent exit
* value. For this pupose, the master process will
* send USR1 if everything went well and USR2
* otherwise.
*/
struct sigaction act;
struct sigaction oldact_usr1;
struct sigaction oldact_usr2;
struct timeval tv;
/*
* set sigaction for USR1 before fork
* save old sigaction to restore it after
* fork in the child process (the master process)
*/
memset(&act, 0, sizeof(act));
memset(&act, 0, sizeof(oldact_usr1));
act.sa_handler = fpm_signals_sighandler_exit_ok;
sigfillset(&act.sa_mask);
sigaction(SIGUSR1, &act, &oldact_usr1);
/*
* set sigaction for USR2 before fork
* save old sigaction to restore it after
* fork in the child process (the master process)
*/
memset(&act, 0, sizeof(act));
memset(&act, 0, sizeof(oldact_usr2));
act.sa_handler = fpm_signals_sighandler_exit_config;
sigfillset(&act.sa_mask);
sigaction(SIGUSR2, &act, &oldact_usr2);
/* then fork */
pid_t pid = fork();
switch (pid) {
case -1 : /* error */
switch (fork()) {
case -1 :
zlog(ZLOG_SYSERROR, "failed to daemonize");
return -1;
case 0 : /* children */
/* restore USR1 and USR2 sigaction */
sigaction(SIGUSR1, &oldact_usr1, NULL);
sigaction(SIGUSR2, &oldact_usr2, NULL);
fpm_globals.send_config_signal = 1;
case 0 :
break;
default : /* parent */
default :
fpm_cleanups_run(FPM_CLEANUP_PARENT_EXIT);
/*
* wait for 10s before exiting with error
* the child is supposed to send USR1 or USR2 to tell the parent
* how it goes for it
*/
tv.tv_sec = 10;
tv.tv_usec = 0;
zlog(ZLOG_DEBUG, "The calling process is waiting for the master process to ping");
select(0, NULL, NULL, NULL, &tv);
exit(FPM_EXIT_SOFTWARE);
exit(0);
}
}
/* continue as a child */
setsid();
if (0 > fpm_clock_init()) {
return -1;
}
if (fpm_global_config.process_priority != 64) {
if (is_root) {
if (setpriority(PRIO_PROCESS, 0, fpm_global_config.process_priority) < 0) {
zlog(ZLOG_SYSERROR, "Unable to set priority for the master process");
return -1;
}
} else {
zlog(ZLOG_WARNING, "'process.priority' directive is ignored when FPM is not running as root");
}
}
fpm_globals.parent_pid = getpid();
for (wp = fpm_worker_all_pools; wp; wp = wp->next) {
if (0 > fpm_unix_conf_wp(wp)) {
-20
View File
@@ -22,7 +22,6 @@
static int zlog_fd = -1;
static int zlog_level = ZLOG_NOTICE;
static int launched = 0;
static void (*external_logger)(int, char *, size_t) = NULL;
static const char *level_names[] = {
[ZLOG_DEBUG] = "DEBUG",
@@ -42,12 +41,6 @@ const int syslog_priorities[] = {
};
#endif
void zlog_set_external_logger(void (*logger)(int, char *, size_t)) /* {{{ */
{
external_logger = logger;
}
/* }}} */
const char *zlog_get_level_name(int log_level) /* {{{ */
{
if (log_level < 0) {
@@ -108,19 +101,6 @@ void zlog_ex(const char *function, int line, int flags, const char *fmt, ...) /*
int truncated = 0;
int saved_errno;
if (external_logger) {
va_start(args, fmt);
len = vsnprintf(buf, buf_size, fmt, args);
va_end(args);
if (len >= buf_size) {
memcpy(buf + buf_size - sizeof("..."), "...", sizeof("...") - 1);
len = buf_size - 1;
}
external_logger(flags & ZLOG_LEVEL_MASK, buf, len);
len = 0;
memset(buf, '\0', buf_size);
}
if ((flags & ZLOG_LEVEL_MASK) < zlog_level) {
return;
}
-1
View File
@@ -9,7 +9,6 @@
struct timeval;
void zlog_set_external_logger(void (*logger)(int, char *, size_t));
int zlog_set_fd(int new_fd);
int zlog_set_level(int new_value);
const char *zlog_get_level_name(int log_level);
-16
View File
@@ -76,14 +76,6 @@
; Default Value: 0
; process.max = 128
; Specify the nice(2) priority to apply to the master process (only if set)
; The value can vary from -19 (highest priority) to 20 (lower priority)
; Note: - It will only work if the FPM master process is launched as root
; - The pool process will inherit the master process priority
; unless it specified otherwise
; Default Value: no set
; process.priority = -19
; Send FPM to background. Set to 'no' to keep FPM in foreground for debugging.
; Default Value: yes
;daemonize = yes
@@ -171,14 +163,6 @@ listen = 127.0.0.1:9000
; Default Value: any
;listen.allowed_clients = 127.0.0.1
; Specify the nice(2) priority to apply to the pool processes (only if set)
; The value can vary from -19 (highest priority) to 20 (lower priority)
; Note: - It will only work if the FPM master process is launched as root
; - The pool processes will inherit the master process priority
; unless it specified otherwise
; Default Value: no set
; priority = -19
; Choose how the process manager will control the number of child processes.
; Possible Values:
; static - a fixed number (pm.max_children) of child processes;
+2 -10
View File
@@ -77,16 +77,11 @@ static int LoadDirectory(HashTable *directories, HKEY key, char *path, int path_
value_len = max_value+1;
if (RegEnumValue(key, i, name, &name_len, NULL, &type, value, &value_len) == ERROR_SUCCESS) {
if ((type == REG_SZ) || (type == REG_EXPAND_SZ)) {
ht = (HashTable*)malloc(sizeof(HashTable));
if (!ht) {
return ret;
ht = (HashTable*)malloc(sizeof(HashTable));
zend_hash_init(ht, 0, NULL, ZVAL_INTERNAL_PTR_DTOR, 1);
}
zend_hash_init(ht, 0, NULL, ZVAL_INTERNAL_PTR_DTOR, 1);
data = (zval*)malloc(sizeof(zval));
if (!data) {
return ret;
}
INIT_PZVAL(data);
Z_STRVAL_P(data) = zend_strndup(value, value_len-1);
Z_STRLEN_P(data) = value_len-1;
@@ -179,9 +174,6 @@ void UpdateIniFromRegistry(char *path TSRMLS_DC)
if (!PW32G(registry_directories)) {
PW32G(registry_directories) = (HashTable*)malloc(sizeof(HashTable));
if (!PW32G(registry_directories)) {
return;
}
zend_hash_init(PW32G(registry_directories), 0, NULL, delete_internal_hashtable, 1);
if (!OpenPhpRegistryKey("\\Per Directory Values", &PW32G(registry_key))) {
PW32G(registry_key) = NULL;