Compare commits

..
11 Commits
Author SHA1 Message Date
Ferenc Kovacs 62cf13d3aa 5.6.18 2016-02-03 09:38:08 +01:00
Anatol Belski a7470a28cb add error check to sysconf call 2016-02-03 01:29:57 +01:00
Ferenc Kovacs 0945cfe944 update NEWS 2016-02-03 01:07:11 +01:00
Anatol Belski 14f2a2007d add XFAIL 2016-02-03 00:58:37 +01:00
Anatol Belski 5cb08dde93 Revert "fix leak in 5.6"
This reverts commit fa548e5ca9.
2016-02-03 00:58:31 +01:00
Anatol Belski 9a4bd51a93 fix leak in 5.6 2016-02-03 00:58:20 +01:00
Anatol Belski e15b75671c add test for bug #69111 2016-02-03 00:58:14 +01:00
Anatol Belski a793b70908 refix bug #69111, crash in 5.6 only 2016-02-03 00:58:07 +01:00
Anatol Belski 8696d25dee reset the ext/session to the state of 5.6.17 2016-02-03 00:58:00 +01:00
Julien Pauli 15b1efeba8 Revert "Fix #70720"
This reverts commit ff7ed9021c.
2016-02-02 18:32:38 +01:00
Julien Pauli 813ecfb49f Updated NEWS 2016-02-02 18:22:48 +01:00
141 changed files with 2612 additions and 3606 deletions

No files matched your search

+1 -1
View File
@@ -53,7 +53,7 @@ install-headers:
paths="$$paths $(INSTALL_ROOT)$(phpincludedir)/$$i"; \
done; \
$(mkinstalldirs) $$paths && \
echo "Installing header files: $(INSTALL_ROOT)$(phpincludedir)/" && \
echo "Installing header files: $(INSTALL_ROOT)$(phpincludedir)/" && \
for i in `echo $(INSTALL_HEADERS)`; do \
if test "$(PHP_PECL_EXTENSION)"; then \
src=`echo $$i | $(SED) -e "s#ext/$(PHP_PECL_EXTENSION)/##g"`; \
+5 -101
View File
@@ -1,109 +1,16 @@
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
31 Mar 2016, PHP 5.6.20
- CLI Server:
. Fixed bug #69953 (Support MKCALENDAR request method). (Christoph)
- Core:
. Fixed bug #71596 (Segmentation fault on ZTS with date function
(setlocale)). (Anatol)
- Curl:
. Fixed bug #71694 (Support constant CURLM_ADDED_ALREADY). (mpyw)
- Date:
. Fixed bug #71635 (DatePeriod::getEndDate segfault). (Thomas Punt)
- Fileinfo:
. Fixed bug #71527 (Buffer over-write in finfo_open with malformed magic
file). (Anatol)
- Mbstring:
. Fixed bug #71906 (AddressSanitizer: negative-size-param (-1) in
mbfl_strcut). (Stas)
- ODBC:
. Fixed bug #47803, #69526 (Executing prepared statements is succesfull only
for the first two statements). (einavitamar at gmail dot com, Anatol)
. Fixed bug #71860 (Invalid memory write in phar on filename with \0 in
name). (Stas)
- PDO_DBlib:
. Bug #54648 (PDO::MSSQL forces format of datetime fields).
(steven dot lambeth at gmx dot de, Anatol)
- Phar:
. Fixed bug #71625 (Crash in php7.dll with bad phar filename).
(Anatol)
. Fixed bug #71504 (Parsing of tar file with duplicate filenames causes
memory leak). (Jos Elstgeest)
- SNMP:
. Fixed bug #71704 (php_snmp_error() Format String Vulnerability).
(andrew at jmpesp dot org)
- Standard
. Fixed bug #71798 (Integer Overflow in php_raw_url_encode).
(taoguangchen at icloud dot com, Stas)
03 Mar 2016, PHP 5.6.19
- CLI server:
. Fixed bug #71559 (Built-in HTTP server, we can download file in web by bug).
(Johannes, Anatol)
- CURL:
. Fixed bug #71523 (Copied handle with new option CURLOPT_HTTPHEADER crashes
while curl_multi_exec). (Laruence)
- Date:
. Fixed bug #68078 (Datetime comparisons ignore microseconds). (Willem-Jan
Zijderveld)
. Fixed bug #71525 (Calls to date_modify will mutate timelib_rel_time,
causing date_date_set issues). (Sean DuBois)
- Fileinfo:
. Fixed bug #71434 (finfo throws notice for specific python file). (Laruence)
- FPM:
. Fixed bug #62172 (FPM not working with Apache httpd 2.4 balancer/fcgi
setup). (Matt Haught, Remi)
- Opcache:
. Fixed bug #71584 (Possible use-after-free of ZCG(cwd) in Zend Opcache).
(Yussuf Khalil)
- PDO MySQL:
. Fixed bug #71569 (#70389 fix causes segmentation fault). (Nikita)
- Phar:
. Fixed bug #71498 (Out-of-Bound Read in phar_parse_zipfile()). (Stas)
- Standard:
. Fixed bug #70720 (strip_tags improper php code parsing). (Julien)
- WDDX:
. Fixed bug #71587 (Use-After-Free / Double-Free in WDDX Deserialize). (Stas)
- XSL:
. Fixed bug #71540 (NULL pointer dereference in xsl_ext_function_php()).
(Stas)
- Zip:
. Fixed bug #71561 (NULL pointer dereference in Zip::ExtractTo). (Laruence)
04 Feb 2016, PHP 5.6.18
- Core:
. Fixed bug #71039 (exec functions ignore length but look for NULL
termination). (Anatol)
. Fixed bug #71039 (exec functions ignore length but look for NULL termination).
(Anatol)
. Fixed bug #71089 (No check to duplicate zend_extension). (Remi)
. Fixed bug #71201 (round() segfault on 64-bit builds). (Anatol)
. Added support for new HTTP 451 code. (Julien)
. Fixed bug #71273 (A wrong ext directory setup in php.ini leads to crash).
(Anatol)
. Fixed bug #71323 (Output of stream_get_meta_data can be falsified by its
. Fixed bug #71323 (Output of stream_get_meta_data can be falsified by its
input). (Leo Gaspard)
. Fixed bug #71459 (Integer overflow in iptcembed()). (Stas)
@@ -119,9 +26,6 @@ PHP NEWS
. Fixed bug #71024 (Unable to use PHP 7.0 x64 side-by-side with PHP 5.6 x32
on the same server). (Anatol)
- PCRE:
. Upgraded bundled PCRE library to 8.38.
- Phar:
. Fixed bug #71354 (Heap corruption in tar/zip/phar parser). (Stas)
. Fixed bug #71391 (NULL Pointer Dereference in phar_tar_setupmetadata()).
@@ -176,8 +80,8 @@ PHP NEWS
. Fixed bug #60052 (Integer returned as a 64bit integer on X64_86). (Mariuz)
- WDDX:
. Fixed bug #70661 (Use After Free Vulnerability in WDDX Packet
Deserialization). (taoguangchen at icloud dot com)
. Fixed bug #70661 (Use After Free Vulnerability in WDDX Packet Deserialization).
(taoguangchen at icloud dot com)
. Fixed bug #70741 (Session WDDX Packet Deserialization Type Confusion
Vulnerability). (taoguangchen at icloud dot com)
+1 -3
View File
@@ -587,14 +587,12 @@ static inline unsigned long realpath_cache_key(const char *path, int path_len TS
register unsigned long h;
char *bucket_key_start = tsrm_win32_get_path_sid_key(path TSRMLS_CC);
char *bucket_key = (char *)bucket_key_start;
const char *e;
const char *e = bucket_key + strlen(bucket_key);
if (!bucket_key) {
return 0;
}
e = bucket_key + strlen(bucket_key);
for (h = 2166136261U; bucket_key < e;) {
h *= 16777619;
h ^= *bucket_key++;
+1 -1
View File
@@ -119,7 +119,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
PHP_MAJOR_VERSION=5
PHP_MINOR_VERSION=6
PHP_RELEASE_VERSION=20
PHP_RELEASE_VERSION=18
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`
+1 -9
View File
@@ -831,9 +831,6 @@ PHP_MINIT_FUNCTION(curl)
REGISTER_CURL_CONSTANT(CURLM_INTERNAL_ERROR);
REGISTER_CURL_CONSTANT(CURLM_OK);
REGISTER_CURL_CONSTANT(CURLM_OUT_OF_MEMORY);
#if LIBCURL_VERSION_NUM >= 0x072001 /* Available since 7.32.1 */
REGISTER_CURL_CONSTANT(CURLM_ADDED_ALREADY);
#endif
/* Curl proxy constants */
REGISTER_CURL_CONSTANT(CURLPROXY_HTTP);
@@ -2546,12 +2543,7 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue TSRMLS_DC)
return 1;
}
}
if (Z_REFCOUNT_P(ch->clone) <= 1) {
zend_hash_index_update(ch->to_free->slist, (ulong) option, &slist, sizeof(struct curl_slist *), NULL);
} else {
zend_hash_next_index_insert(ch->to_free->slist, &slist, sizeof(struct curl_slist *), NULL);
}
zend_hash_index_update(ch->to_free->slist, (ulong) option, &slist, sizeof(struct curl_slist *), NULL);
error = curl_easy_setopt(ch->cp, option, slist);
-28
View File
@@ -1,28 +0,0 @@
--TEST--
Bug #71523 (Copied handle with new option CURLOPT_HTTPHEADER crashes while curl_multi_exec)
--SKIPIF--
<?php
if (!extension_loaded("curl")) {
exit("skip curl extension not loaded");
}
?>
--FILE--
<?php
$base = curl_init('http://www.google.com/');
curl_setopt($base, CURLOPT_RETURNTRANSFER, true);
$mh = curl_multi_init();
for ($i = 0; $i < 2; ++$i) {
$ch = curl_copy_handle($base);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Foo: Bar']);
curl_multi_add_handle($mh, $ch);
}
do {
curl_multi_exec($mh, $active);
} while ($active);
?>
okey
--EXPECTF--
okey
-1
View File
@@ -12,7 +12,6 @@ tl_config.WriteLine("#include \"config.w32.h\"");
tl_config.WriteLine("#include <php_stdint.h>");
tl_config.WriteLine("#include \"win32/php_inttypes.h\"");
tl_config.WriteLine("#define TIMELIB_OMIT_STDINT 1");
tl_config.WriteLine("#define TIMELIB_FORCE_LONG32 1");
tl_config.Close();
PHP_INSTALL_HEADERS("ext/date/", "php_date.h lib/timelib.h lib/timelib_structs.h lib/timelib_config.h");
+1 -1
View File
@@ -70,7 +70,7 @@ timelib_rel_time *timelib_diff(timelib_time *one, timelib_time *two)
rt->i += dst_m_corr;
}
rt->days = fabs(floor((one->sse - two->sse - (dst_h_corr * 3600) - (dst_m_corr * 60)) / 86400));
rt->days = abs(floor((one->sse - two->sse - (dst_h_corr * 3600) - (dst_m_corr * 60)) / 86400));
timelib_do_rel_normalize(rt->invert ? one : two, rt);
+1 -6
View File
@@ -1812,11 +1812,6 @@ timelib_time* timelib_strtotime(char *s, size_t len, struct timelib_error_contai
{ \
add_pbf_error(s, "Unexpected data found.", string, begin); \
}
#define TIMELIB_CHECK_SIGNED_NUMBER \
if (strchr("-0123456789", *ptr) == NULL) \
{ \
add_pbf_error(s, "Unexpected data found.", string, begin); \
}
static void timelib_time_reset_fields(timelib_time *time)
{
@@ -2021,7 +2016,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, size_t len,
timelib_eat_spaces((char **) &ptr);
break;
case 'U': /* epoch seconds */
TIMELIB_CHECK_SIGNED_NUMBER;
TIMELIB_CHECK_NUMBER;
TIMELIB_HAVE_RELATIVE();
tmp = timelib_get_unsigned_nr((char **) &ptr, 24);
s->time->y = 1970;
-17
View File
@@ -65,23 +65,6 @@ timelib_time* timelib_time_clone(timelib_time *orig)
return tmp;
}
int timelib_time_compare(timelib_time *t1, timelib_time *t2)
{
if (t1->sse == t2->sse) {
if (t1->f == t2->f) {
return 0;
}
if (t1->sse < 0) {
return (t1->f < t2->f) ? 1 : -1;
} else {
return (t1->f < t2->f) ? -1 : 1;
}
}
return (t1->sse < t2->sse) ? -1 : 1;
}
timelib_rel_time* timelib_rel_time_clone(timelib_rel_time *rel)
{
timelib_rel_time *tmp = timelib_rel_time_ctor();
-1
View File
@@ -138,7 +138,6 @@ timelib_time* timelib_time_ctor(void);
void timelib_time_set_option(timelib_time* tm, int option, void* option_value);
void timelib_time_dtor(timelib_time* t);
timelib_time* timelib_time_clone(timelib_time* orig);
int timelib_time_compare(timelib_time *t1, timelib_time *t2);
timelib_time_offset* timelib_time_offset_ctor(void);
void timelib_time_offset_dtor(timelib_time_offset* t);
+1 -1
View File
@@ -125,7 +125,7 @@ typedef unsigned __int64 uint64_t;
#include <strings.h>
#endif
#if (defined(__x86_64__) || defined(__LP64__) || defined(_LP64) || defined(_WIN64)) && !defined(TIMELIB_FORCE_LONG32)
#if defined(__x86_64__) || defined(__LP64__) || defined(_LP64) || defined(_WIN64)
typedef int64_t timelib_long;
typedef uint64_t timelib_ulong;
# define TIMELIB_LONG_MAX INT64_MAX
+1616 -1761
View File
File diff suppressed because it is too large. Load diff
+2 -7
View File
@@ -2195,8 +2195,8 @@ static int date_object_compare_date(zval *d1, zval *d2 TSRMLS_DC)
if (!o2->time->sse_uptodate) {
timelib_update_ts(o2->time, o2->time->tz_info);
}
return timelib_time_compare(o1->time, o2->time);
return (o1->time->sse == o2->time->sse) ? 0 : ((o1->time->sse < o2->time->sse) ? -1 : 1);
}
static HashTable *date_object_get_gc(zval *object, zval ***table, int *n TSRMLS_DC)
@@ -3143,7 +3143,6 @@ static int php_date_modify(zval *object, char *modify, int modify_len TSRMLS_DC)
timelib_update_ts(dateobj->time, NULL);
timelib_update_from_sse(dateobj->time);
dateobj->time->have_relative = 0;
memset(&dateobj->time->relative, 0, sizeof(dateobj->time->relative));
return 1;
}
@@ -4536,10 +4535,6 @@ PHP_METHOD(DatePeriod, getEndDate)
dpobj = (php_period_obj *)zend_object_store_get_object(getThis() TSRMLS_CC);
if (!dpobj->end) {
return;
}
php_date_instantiate(dpobj->start_ce, return_value TSRMLS_CC);
dateobj = (php_date_obj *)zend_object_store_get_object(return_value TSRMLS_CC);
dateobj->time = timelib_time_ctor();
-19
View File
@@ -1,19 +0,0 @@
--TEST--
Comparing datetime objects should account for microseconds
--FILE--
<?php
date_default_timezone_set('UTC');
$date1 = DateTime::createFromFormat('U.u', '1448889063.3531');
$date2 = DateTime::createFromFormat('U.u', '1448889063.5216');
$date3 = DateTime::createFromFormat('U.u', '1448889063.5216');
var_dump($date1 == $date2);
var_dump($date1 < $date2);
var_dump($date2 > $date1);
var_dump($date2 == $date3);
--EXPECT--
bool(false)
bool(true)
bool(true)
bool(true)
-19
View File
@@ -1,19 +0,0 @@
--TEST--
Comparing datetime objects with negative timestamps should account for microseconds
--FILE--
<?php
date_default_timezone_set('UTC');
$earlyDate1 = DateTime::createFromFormat('U.u', '1.8642')->modify('-5 seconds');
$earlyDate2 = DateTime::createFromFormat('U.u', '1.2768')->modify('-5 seconds');
$earlyDate3 = DateTime::createFromFormat('U.u', '1.2768')->modify('-5 seconds');
var_dump($earlyDate1 == $earlyDate2);
var_dump($earlyDate1 < $earlyDate2);
var_dump($earlyDate2 > $earlyDate1);
var_dump($earlyDate2 == $earlyDate3);
--EXPECT--
bool(false)
bool(true)
bool(true)
bool(true)
-20
View File
@@ -1,20 +0,0 @@
--TEST--
Bug #71525 (Calls to date_modify will mutate timelib_rel_time, causing date_date_set issues)
--INI--
date.timezone=UTC
--FILE--
<?php
$date = new DateTime('2011-12-25 00:00:00');
$date->modify('first day of next month');
$date->setDate('2012', '1', '29');
var_dump($date);
--EXPECTF--
object(DateTime)#%d (3) {
["date"]=>
string(26) "2012-01-29 00:00:00.000000"
["timezone_type"]=>
int(3)
["timezone"]=>
string(3) "UTC"
}
-11
View File
@@ -1,11 +0,0 @@
--TEST--
Bug #71635 (segfault in DatePeriod::getEndDate() when no end date has been set)
--FILE--
<?php
date_default_timezone_set('UTC');
$period = new DatePeriod(new DateTimeImmutable("now"), new DateInterval("P2Y4DT6H8M"), 2);
var_dump($period->getEndDate());
?>
--EXPECT--
NULL
+195 -143
View File
@@ -1,6 +1,6 @@
diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
--- libmagic.orig/apprentice.c 2016-01-25 11:17:38.141978563 +0800
+++ libmagic/apprentice.c 2016-01-25 11:19:37.409347842 +0800
--- libmagic.orig/apprentice.c Tue Nov 19 22:01:12 2013
+++ libmagic/apprentice.c Sun Jan 4 17:06:01 2015
@@ -29,6 +29,8 @@
* apprentice - make one pass through /etc/magic, learning its secrets.
*/
@@ -530,7 +530,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
m->mimetype[0] = '\0'; /* initialise MIME type to none */
return 0;
}
@@ -2575,59 +2597,75 @@
@@ -2575,59 +2597,76 @@
private struct magic_map *
apprentice_map(struct magic_set *ms, const char *fn)
{
@@ -544,29 +544,29 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
size_t i;
+ php_stream *stream = NULL;
+ php_stream_statbuf st;
+
+
+ TSRMLS_FETCH();
- fd = -1;
- if ((map = CAST(struct magic_map *, calloc(1, sizeof(*map)))) == NULL) {
+
+ TSRMLS_FETCH();
+
+ if ((map = CAST(struct magic_map *, ecalloc(1, sizeof(*map)))) == NULL) {
file_oomem(ms, sizeof(*map));
- goto error;
+ return NULL;
+ }
+
+ efree(map);
goto error;
}
+ if (fn == NULL) {
+ map->p = (void *)&php_magic_database;
+ goto internal_loaded;
}
+ }
+
+#ifdef PHP_WIN32
+ /* Don't bother on windows with php_stream_open_wrapper,
+ return to give apprentice_load() a chance. */
+ if (php_stream_stat_path_ex((char *)fn, 0, &st, NULL) == SUCCESS) {
+ if (st.sb.st_mode & S_IFDIR) {
+ return NULL;
+ goto error;
+ }
+ }
+#endif
@@ -628,7 +628,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
if (*ptr != MAGICNO) {
if (swap4(*ptr) != MAGICNO) {
file_error(ms, 0, "bad magic in `%s'", dbname);
@@ -2641,17 +2679,29 @@
@@ -2641,17 +2680,29 @@
else
version = ptr[1];
if (version != VERSIONNO) {
@@ -666,7 +666,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
}
map->magic[0] = CAST(struct magic *, map->p) + 1;
nentries = 0;
@@ -2664,22 +2714,29 @@
@@ -2664,22 +2715,29 @@
map->magic[i + 1] = map->magic[i] + map->nmagic[i];
nentries += map->nmagic[i];
}
@@ -701,7 +701,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
return NULL;
}
@@ -2700,14 +2757,19 @@
@@ -2700,14 +2758,19 @@
char *dbname;
int rv = -1;
uint32_t i;
@@ -724,7 +724,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
file_error(ms, errno, "cannot open `%s'", dbname);
goto out;
}
@@ -2717,31 +2779,33 @@
@@ -2717,31 +2780,33 @@
goto out;
}
@@ -764,7 +764,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
return rv;
}
@@ -2754,6 +2818,7 @@
@@ -2754,6 +2819,7 @@
{
const char *p, *q;
char *buf;
@@ -772,7 +772,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
if (strip) {
if ((p = strrchr(fn, '/')) != NULL)
@@ -2775,16 +2840,18 @@
@@ -2775,16 +2841,18 @@
q++;
/* Compatibility with old code that looked in .mime */
if (ms->flags & MAGIC_MIME) {
@@ -797,7 +797,7 @@ diff -u libmagic.orig/apprentice.c libmagic/apprentice.c
/* Compatibility with old code that looked in .mime */
if (strstr(p, ".mime") != NULL)
@@ -2874,7 +2941,7 @@
@@ -2874,7 +2942,7 @@
m->offset = swap4((uint32_t)m->offset);
m->in_offset = swap4((uint32_t)m->in_offset);
m->lineno = swap4((uint32_t)m->lineno);
@@ -807,8 +807,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 2016-01-25 11:17:38.161978563 +0800
+++ libmagic/ascmagic.c 2016-01-25 11:19:37.410347842 +0800
--- libmagic.orig/ascmagic.c Thu Feb 13 00:20:53 2014
+++ libmagic/ascmagic.c Sun Jan 4 17:06:01 2015
@@ -139,7 +139,7 @@
/* malloc size is a conservative overestimate; could be
improved, or at least realloced after conversion. */
@@ -829,8 +829,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 2016-01-25 11:17:38.140978563 +0800
+++ libmagic/cdf.c 2016-01-25 11:19:37.410347842 +0800
--- libmagic.orig/cdf.c Tue Feb 26 17:20:42 2013
+++ libmagic/cdf.c Sun Jan 4 17:06:01 2015
@@ -35,7 +35,7 @@
#include "file.h"
@@ -1050,8 +1050,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 2016-01-25 11:17:38.160978563 +0800
+++ libmagic/cdf.h 2016-01-25 11:19:37.410347842 +0800
--- libmagic.orig/cdf.h Thu Jun 21 00:19:55 2012
+++ libmagic/cdf.h Sun Jan 4 17:06:01 2015
@@ -35,10 +35,12 @@
#ifndef _H_CDF_
#define _H_CDF_
@@ -1103,8 +1103,8 @@ diff -u libmagic.orig/cdf.h libmagic/cdf.h
cdf_property_info_t **, size_t *, size_t *);
int cdf_read_summary_info(const cdf_info_t *, const cdf_header_t *,
diff -u libmagic.orig/cdf_time.c libmagic/cdf_time.c
--- libmagic.orig/cdf_time.c 2016-01-25 11:17:38.160978563 +0800
+++ libmagic/cdf_time.c 2016-01-25 11:19:37.410347842 +0800
--- libmagic.orig/cdf_time.c Thu Jun 21 00:18:33 2012
+++ libmagic/cdf_time.c Sun Nov 9 19:16:18 2014
@@ -96,7 +96,7 @@
}
@@ -1163,8 +1163,8 @@ diff -u libmagic.orig/cdf_time.c libmagic/cdf_time.c
static const cdf_timestamp_t tst = 0x01A5E403C2D59C00ULL;
static const char *ref = "Sat Apr 23 01:30:00 1977";
diff -u libmagic.orig/compress.c libmagic/compress.c
--- libmagic.orig/compress.c 2016-01-25 11:17:38.149978563 +0800
+++ libmagic/compress.c 2016-01-25 11:19:37.410347842 +0800
--- libmagic.orig/compress.c Sun Jan 5 16:55:21 2014
+++ libmagic/compress.c Sun Jan 4 17:06:01 2015
@@ -32,6 +32,7 @@
* uncompress(method, old, n, newch) - uncompress old into new,
* using method, return sizeof new
@@ -1326,8 +1326,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 2016-01-25 11:17:38.140978563 +0800
+++ libmagic/file.h 2016-01-25 11:19:37.411347842 +0800
--- libmagic.orig/file.h Thu Feb 13 00:20:53 2014
+++ libmagic/file.h Sun Jan 4 17:06:01 2015
@@ -33,11 +33,9 @@
#ifndef __file_h__
#define __file_h__
@@ -1485,22 +1485,24 @@ diff -u libmagic.orig/file.h libmagic/file.h
size_t strlcat(char *, const char *, size_t);
#endif
#ifndef HAVE_STRCASESTR
@@ -537,4 +518,12 @@
#define FILE_RCSID(id)
@@ -535,6 +516,14 @@
#endif
#else
#define FILE_RCSID(id)
+#endif
+
+#ifdef PHP_WIN32
+#define FINFO_LSEEK_FUNC _lseek
+#define FINFO_READ_FUNC _read
+#else
+#define FINFO_LSEEK_FUNC lseek
+#define FINFO_READ_FUNC read
+#endif
+
#endif
#endif /* __file_h__ */
diff -u libmagic.orig/fsmagic.c libmagic/fsmagic.c
--- libmagic.orig/fsmagic.c 2016-01-25 11:17:38.139978563 +0800
+++ libmagic/fsmagic.c 2016-01-25 11:19:37.411347842 +0800
--- libmagic.orig/fsmagic.c Sun Dec 1 20:22:13 2013
+++ libmagic/fsmagic.c Sun Jan 4 17:06:01 2015
@@ -59,27 +59,21 @@
# define minor(dev) ((dev) & 0xff)
#endif
@@ -1824,8 +1826,8 @@ diff -u libmagic.orig/fsmagic.c libmagic/fsmagic.c
return ret;
}
diff -u libmagic.orig/funcs.c libmagic/funcs.c
--- libmagic.orig/funcs.c 2016-01-25 11:17:38.150978563 +0800
+++ libmagic/funcs.c 2016-01-25 11:19:37.411347842 +0800
--- libmagic.orig/funcs.c Thu Feb 13 00:20:53 2014
+++ libmagic/funcs.c Sun Jan 4 17:06:01 2015
@@ -27,7 +27,7 @@
#include "file.h"
@@ -2163,10 +2165,9 @@ diff -u libmagic.orig/funcs.c libmagic/funcs.c
- return rv;
+ return rep_cnt;
}
Common subdirectories: libmagic.orig/.libs and libmagic/.libs
diff -u libmagic.orig/magic.c libmagic/magic.c
--- libmagic.orig/magic.c 2016-01-25 11:17:38.161978563 +0800
+++ libmagic/magic.c 2016-01-25 11:19:37.411347842 +0800
--- libmagic.orig/magic.c Sun Dec 1 20:22:13 2013
+++ libmagic/magic.c Sun Jan 4 17:06:01 2015
@@ -25,11 +25,6 @@
* SUCH DAMAGE.
*/
@@ -2504,8 +2505,17 @@ 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 2016-01-25 11:17:38.139978563 +0800
+++ libmagic/magic.h 2016-01-25 11:19:37.412347842 +0800
--- libmagic.orig/magic.h Tue Feb 11 16:30:44 2014
+++ libmagic/magic.h Sun Jan 4 17:06:01 2015
@@ -75,7 +75,7 @@
#define MAGIC_NO_CHECK_FORTRAN 0x000000 /* Don't check ascii/fortran */
#define MAGIC_NO_CHECK_TROFF 0x000000 /* Don't check ascii/troff */
-#define MAGIC_VERSION 516 /* This implementation */
+#define MAGIC_VERSION 517 /* This implementation */
#ifdef __cplusplus
@@ -88,6 +88,7 @@
const char *magic_getpath(const char *, int);
@@ -2522,21 +2532,9 @@ diff -u libmagic.orig/magic.h libmagic/magic.h
int magic_list(magic_t, const char *);
int magic_errno(magic_t);
diff -u libmagic.orig/patchlevel.h libmagic/patchlevel.h
--- libmagic.orig/patchlevel.h 2016-01-25 11:17:38.141978563 +0800
+++ libmagic/patchlevel.h 2016-01-25 11:19:37.412347842 +0800
@@ -351,7 +351,7 @@
*
* Revision 1.8 93/02/19 15:01:26 ian
* Numerous changes from Guy Harris too numerous to mention but including
- * byte-order independance, fixing "old-style masking", etc. etc. A bugfix
+ * byte-order independence, fixing "old-style masking", etc. etc. A bugfix
* for broken symlinks from martin@@d255s004.zfe.siemens.de.
*
* Revision 1.7 93/01/05 14:57:27 ian
diff -u libmagic.orig/print.c libmagic/print.c
--- libmagic.orig/print.c 2016-01-25 11:17:38.162978563 +0800
+++ libmagic/print.c 2016-01-25 11:19:37.412347842 +0800
--- libmagic.orig/print.c Tue Feb 26 19:25:00 2013
+++ libmagic/print.c Sun Jan 4 17:04:32 2015
@@ -28,13 +28,17 @@
/*
* print.c - debugging printout routines
@@ -2769,8 +2767,8 @@ diff -u libmagic.orig/print.c libmagic/print.c
t = ts.tv_sec;
}
diff -u libmagic.orig/readcdf.c libmagic/readcdf.c
--- libmagic.orig/readcdf.c 2016-01-25 11:17:38.160978563 +0800
+++ libmagic/readcdf.c 2016-01-25 11:19:37.412347842 +0800
--- libmagic.orig/readcdf.c Tue Jan 7 04:13:42 2014
+++ libmagic/readcdf.c Sun Jan 4 17:06:01 2015
@@ -26,11 +26,15 @@
#include "file.h"
@@ -2986,11 +2984,9 @@ diff -u libmagic.orig/readcdf.c libmagic/readcdf.c
}
if (NOTMIME(ms)) {
if (str != NULL) {
Only in libmagic.orig/: readelf.c
Only in libmagic.orig/: readelf.h
diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
--- libmagic.orig/softmagic.c 2016-01-25 11:17:38.139978563 +0800
+++ libmagic/softmagic.c 2016-01-25 11:19:45.545347848 +0800
--- libmagic.orig/softmagic.c Thu Feb 13 00:20:53 2014
+++ libmagic/softmagic.c Sun Jan 4 17:06:01 2015
@@ -50,6 +50,11 @@
#include <locale.h>
#endif
@@ -3168,24 +3164,21 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
{
/*
* Note: FILE_SEARCH and FILE_REGEX do not actually copy
@@ -1066,15 +1061,27 @@
@@ -1066,15 +1061,24 @@
const char *last; /* end of search region */
const char *buf; /* start of search region */
const char *end;
- size_t lines;
+ size_t lines, linecnt, bytecnt;
+
+ linecnt = m->str_range;
+ bytecnt = linecnt * 80;
+
+ if (bytecnt == 0) {
+ bytecnt = 8192;
+ }
+ if (bytecnt > nbytes) {
+ bytecnt = nbytes;
+ }
+ if (offset > bytecnt) {
+ offset = bytecnt;
+ }
if (s == NULL) {
ms->search.s_len = 0;
@@ -3198,7 +3191,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
/* mget() guarantees buf <= last */
for (lines = linecnt, b = buf; lines && b < end &&
((b = CAST(const char *,
@@ -1087,7 +1094,7 @@
@@ -1087,7 +1091,7 @@
b++;
}
if (lines)
@@ -3207,7 +3200,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
ms->search.s = buf;
ms->search.s_len = last - buf;
@@ -1158,7 +1165,6 @@
@@ -1158,7 +1162,6 @@
int *need_separator, int *returnval)
{
uint32_t soffset, offset = ms->offset;
@@ -3215,7 +3208,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
int rv, oneed_separator, in_type;
char *sbuf, *rbuf;
union VALUETYPE *p = &ms->ms_value;
@@ -1170,17 +1176,13 @@
@@ -1170,17 +1173,13 @@
}
if (mcopy(ms, p, m->type, m->flag & INDIR, s, (uint32_t)(offset + o),
@@ -3235,7 +3228,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
}
if (m->flag & INDIR) {
@@ -1672,16 +1674,13 @@
@@ -1672,16 +1671,13 @@
if ((ms->flags & MAGIC_DEBUG) != 0)
fprintf(stderr, "indirect +offs=%u\n", offset);
}
@@ -3253,7 +3246,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
}
}
@@ -1755,11 +1754,21 @@
@@ -1755,11 +1751,21 @@
ms->offset = soffset;
if (rv == 1) {
if ((ms->flags & (MAGIC_MIME|MAGIC_APPLE)) == 0 &&
@@ -3278,7 +3271,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
}
return rv;
@@ -1875,6 +1884,42 @@
@@ -1875,6 +1881,42 @@
return file_strncmp(a, b, len, flags);
}
@@ -3321,7 +3314,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
private int
magiccheck(struct magic_set *ms, struct magic *m)
{
@@ -2035,63 +2080,90 @@
@@ -2035,63 +2077,151 @@
break;
}
case FILE_REGEX: {
@@ -3331,43 +3324,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';
-#else
- pmatch[0].rm_so = 0;
- pmatch[0].rm_eo = ms->search.s_len;
-#endif
- rc = regexec(&rx, (const char *)ms->search.s,
- 1, pmatch, REG_STARTEND);
-#if REG_STARTEND == 0
- ((char *)(intptr_t)ms->search.s)[l] = c;
-#endif
- switch (rc) {
- case 0:
- ms->search.s += (int)pmatch[0].rm_so;
- ms->search.offset += (size_t)pmatch[0].rm_so;
- ms->search.rm_len =
- (size_t)(pmatch[0].rm_eo - pmatch[0].rm_so);
- v = 0;
- break;
-
- case REG_NOMATCH:
+ zval *pattern;
+ int options = 0;
+ pcre_cache_entry *pce;
@@ -3402,7 +3358,7 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
+ haystack = estrndup(ms->search.s, ms->search.s_len);
+
+ /* match v = 0, no match v = 1 */
+ php_pcre_match_impl(pce, haystack, ms->search.s_len, retval, subpats, 0, 1, PREG_OFFSET_CAPTURE, 0 TSRMLS_CC);
+ php_pcre_match_impl(pce, haystack, ms->search.s_len, retval, subpats, 1, 1, PREG_OFFSET_CAPTURE, 0 TSRMLS_CC);
+ /* Free haystack */
+ efree(haystack);
+
@@ -3413,37 +3369,133 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
+ FREE_ZVAL(pattern);
+ return -1;
+ } else if ((Z_LVAL_P(retval) > 0) && (Z_TYPE_P(subpats) == IS_ARRAY)) {
+
+ /* Need to fetch global match which equals pmatch[0] */
+ zval **ppzval;
+ HashTable *ht = Z_ARRVAL_P(subpats);
+ /* The first element (should be) is the global match
+ Need to move to the inner array to get the global match */
+ if (zend_hash_index_find(ht, 0, (void **)&ppzval) == SUCCESS) {
+ zval **match, **offset;
+ /* If everything goes according to the master plan
+ tmpcopy now contains two elements:
+ 0 = the match
+ 1 = starting position of the match */
+ if (zend_hash_index_find(Z_ARRVAL_PP(ppzval), 0, (void **)&match) == SUCCESS
+ && zend_hash_index_find(Z_ARRVAL_PP(ppzval), 1, (void **)&offset) == SUCCESS) {
+ if (Z_TYPE_PP(match) != IS_STRING || Z_TYPE_PP(offset) != IS_LONG) {
+ goto error_out;
+ HashPosition outer_pos;
+ zval *pattern_match = NULL, *pattern_offset = NULL;
+
+ zend_hash_internal_pointer_reset_ex(ht, &outer_pos);
+
+ if (zend_hash_has_more_elements_ex(ht, &outer_pos) == SUCCESS &&
+ zend_hash_move_forward_ex(ht, &outer_pos)) {
+
+ zval **ppzval;
+
+ /* The first element (should be) is the global match
+ Need to move to the inner array to get the global match */
+
+ if (zend_hash_get_current_data_ex(ht, (void**)&ppzval, &outer_pos) != FAILURE) {
+
+ HashTable *inner_ht;
+ HashPosition inner_pos;
+ zval **match, **offset;
+ zval tmpcopy = **ppzval, matchcopy, offsetcopy;
+
+ zval_copy_ctor(&tmpcopy);
+ INIT_PZVAL(&tmpcopy);
+
+ inner_ht = Z_ARRVAL(tmpcopy);
+
+ /* If everything goes according to the master plan
+ tmpcopy now contains two elements:
+ 0 = the match
+ 1 = starting position of the match */
+ zend_hash_internal_pointer_reset_ex(inner_ht, &inner_pos);
+
+ if (zend_hash_has_more_elements_ex(inner_ht, &inner_pos) == SUCCESS &&
+ zend_hash_move_forward_ex(inner_ht, &inner_pos)) {
+
+ if (zend_hash_get_current_data_ex(inner_ht, (void**)&match, &inner_pos) != FAILURE) {
+
+ matchcopy = **match;
+ zval_copy_ctor(&matchcopy);
+ INIT_PZVAL(&matchcopy);
+ convert_to_string(&matchcopy);
+
+ MAKE_STD_ZVAL(pattern_match);
+ Z_STRVAL_P(pattern_match) = (char *)Z_STRVAL(matchcopy);
+ Z_STRLEN_P(pattern_match) = Z_STRLEN(matchcopy);
+ Z_TYPE_P(pattern_match) = IS_STRING;
+
+ zval_dtor(&matchcopy);
+ }
+ }
+ ms->search.s += (int)Z_LVAL_PP(offset); /* this is where the match starts */
+ ms->search.offset += (size_t)Z_LVAL_PP(offset); /* this is where the match starts as size_t */
+ ms->search.rm_len = Z_STRLEN_PP(match) /* This is the length of the matched pattern */;
+
+ if (zend_hash_has_more_elements_ex(inner_ht, &inner_pos) == SUCCESS &&
+ zend_hash_move_forward_ex(inner_ht, &inner_pos)) {
+
+ if (zend_hash_get_current_data_ex(inner_ht, (void**)&offset, &inner_pos) != FAILURE) {
+
+ offsetcopy = **offset;
+ zval_copy_ctor(&offsetcopy);
+ INIT_PZVAL(&offsetcopy);
+ convert_to_long(&offsetcopy);
+
+ MAKE_STD_ZVAL(pattern_offset);
+ Z_LVAL_P(pattern_offset) = Z_LVAL(offsetcopy);
+ Z_TYPE_P(pattern_offset) = IS_LONG;
+
+ zval_dtor(&offsetcopy);
+ }
+ }
+ zval_dtor(&tmpcopy);
+ }
+
+ if ((pattern_match != NULL) && (pattern_offset != NULL)) {
+ ms->search.s += (int)Z_LVAL_P(pattern_offset); /* this is where the match starts */
+ ms->search.offset += (size_t)Z_LVAL_P(pattern_offset); /* this is where the match starts as size_t */
+ ms->search.rm_len = Z_STRLEN_P(pattern_match) /* This is the length of the matched pattern */;
+ v = 0;
+
+ efree(pattern_match);
+ efree(pattern_offset);
+
+ } else {
+ goto error_out;
+ zval_ptr_dtor(&subpats);
+ FREE_ZVAL(retval);
+ zval_dtor(pattern);
+ FREE_ZVAL(pattern);
+ return -1;
+ }
+ } else {
+error_out:
+ zval_ptr_dtor(&subpats);
+ FREE_ZVAL(retval);
+ zval_dtor(pattern);
+ FREE_ZVAL(pattern);
+ return -1;
+ }
- 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';
-#else
- pmatch[0].rm_so = 0;
- pmatch[0].rm_eo = ms->search.s_len;
-#endif
- rc = regexec(&rx, (const char *)ms->search.s,
- 1, pmatch, REG_STARTEND);
-#if REG_STARTEND == 0
- ((char *)(intptr_t)ms->search.s)[l] = c;
-#endif
- switch (rc) {
- case 0:
- ms->search.s += (int)pmatch[0].rm_so;
- ms->search.offset += (size_t)pmatch[0].rm_so;
- ms->search.rm_len =
- (size_t)(pmatch[0].rm_eo - pmatch[0].rm_so);
- v = 0;
- break;
- case REG_NOMATCH:
+ } else {
v = 1;
- break;
@@ -3467,8 +3519,8 @@ diff -u libmagic.orig/softmagic.c libmagic/softmagic.c
}
case FILE_INDIRECT:
diff -u libmagic.orig/strcasestr.c libmagic/strcasestr.c
--- libmagic.orig/strcasestr.c 2016-01-25 11:17:38.160978563 +0800
+++ libmagic/strcasestr.c 2016-01-25 11:19:37.413347842 +0800
--- libmagic.orig/strcasestr.c Thu Dec 5 17:57:50 2013
+++ libmagic/strcasestr.c Sun Jan 4 17:06:01 2015
@@ -37,6 +37,8 @@
__RCSID("$NetBSD: strncasecmp.c,v 1.2 2007/06/04 18:19:27 christos Exp $");
#endif /* LIBC_SCCS and not lint */
+1 -1
View File
@@ -414,7 +414,7 @@ file_check_mem(struct magic_set *ms, unsigned int level)
size_t len;
if (level >= ms->c.len) {
len = (ms->c.len += 20 + level) * sizeof(*ms->c.li);
len = (ms->c.len += 20) * sizeof(*ms->c.li);
ms->c.li = CAST(struct level_info *, (ms->c.li == NULL) ?
emalloc(len) :
erealloc(ms->c.li, len));
+86 -25
View File
@@ -2114,7 +2114,7 @@ magiccheck(struct magic_set *ms, struct magic *m)
haystack = estrndup(ms->search.s, ms->search.s_len);
/* match v = 0, no match v = 1 */
php_pcre_match_impl(pce, haystack, ms->search.s_len, retval, subpats, 0, 1, PREG_OFFSET_CAPTURE, 0 TSRMLS_CC);
php_pcre_match_impl(pce, haystack, ms->search.s_len, retval, subpats, 1, 1, PREG_OFFSET_CAPTURE, 0 TSRMLS_CC);
/* Free haystack */
efree(haystack);
@@ -2125,37 +2125,98 @@ magiccheck(struct magic_set *ms, struct magic *m)
FREE_ZVAL(pattern);
return -1;
} else if ((Z_LVAL_P(retval) > 0) && (Z_TYPE_P(subpats) == IS_ARRAY)) {
/* Need to fetch global match which equals pmatch[0] */
zval **ppzval;
HashTable *ht = Z_ARRVAL_P(subpats);
/* The first element (should be) is the global match
Need to move to the inner array to get the global match */
if (zend_hash_index_find(ht, 0, (void **)&ppzval) == SUCCESS) {
zval **match, **offset;
/* If everything goes according to the master plan
tmpcopy now contains two elements:
0 = the match
1 = starting position of the match */
if (zend_hash_index_find(Z_ARRVAL_PP(ppzval), 0, (void **)&match) == SUCCESS
&& zend_hash_index_find(Z_ARRVAL_PP(ppzval), 1, (void **)&offset) == SUCCESS) {
if (Z_TYPE_PP(match) != IS_STRING || Z_TYPE_PP(offset) != IS_LONG) {
goto error_out;
HashPosition outer_pos;
zval *pattern_match = NULL, *pattern_offset = NULL;
zend_hash_internal_pointer_reset_ex(ht, &outer_pos);
if (zend_hash_has_more_elements_ex(ht, &outer_pos) == SUCCESS &&
zend_hash_move_forward_ex(ht, &outer_pos)) {
zval **ppzval;
/* The first element (should be) is the global match
Need to move to the inner array to get the global match */
if (zend_hash_get_current_data_ex(ht, (void**)&ppzval, &outer_pos) != FAILURE) {
HashTable *inner_ht;
HashPosition inner_pos;
zval **match, **offset;
zval tmpcopy = **ppzval, matchcopy, offsetcopy;
zval_copy_ctor(&tmpcopy);
INIT_PZVAL(&tmpcopy);
inner_ht = Z_ARRVAL(tmpcopy);
/* If everything goes according to the master plan
tmpcopy now contains two elements:
0 = the match
1 = starting position of the match */
zend_hash_internal_pointer_reset_ex(inner_ht, &inner_pos);
if (zend_hash_has_more_elements_ex(inner_ht, &inner_pos) == SUCCESS &&
zend_hash_move_forward_ex(inner_ht, &inner_pos)) {
if (zend_hash_get_current_data_ex(inner_ht, (void**)&match, &inner_pos) != FAILURE) {
matchcopy = **match;
zval_copy_ctor(&matchcopy);
INIT_PZVAL(&matchcopy);
convert_to_string(&matchcopy);
MAKE_STD_ZVAL(pattern_match);
Z_STRVAL_P(pattern_match) = (char *)Z_STRVAL(matchcopy);
Z_STRLEN_P(pattern_match) = Z_STRLEN(matchcopy);
Z_TYPE_P(pattern_match) = IS_STRING;
zval_dtor(&matchcopy);
}
}
ms->search.s += (int)Z_LVAL_PP(offset); /* this is where the match starts */
ms->search.offset += (size_t)Z_LVAL_PP(offset); /* this is where the match starts as size_t */
ms->search.rm_len = Z_STRLEN_PP(match) /* This is the length of the matched pattern */;
if (zend_hash_has_more_elements_ex(inner_ht, &inner_pos) == SUCCESS &&
zend_hash_move_forward_ex(inner_ht, &inner_pos)) {
if (zend_hash_get_current_data_ex(inner_ht, (void**)&offset, &inner_pos) != FAILURE) {
offsetcopy = **offset;
zval_copy_ctor(&offsetcopy);
INIT_PZVAL(&offsetcopy);
convert_to_long(&offsetcopy);
MAKE_STD_ZVAL(pattern_offset);
Z_LVAL_P(pattern_offset) = Z_LVAL(offsetcopy);
Z_TYPE_P(pattern_offset) = IS_LONG;
zval_dtor(&offsetcopy);
}
}
zval_dtor(&tmpcopy);
}
if ((pattern_match != NULL) && (pattern_offset != NULL)) {
ms->search.s += (int)Z_LVAL_P(pattern_offset); /* this is where the match starts */
ms->search.offset += (size_t)Z_LVAL_P(pattern_offset); /* this is where the match starts as size_t */
ms->search.rm_len = Z_STRLEN_P(pattern_match) /* This is the length of the matched pattern */;
v = 0;
efree(pattern_match);
efree(pattern_offset);
} else {
goto error_out;
zval_ptr_dtor(&subpats);
FREE_ZVAL(retval);
zval_dtor(pattern);
FREE_ZVAL(pattern);
return -1;
}
} else {
error_out:
zval_ptr_dtor(&subpats);
FREE_ZVAL(retval);
zval_dtor(pattern);
FREE_ZVAL(pattern);
return -1;
}
} else {
v = 1;
}
+1 -1
View File
@@ -12,7 +12,7 @@ $string .= "\r\n";
$string .= "''''";
// Total string length > 8192
$string .= str_repeat("a", 8184);
$string .= str_repeat(chr(rand(32, 127)), 8184);
// Ending in this string
$string .= "say";
+1 -1
View File
@@ -19,4 +19,4 @@ finfo_open(FILEINFO_MIME_TYPE, "\xfc\x63");
<br />
<b>Warning</b>: : failed to open stream: No such file or directory in <b>%sbug68996.php</b> on line <b>%d</b><br />
<br />
<b>Warning</b>: finfo_open(): Failed to load magic database at '%s�c'. in <b>%sbug68996.php</b> on line <b>%d</b><br />
<b>Warning</b>: finfo_open(): in <b>%sbug68996.php</b> on line <b>%d</b><br />
-1
View File
@@ -1 +0,0 @@
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
-19
View File
@@ -1,19 +0,0 @@
--TEST--
Bug #71527 Buffer over-write in finfo_open with malformed magic file
--SKIPIF--
<?php
if (!class_exists('finfo'))
die('skip no fileinfo extension');
--ENV--
USE_ZEND_ALLOC=0
--FILE--
<?php
$finfo = finfo_open(FILEINFO_NONE, dirname(__FILE__) . DIRECTORY_SEPARATOR . "bug71527.magic");
$info = finfo_file($finfo, __FILE__);
var_dump($info);
?>
--EXPECTF--
Warning: finfo_open(): Failed to load magic database at '%sbug71527.magic'. in %sbug71527.php on line %d
Warning: finfo_file() expects parameter 1 to be resource, boolean given in %sbug71527.php on line %d
bool(false)
+17 -17
View File
@@ -72,7 +72,7 @@
*
*/
/*
/*
* Unicode support
*
* Portions copyright (c) 1999,2000,2001 by the PHP3 internationalization team.
@@ -137,7 +137,7 @@ mbfl_buffer_converter_new(
mbfl_buffer_converter *
mbfl_buffer_converter_new2(
const mbfl_encoding *from,
const mbfl_encoding *to,
const mbfl_encoding *to,
int buf_initsz)
{
mbfl_buffer_converter *convd;
@@ -339,7 +339,7 @@ mbfl_buffer_converter_result(mbfl_buffer_converter *convd, mbfl_string *result)
}
mbfl_string *
mbfl_buffer_converter_feed_result(mbfl_buffer_converter *convd, mbfl_string *string,
mbfl_buffer_converter_feed_result(mbfl_buffer_converter *convd, mbfl_string *string,
mbfl_string *result)
{
if (convd == NULL || string == NULL || result == NULL) {
@@ -535,7 +535,7 @@ const mbfl_encoding *mbfl_encoding_detector_judge2(mbfl_encoding_detector *ident
}
n--;
}
/* fallback judge */
if (!encoding) {
n = identd->filter_list_size - 1;
@@ -702,7 +702,7 @@ mbfl_identify_encoding(mbfl_string *string, enum mbfl_no_encoding *elist, int el
}
}
}
/* cleanup */
/* dtors should be called in reverse order */
i = num; while (--i >= 0) {
@@ -785,7 +785,7 @@ mbfl_identify_encoding2(mbfl_string *string, const mbfl_encoding **elist, int el
}
}
}
/* cleanup */
/* dtors should be called in reverse order */
i = num; while (--i >= 0) {
@@ -844,7 +844,7 @@ mbfl_strlen(mbfl_string *string)
} else {
/* wchar filter */
mbfl_convert_filter *filter = mbfl_convert_filter_new(
string->no_encoding,
string->no_encoding,
mbfl_no_encoding_wchar,
filter_count_output, 0, &len);
if (filter == NULL) {
@@ -865,7 +865,7 @@ mbfl_strlen(mbfl_string *string)
return len;
}
/*
* strpos
*/
@@ -931,7 +931,7 @@ retry:
/*
* oddlen
*/
int
int
mbfl_oddlen(mbfl_string *string)
{
int len, n, m, k;
@@ -1071,7 +1071,7 @@ mbfl_strpos(
++result;
} else if ((c & 0xc0) != 0x80) {
++result;
}
}
}
goto out;
}
@@ -1116,7 +1116,7 @@ mbfl_strpos(
qe = needle_u8_val + needle_u8_len;
if (offset < 0) {
if (-offset > needle_len) {
offset += needle_len;
offset += needle_len;
while (offset < 0) {
unsigned char c;
if (p <= e) {
@@ -1158,7 +1158,7 @@ mbfl_strpos(
++result;
} else if ((c & 0xc0) != 0x80) {
++result;
}
}
}
goto out;
}
@@ -1501,7 +1501,7 @@ mbfl_strcut(
if (encoding->flag & (MBFL_ENCTYPE_WCS2BE | MBFL_ENCTYPE_WCS2LE)) {
from &= -2;
if (length >= string->len - from) {
if (from + length >= string->len) {
length = string->len - from;
}
@@ -1510,14 +1510,14 @@ mbfl_strcut(
} else if (encoding->flag & (MBFL_ENCTYPE_WCS4BE | MBFL_ENCTYPE_WCS4LE)) {
from &= -4;
if (length >= string->len - from) {
if (from + length >= string->len) {
length = string->len - from;
}
start = string->val + from;
end = start + (length & -4);
} else if ((encoding->flag & MBFL_ENCTYPE_SBCS)) {
if (length >= string->len - from) {
if (from + length >= string->len) {
length = string->len - from;
}
@@ -1539,7 +1539,7 @@ mbfl_strcut(
start = p;
/* search end position */
if (length >= (int)string->len - (start - string->val)) {
if ((start - string->val) + length >= (int)string->len) {
end = string->val + string->len;
} else {
for (q = p + length; p < q; p += (m = mbtab[*p]));
@@ -2024,7 +2024,7 @@ mbfl_ja_jp_hantozen(
mbfl_no_encoding_wchar,
(int(*)(int, void*))next_filter->filter_function,
(int(*)(void*))next_filter->filter_flush,
next_filter);
next_filter);
if (encoder == NULL) {
goto out;
}
+18 -22
View File
@@ -442,9 +442,6 @@ static void _free_odbc_result(zend_rsrc_list_entry *rsrc TSRMLS_DC)
* zend_list_delete(res->conn_ptr->id);
*/
}
if (res->param_info) {
efree(res->param_info);
}
efree(res);
}
}
@@ -1186,7 +1183,6 @@ PHP_FUNCTION(odbc_prepare)
odbc_result *result = NULL;
odbc_connection *conn;
RETCODE rc;
int i;
#ifdef HAVE_SQL_EXTENDED_FETCH
SQLUINTEGER scrollopts;
#endif
@@ -1200,7 +1196,6 @@ PHP_FUNCTION(odbc_prepare)
result = (odbc_result *)ecalloc(1, sizeof(odbc_result));
result->numparams = 0;
result->param_info = NULL;
rc = PHP_ODBC_SQLALLOCSTMT(conn->hdbc, &(result->stmt));
if (rc == SQL_INVALID_HANDLE) {
@@ -1257,19 +1252,6 @@ PHP_FUNCTION(odbc_prepare)
zend_list_addref(conn->id);
result->conn_ptr = conn;
result->fetched = 0;
result->param_info = (odbc_param_info *) safe_emalloc(sizeof(odbc_param_info), result->numparams, 0);
for (i=0;i<result->numparams;i++) {
rc = SQLDescribeParam(result->stmt, (SQLUSMALLINT)(i+1), &result->param_info[i].sqltype, &result->param_info[i].precision,
&result->param_info[i].scale, &result->param_info[i].nullable);
if (rc == SQL_ERROR) {
odbc_sql_error(result->conn_ptr, result->stmt, "SQLDescribeParameter");
SQLFreeStmt(result->stmt, SQL_RESET_PARAMS);
efree(result->param_info);
efree(result);
RETURN_FALSE;
}
}
ZEND_REGISTER_RESOURCE(return_value, result, le_result);
}
/* }}} */
@@ -1290,7 +1272,9 @@ PHP_FUNCTION(odbc_execute)
params_t *params = NULL;
char *filename;
unsigned char otype;
SQLSMALLINT ctype;
SQLSMALLINT sqltype, ctype, scale;
SQLSMALLINT nullable;
SQLULEN precision;
odbc_result *result;
int numArgs, i, ne;
RETCODE rc;
@@ -1348,10 +1332,22 @@ PHP_FUNCTION(odbc_execute)
RETURN_FALSE;
}
rc = SQLDescribeParam(result->stmt, (SQLUSMALLINT)i, &sqltype, &precision, &scale, &nullable);
params[i-1].vallen = Z_STRLEN_PP(tmp);
params[i-1].fp = -1;
if (rc == SQL_ERROR) {
odbc_sql_error(result->conn_ptr, result->stmt, "SQLDescribeParameter");
SQLFreeStmt(result->stmt, SQL_RESET_PARAMS);
for (i = 0; i < result->numparams; i++) {
if (params[i].fp != -1) {
close(params[i].fp);
}
}
efree(params);
RETURN_FALSE;
}
if (IS_SQL_BINARY(result->param_info[i-1].sqltype)) {
if (IS_SQL_BINARY(sqltype)) {
ctype = SQL_C_BINARY;
} else {
ctype = SQL_C_CHAR;
@@ -1398,7 +1394,7 @@ PHP_FUNCTION(odbc_execute)
params[i-1].vallen = SQL_LEN_DATA_AT_EXEC(0);
rc = SQLBindParameter(result->stmt, (SQLUSMALLINT)i, SQL_PARAM_INPUT,
ctype, result->param_info[i-1].sqltype, result->param_info[i-1].precision, result->param_info[i-1].scale,
ctype, sqltype, precision, scale,
(void *)params[i-1].fp, 0,
&params[i-1].vallen);
} else {
@@ -1410,7 +1406,7 @@ PHP_FUNCTION(odbc_execute)
}
rc = SQLBindParameter(result->stmt, (SQLUSMALLINT)i, SQL_PARAM_INPUT,
ctype, result->param_info[i-1].sqltype, result->param_info[i-1].precision, result->param_info[i-1].scale,
ctype, sqltype, precision, scale,
Z_STRVAL_PP(tmp), 0,
&params[i-1].vallen);
}
-8
View File
@@ -233,13 +233,6 @@ typedef struct odbc_result_value {
SQLLEN coltype;
} odbc_result_value;
typedef struct odbc_param_info {
SQLSMALLINT sqltype;
SQLSMALLINT scale;
SQLSMALLINT nullable;
SQLULEN precision;
} odbc_param_info;
typedef struct odbc_result {
ODBC_SQL_STMT_T stmt;
odbc_result_value *values;
@@ -251,7 +244,6 @@ typedef struct odbc_result {
long longreadlen;
int binmode;
int fetched;
odbc_param_info * param_info;
odbc_connection *conn_ptr;
} odbc_result;
-185
View File
@@ -1,185 +0,0 @@
--TEST--
Bug #47803 Executing prepared statements is succesfull only for the first two statements
--SKIPIF--
<?php include 'skipif.inc'; ?>
--FILE--
<?php
include dirname(__FILE__) . "/config.inc";
$create_table = "CREATE TABLE FOO(
[PAR_ID] [int] NOT NULL,
[PAR_INT] [int] NULL,
[PAR_CHR] [varchar](500) NULL
)";
$inserts = "INSERT INTO FOO
([PAR_ID]
,[PAR_INT]
,[PAR_CHR])
VALUES
(1,14,''),
(2,30,''),
(3,7,''),
(4,7,''),
(5,0,''),
(6,0,''),
(7,20130901,''),
(8,20140201,''),
(9,20140201,''),
(10,20140620,''),
(11,221,'')";
date_default_timezone_set('Europe/Warsaw');
$link = odbc_connect($dsn, $user, $pass);
odbc_exec($link, 'CREATE DATABASE odbcTEST');
odbc_exec($link, $create_table);
odbc_exec($link, $inserts);
$upd_params = array(
array('id'=>1, 'name'=>'test 1'),
array('id'=>2, 'name'=>'test 2'),
array('id'=>3, 'name'=>'test 3'),
array('id'=>4, 'name'=>'test 4'),
array('id'=>5, 'name'=>'test 5'),
array('id'=>10, 'name'=>'test 10'),
array('id'=>9, 'name'=>'test 9'),
array('id'=>8, 'name'=>'test 8'),
array('id'=>7, 'name'=>'test 7'),
array('id'=>6, 'name'=>'test 6'),
);
$sql = "UPDATE FOO
SET [PAR_CHR] = ?
WHERE [PAR_ID] = ?";
$result = odbc_prepare($link, $sql);
if (!$result) {
print ('[sql] prep: '.$sql);
goto out;
}
foreach ($upd_params as &$k) {
if(!odbc_execute($result, array($k['name'], $k['id']))) {
print ('[sql] exec: '."array({$k['name']}, {$k['id']})");
goto out;
}
}
odbc_free_result($result);
$sql = "SELECT * FROM FOO WHERE [PAR_ID] = ?";
$result = odbc_prepare($link, $sql);
if (!$result) {
print ('[sql] prep: '.$sql);
goto out;
}
foreach ($upd_params as $k) {
if(!odbc_execute($result, array($k['id']))) {
print ('[sql] exec: '."array({$k['id']})");
goto out;
}
while (($r = odbc_fetch_array($result)) !== false) {
var_dump($r);
}
}
out:
if ($result) odbc_free_result($result);
odbc_close($link);
?>
==DONE==
--EXPECT--
array(3) {
["PAR_ID"]=>
string(1) "1"
["PAR_INT"]=>
string(2) "14"
["PAR_CHR"]=>
string(6) "test 1"
}
array(3) {
["PAR_ID"]=>
string(1) "2"
["PAR_INT"]=>
string(2) "30"
["PAR_CHR"]=>
string(6) "test 2"
}
array(3) {
["PAR_ID"]=>
string(1) "3"
["PAR_INT"]=>
string(1) "7"
["PAR_CHR"]=>
string(6) "test 3"
}
array(3) {
["PAR_ID"]=>
string(1) "4"
["PAR_INT"]=>
string(1) "7"
["PAR_CHR"]=>
string(6) "test 4"
}
array(3) {
["PAR_ID"]=>
string(1) "5"
["PAR_INT"]=>
string(1) "0"
["PAR_CHR"]=>
string(6) "test 5"
}
array(3) {
["PAR_ID"]=>
string(2) "10"
["PAR_INT"]=>
string(8) "20140620"
["PAR_CHR"]=>
string(7) "test 10"
}
array(3) {
["PAR_ID"]=>
string(1) "9"
["PAR_INT"]=>
string(8) "20140201"
["PAR_CHR"]=>
string(6) "test 9"
}
array(3) {
["PAR_ID"]=>
string(1) "8"
["PAR_INT"]=>
string(8) "20140201"
["PAR_CHR"]=>
string(6) "test 8"
}
array(3) {
["PAR_ID"]=>
string(1) "7"
["PAR_INT"]=>
string(8) "20130901"
["PAR_CHR"]=>
string(6) "test 7"
}
array(3) {
["PAR_ID"]=>
string(1) "7"
["PAR_INT"]=>
string(8) "20130901"
["PAR_CHR"]=>
string(6) "test 7"
}
==DONE==
--CLEAN--
<?php
include 'config.inc';
$conn = odbc_connect($dsn, $user, $pass);
odbc_exec($conn, 'DROP TABLE FOO');
odbc_exec($conn, 'DROP DATABASE odbcTEST');
odbc_close($conn);
?>
+3 -14
View File
@@ -3,17 +3,6 @@
putenv('ODBCINI=/etc/odbc.ini');
putenv('ODBCSYSINI=/etc');
$dsn = getenv("ODBC_TEST_DSN");
$user = getenv("ODBC_TEST_USER");
$pass = getenv("ODBC_TEST_PASS");
if (false === $dsn) {
$dsn = 'myodbc3';
}
if (false === $user) {
$user = 'root';
}
if (false == $pass) {
$pass = '';
}
$dsn = 'myodbc3';
$user = 'root';
$pass = '';
+6 -5
View File
@@ -2370,11 +2370,6 @@ static void accel_deactivate(void)
*/
TSRMLS_FETCH();
if (ZCG(cwd)) {
efree(ZCG(cwd));
ZCG(cwd) = NULL;
}
if (!ZCG(enabled) || !accel_startup_ok) {
return;
}
@@ -2388,6 +2383,12 @@ static void accel_deactivate(void)
zend_accel_fast_shutdown(TSRMLS_C);
}
#endif
if (ZCG(cwd)) {
efree(ZCG(cwd));
ZCG(cwd) = NULL;
}
}
static int accelerator_remove_cb(zend_extension *element1, zend_extension *element2)
-4
View File
@@ -1277,10 +1277,6 @@ PHP_MSHUTDOWN_FUNCTION(openssl)
{
EVP_cleanup();
#if OPENSSL_VERSION_NUMBER >= 0x00090805f
ERR_free_strings();
#endif
php_unregister_url_stream_wrapper("https" TSRMLS_CC);
php_unregister_url_stream_wrapper("ftps" TSRMLS_CC);
+32
View File
@@ -0,0 +1,32 @@
--TEST--
openssl_seal() tests
--SKIPIF--
<?php if (!extension_loaded("openssl")) print "skip"; ?>
--FILE--
<?php
$a = 1;
$b = array(1);
$c = array(1);
$d = array(1);
var_dump(openssl_seal($a, $b, $c, $d));
var_dump(openssl_seal($a, $a, $a, array()));
var_dump(openssl_seal($c, $c, $c, 1));
var_dump(openssl_seal($b, $b, $b, ""));
echo "Done\n";
?>
--EXPECTF--
Warning: openssl_seal(): not a public key (1th member of pubkeys) in %s on line %d
bool(false)
Warning: openssl_seal(): Fourth argument to openssl_seal() must be a non-empty array in %s on line %d
bool(false)
Warning: openssl_seal() expects parameter 1 to be string, array given in %s on line %d
NULL
Warning: openssl_seal() expects parameter 1 to be string, array given in %s on line %d
NULL
Done
@@ -6,7 +6,7 @@ openssl_pkcs7_decrypt() and invalid parameters
<?php
function myErrorHandler($errno, $errstr, $errfile, $errline) {
var_dump($errstr);
var_dump($errstr);
}
set_error_handler("myErrorHandler");
@@ -9,18 +9,12 @@ $a = 1;
var_dump(openssl_csr_new(1,$a));
var_dump(openssl_csr_new(1,$a,1,1));
$a = array();
var_dump(openssl_csr_new(array(), $a, array('config' => __DIR__ . DIRECTORY_SEPARATOR . 'openssl.cnf'), array()));
$conf = array('config' => dirname(__FILE__) . DIRECTORY_SEPARATOR . 'openssl.cnf');
var_dump(openssl_csr_new(array(), $a, $conf, array()));
// this leaks
//this leaks
$a = array(1,2);
$b = array(1,2);
var_dump(openssl_csr_new($a, $b, $conf));
// options type check
$x = openssl_pkey_new($conf);
var_dump(openssl_csr_new(["countryName" => "DE"], $x, $conf + ["x509_extensions" => 0xDEADBEEF]));
var_dump(openssl_csr_new($a, $b, array('config' => __DIR__ . DIRECTORY_SEPARATOR . 'openssl.cnf')));
echo "Done\n";
@@ -37,5 +31,4 @@ Warning: openssl_csr_new(): key array must be of the form array(0 => key, 1 => p
Warning: openssl_csr_new(): add1_attr_by_txt challengePassword_min -> 4 (failed; check error queue and value of string_mask OpenSSL option if illegal characters are reported) in %s on line %d
bool(false)
resource(%d) of type (OpenSSL X.509 CSR)
resource(%d) of type (OpenSSL X.509 CSR)
Done
@@ -8,7 +8,7 @@ if (!function_exists("utf8_decode")) die("skip");
--FILE--
<?php
$csr = file_get_contents(dirname(__FILE__) . '/cert.csr');
$csr = file_get_contents(dirname(__FILE__) . '/005_crt.txt');
if ($out = openssl_csr_get_subject($csr, 1)) {
var_dump($out);
}
File renamed without changes.
@@ -1,5 +1,5 @@
--TEST--
openssl_pkey_new() tests
openssl_pkey_new() with an empty sub-array arg generates a malformed resource
--SKIPIF--
<?php if (!extension_loaded("openssl")) print "skip"; ?>
--FILE--
+60
View File
@@ -0,0 +1,60 @@
--TEST--
openssl_x509_read() and openssl_x509_free() tests
--SKIPIF--
<?php if (!extension_loaded("openssl")) print "skip"; ?>
--FILE--
<?php
$fp = fopen(dirname(__FILE__) . "/cert.crt","r");
$a = fread($fp,8192);
fclose($fp);
$b = "file://" . dirname(__FILE__) . "/cert.crt";
$c = "invalid cert";
$d = openssl_x509_read($a);
$e = array();
$f = array($b);
var_dump($res = openssl_x509_read($a)); // read cert as a string
openssl_x509_free($res);
var_dump($res);
var_dump($res = openssl_x509_read($b)); // read cert as a filename string
openssl_x509_free($res);
var_dump($res);
var_dump($res = openssl_x509_read($c)); // read an invalid cert, fails
openssl_x509_free($res);
var_dump($res);
var_dump($res = openssl_x509_read($d)); // read cert from a resource
openssl_x509_free($res);
var_dump($res);
var_dump($res = openssl_x509_read($e)); // read an array
openssl_x509_free($res);
var_dump($res);
var_dump($res = openssl_x509_read($f)); // read an array with the filename
openssl_x509_free($res);
var_dump($res);
?>
--EXPECTF--
resource(%d) of type (OpenSSL X.509)
resource(%d) of type (Unknown)
resource(%d) of type (OpenSSL X.509)
resource(%d) of type (Unknown)
Warning: openssl_x509_read(): supplied parameter cannot be coerced into an X509 certificate! in %s on line %d
bool(false)
Warning: openssl_x509_free() expects parameter 1 to be resource, boolean given in %s on line %d
bool(false)
resource(%d) of type (OpenSSL X.509)
resource(%d) of type (Unknown)
Warning: openssl_x509_read(): supplied parameter cannot be coerced into an X509 certificate! in %s on line %d
bool(false)
Warning: openssl_x509_free() expects parameter 1 to be resource, boolean given in %s on line %d
bool(false)
Warning: openssl_x509_read(): supplied parameter cannot be coerced into an X509 certificate! in %s on line %d
bool(false)
Warning: openssl_x509_free() expects parameter 1 to be resource, boolean given in %s on line %d
bool(false)
+74
View File
@@ -0,0 +1,74 @@
--TEST--
openssl_x509_export() and openssl_x509_export_to_file() tests
--SKIPIF--
<?php if (!extension_loaded("openssl")) print "skip"; ?>
--FILE--
<?php
$fp = fopen(dirname(__FILE__) . "/cert.crt","r");
$a = fread($fp,8192);
fclose($fp);
$b = "file://" . dirname(__FILE__) . "/cert.crt";
$c = "invalid cert";
$d = openssl_x509_read($a);
$e = array();
var_dump(openssl_x509_export($a, $output)); // read cert as a binary string
var_dump(openssl_x509_export($b, $output2)); // read cert from a filename string
var_dump(openssl_x509_export($c, $output3)); // read an invalid cert, fails
var_dump(openssl_x509_export($d, $output4)); // read cert from a resource
var_dump(openssl_x509_export($e, $output5)); // read an array, fails
$outfilename = tempnam("/tmp", "ssl");
if ($outfilename === false)
die("failed to get a temporary filename!");
echo "---\n";
var_dump(openssl_x509_export_to_file($a, $outfilename)); // read cert as a binary string
var_dump(openssl_x509_export_to_file($b, $outfilename)); // read cert from a filename string
var_dump(openssl_x509_export_to_file($c, $outfilename)); // read an invalid cert, fails
var_dump(openssl_x509_export_to_file($d, $outfilename)); // read cert from a resource
var_dump(openssl_x509_export_to_file($e, $outfilename)); // read an array, fails
echo "---\n";
var_dump($exists = file_exists($outfilename));
if ($exists) {
@unlink($outfilename);
}
echo "---\n";
var_dump(strcmp($output, $a));
var_dump(strcmp($output, $output2));
var_dump(strcmp($output, $output3));
var_dump(strcmp($output, $output4)); // different
var_dump(strcmp($output, $output5)); // different
?>
--EXPECTF--
bool(true)
bool(true)
Warning: openssl_x509_export(): cannot get cert from parameter 1 in %s on line %d
bool(false)
bool(true)
Warning: openssl_x509_export(): cannot get cert from parameter 1 in %s on line %d
bool(false)
---
bool(true)
bool(true)
Warning: openssl_x509_export_to_file(): cannot get cert from parameter 1 in %s on line %d
bool(false)
bool(true)
Warning: openssl_x509_export_to_file(): cannot get cert from parameter 1 in %s on line %d
bool(false)
---
bool(true)
---
int(0)
int(0)
int(%d)
int(0)
int(%d)
@@ -5,15 +5,15 @@ openssl_x509_check_private_key() tests
--FILE--
<?php
$fp = fopen(dirname(__FILE__) . "/cert.crt","r");
$a = fread($fp, 8192);
$a = fread($fp,8192);
fclose($fp);
$fp = fopen(dirname(__FILE__) . "/private_rsa_1024.key","r");
$b = fread($fp, 8192);
$fp = fopen(dirname(__FILE__) . "/private.key","r");
$b = fread($fp,8192);
fclose($fp);
$cert = "file://" . dirname(__FILE__) . "/cert.crt";
$key = "file://" . dirname(__FILE__) . "/private_rsa_1024.key";
$key = "file://" . dirname(__FILE__) . "/private.key";
var_dump(openssl_x509_check_private_key($cert, $key));
var_dump(openssl_x509_check_private_key("", $key));
@@ -1,5 +1,5 @@
--TEST--
openssl_decrypt() tests dependent on openssl_encrypt
openssl_encrypt() and openssl_decrypt() tests
--SKIPIF--
<?php if (!extension_loaded("openssl")) print "skip"; ?>
--FILE--
+27
View File
@@ -0,0 +1,27 @@
--TEST--
openssl_seal() error tests
--SKIPIF--
<?php if (!extension_loaded("openssl")) print "skip"; ?>
--FILE--
<?php
$data = "openssl_open() test";
$pub_key = "file://" . dirname(__FILE__) . "/public.key";
$wrong = "wrong";
openssl_seal($data, $sealed, $ekeys, array($pub_key)); // no output
openssl_seal($data, $sealed, $ekeys, array($pub_key, $pub_key)); // no output
openssl_seal($data, $sealed, $ekeys, array($pub_key, $wrong));
openssl_seal($data, $sealed, $ekeys, $pub_key);
openssl_seal($data, $sealed, $ekeys, array());
openssl_seal($data, $sealed, $ekeys, array($wrong));
?>
--EXPECTF--
Warning: openssl_seal(): not a public key (2th member of pubkeys) in %s on line %d
Warning: openssl_seal() expects parameter 4 to be array, string given in %s on line %d
Warning: openssl_seal(): Fourth argument to openssl_seal() must be a non-empty array in %s on line %d
Warning: openssl_seal(): not a public key (1th member of pubkeys) in %s on line %d
@@ -6,7 +6,7 @@ openssl_open() tests
<?php
$data = "openssl_open() test";
$pub_key = "file://" . dirname(__FILE__) . "/public.key";
$priv_key = "file://" . dirname(__FILE__) . "/private_rsa_1024.key";
$priv_key = "file://" . dirname(__FILE__) . "/private.key";
$wrong = "wrong";
openssl_seal($data, $sealed, $ekeys, array($pub_key, $pub_key, $pub_key));
@@ -5,14 +5,13 @@ openssl_private_encrypt() tests
--FILE--
<?php
$data = "Testing openssl_private_encrypt()";
$privkey = "file://" . dirname(__FILE__) . "/private_rsa_1024.key";
$privkey = "file://" . dirname(__FILE__) . "/private.key";
$pubkey = "file://" . dirname(__FILE__) . "/public.key";
$wrong = "wrong";
class test {
function __toString() {
return "test";
}
function __toString() {
return "test";
}
}
$obj = new test;
@@ -5,14 +5,13 @@ openssl_public_encrypt() tests
--FILE--
<?php
$data = "Testing openssl_public_encrypt()";
$privkey = "file://" . dirname(__FILE__) . "/private_rsa_1024.key";
$privkey = "file://" . dirname(__FILE__) . "/private.key";
$pubkey = "file://" . dirname(__FILE__) . "/public.key";
$wrong = "wrong";
class test {
function __toString() {
return "test";
}
function __toString() {
return "test";
}
}
$obj = new test;
@@ -5,7 +5,7 @@ openssl_public_decrypt() tests
--FILE--
<?php
$data = "Testing openssl_public_decrypt()";
$privkey = "file://" . dirname(__FILE__) . "/private_rsa_1024.key";
$privkey = "file://" . dirname(__FILE__) . "/private.key";
$pubkey = "file://" . dirname(__FILE__) . "/public.key";
$wrong = "wrong";
@@ -5,7 +5,7 @@ openssl_private_decrypt() tests
--FILE--
<?php
$data = "Testing openssl_public_decrypt()";
$privkey = "file://" . dirname(__FILE__) . "/private_rsa_1024.key";
$privkey = "file://" . dirname(__FILE__) . "/private.key";
$pubkey = "file://" . dirname(__FILE__) . "/public.key";
$wrong = "wrong";
@@ -5,7 +5,7 @@ openssl_sign() tests
--FILE--
<?php
$data = "Testing openssl_sign()";
$privkey = "file://" . dirname(__FILE__) . "/private_rsa_1024.key";
$privkey = "file://" . dirname(__FILE__) . "/private.key";
$wrong = "wrong";
var_dump(openssl_sign($data, $sign, $privkey)); // no output
@@ -5,7 +5,7 @@ openssl_verify() tests
--FILE--
<?php
$data = "Testing openssl_verify()";
$privkey = "file://" . dirname(__FILE__) . "/private_rsa_1024.key";
$privkey = "file://" . dirname(__FILE__) . "/private.key";
$pubkey = "file://" . dirname(__FILE__) . "/public.key";
$wrong = "wrong";
@@ -5,7 +5,7 @@ openssl_csr_sign() tests
--FILE--
<?php
$cert = "file://" . dirname(__FILE__) . "/cert.crt";
$priv = "file://" . dirname(__FILE__) . "/private_rsa_1024.key";
$priv = "file://" . dirname(__FILE__) . "/private.key";
$wrong = "wrong";
$pub = "file://" . dirname(__FILE__) . "/public.key";
$config = __DIR__ . DIRECTORY_SEPARATOR . 'openssl.cnf';
@@ -14,7 +14,7 @@ $dn = array(
"localityName" => "Porto Alegre",
"commonName" => "Henrique do N. Angelo",
"emailAddress" => "hnangelo@php.net"
);
);
$args = array(
"digest_alg" => "sha1",
@@ -22,7 +22,7 @@ $args = array(
"private_key_type" => OPENSSL_KEYTYPE_DSA,
"encrypt_key" => true,
"config" => $config,
);
);
$privkey = openssl_pkey_new($config_arg);
$csr = openssl_csr_new($dn, $privkey, $args);
@@ -13,7 +13,7 @@ if ($outfile2 === false)
die("failed to get a temporary filename!");
$single_cert = "file://" . dirname(__FILE__) . "/cert.crt";
$privkey = "file://" . dirname(__FILE__) . "/private_rsa_1024.key";
$privkey = "file://" . dirname(__FILE__) . "/private.key";
$multi_certs = array($single_cert, $single_cert);
$assoc_headers = array("To" => "test@test", "Subject" => "testing openssl_pkcs7_encrypt()");
$headers = array("test@test", "testing openssl_pkcs7_encrypt()");
@@ -5,7 +5,7 @@ openssl_pkcs7_decrypt() tests
--FILE--
<?php
$infile = dirname(__FILE__) . "/cert.crt";
$privkey = "file://" . dirname(__FILE__) . "/private_rsa_1024.key";
$privkey = "file://" . dirname(__FILE__) . "/private.key";
$encrypted = tempnam("/tmp", "ssl");
if ($encrypted === false)
die("failed to get a temporary filename!");
@@ -6,11 +6,10 @@ openssl_pkcs7_sign() tests
<?php
$infile = dirname(__FILE__) . "/cert.crt";
$outfile = tempnam("/tmp", "ssl");
if ($outfile === false) {
if ($outfile === false)
die("failed to get a temporary filename!");
}
$privkey = "file://" . dirname(__FILE__) . "/private_rsa_1024.key";
$privkey = "file://" . dirname(__FILE__) . "/private.key";
$single_cert = "file://" . dirname(__FILE__) . "/cert.crt";
$assoc_headers = array("To" => "test@test", "Subject" => "testing openssl_pkcs7_sign()");
$headers = array("test@test", "testing openssl_pkcs7_sign()");
+12
View File
@@ -0,0 +1,12 @@
--TEST--
Options type checks
--SKIPIF--
<?php if (!extension_loaded("openssl")) print "skip"; ?>
--FILE--
<?php
$x = openssl_pkey_new();
$csr = openssl_csr_new(["countryName" => "DE"], $x, ["x509_extensions" => 0xDEADBEEF]);
?>
DONE
--EXPECT--
DONE
@@ -10,9 +10,7 @@ if (!defined('OPENSSL_KEYTYPE_EC')) die("skip no EC available");
$key = openssl_pkey_get_private('file://' . dirname(__FILE__) . '/private_ec.key');
var_dump($key);
$config_arg = array("config" => __DIR__ . DIRECTORY_SEPARATOR . "openssl.cnf");
var_dump(openssl_pkey_export($key, $output, NULL, $config_arg));
var_dump(openssl_pkey_export($key, $output));
echo $output;
// Load the private key from the exported pem string
@@ -20,7 +18,7 @@ $details = openssl_pkey_get_details(openssl_pkey_get_private($output));
var_dump(OPENSSL_KEYTYPE_EC === $details['type']);
// Export key with passphrase
openssl_pkey_export($key, $output, 'passphrase', $config_arg);
openssl_pkey_export($key, $output, 'passphrase');
$details = openssl_pkey_get_details(openssl_pkey_get_private($output, 'passphrase'));
var_dump(OPENSSL_KEYTYPE_EC === $details['type']);
@@ -34,7 +32,7 @@ var_dump($details === openssl_pkey_get_details($pKey));
// Export to file
$tempname = tempnam(sys_get_temp_dir(), 'openssl_ec');
var_dump(openssl_pkey_export_to_file($key, $tempname, NULL, $config_arg));
var_dump(openssl_pkey_export_to_file($key, $tempname));
$details = openssl_pkey_get_details(openssl_pkey_get_private('file://' . $tempname));
var_dump(OPENSSL_KEYTYPE_EC === $details['type']);
+1 -2
View File
@@ -10,8 +10,7 @@ $pkey = openssl_pkey_new(array(
'digest_alg' => 'sha256',
'private_key_bits' => 1024,
'private_key_type' => OPENSSL_KEYTYPE_RSA,
'encrypt_key' => false,
'config' => __DIR__ . DIRECTORY_SEPARATOR . 'openssl.cnf',
'encrypt_key' => false
));
$details = openssl_pkey_get_details($pkey);
$test_pubkey = $details['key'];
-58
View File
@@ -1,58 +0,0 @@
--TEST--
openssl_seal() tests
--SKIPIF--
<?php if (!extension_loaded("openssl")) print "skip"; ?>
--FILE--
<?php
// simple tests
$a = 1;
$b = array(1);
$c = array(1);
$d = array(1);
var_dump(openssl_seal($a, $b, $c, $d));
var_dump(openssl_seal($a, $a, $a, array()));
var_dump(openssl_seal($c, $c, $c, 1));
var_dump(openssl_seal($b, $b, $b, ""));
// tests with cert
$data = "openssl_open() test";
$pub_key = "file://" . dirname(__FILE__) . "/public.key";
$wrong = "wrong";
var_dump(openssl_seal($data, $sealed, $ekeys, array($pub_key))); // no output
var_dump(openssl_seal($data, $sealed, $ekeys, array($pub_key, $pub_key))); // no output
var_dump(openssl_seal($data, $sealed, $ekeys, array($pub_key, $wrong)));
var_dump(openssl_seal($data, $sealed, $ekeys, $pub_key));
var_dump(openssl_seal($data, $sealed, $ekeys, array()));
var_dump(openssl_seal($data, $sealed, $ekeys, array($wrong)));
echo "Done\n";
?>
--EXPECTF--
Warning: openssl_seal(): not a public key (1th member of pubkeys) in %s on line %d
bool(false)
Warning: openssl_seal(): Fourth argument to openssl_seal() must be a non-empty array in %s on line %d
bool(false)
Warning: openssl_seal() expects parameter 1 to be string, array given in %s on line %d
NULL
Warning: openssl_seal() expects parameter 1 to be string, array given in %s on line %d
NULL
int(19)
int(19)
Warning: openssl_seal(): not a public key (2th member of pubkeys) in %s on line %d
bool(false)
Warning: openssl_seal() expects parameter 4 to be array, string given in %s on line %d
NULL
Warning: openssl_seal(): Fourth argument to openssl_seal() must be a non-empty array in %s on line %d
bool(false)
Warning: openssl_seal(): not a public key (1th member of pubkeys) in %s on line %d
bool(false)
Done
@@ -0,0 +1,62 @@
--TEST--
Testing openssl_spki_export()
Creates SPKAC for all available key sizes & signature algorithms and exports public key
--SKIPIF--
<?php
if (!extension_loaded("openssl")) die("skip");
if (!@openssl_pkey_new()) die("skip cannot create private key");
?>
--FILE--
<?php
/* array of private key sizes to test */
$ksize = array('1024'=>1024,
'2048'=>2048,
'4096'=>4096);
/* array of available hashings to test */
$algo = array('md4'=>OPENSSL_ALGO_MD4,
'md5'=>OPENSSL_ALGO_MD5,
'sha1'=>OPENSSL_ALGO_SHA1,
'sha224'=>OPENSSL_ALGO_SHA224,
'sha256'=>OPENSSL_ALGO_SHA256,
'sha384'=>OPENSSL_ALGO_SHA384,
'sha512'=>OPENSSL_ALGO_SHA512,
'rmd160'=>OPENSSL_ALGO_RMD160);
/* loop over key sizes for test */
foreach($ksize as $k => $v) {
/* generate new private key of specified size to use for tests */
$pkey = openssl_pkey_new(array('digest_alg' => 'sha512',
'private_key_type' => OPENSSL_KEYTYPE_RSA,
'private_key_bits' => $v));
openssl_pkey_export($pkey, $pass);
/* loop to create and verify results */
foreach($algo as $key => $value) {
$spkac = openssl_spki_new($pkey, _uuid(), $value);
echo openssl_spki_export(preg_replace('/SPKAC=/', '', $spkac));
}
openssl_free_key($pkey);
}
/* generate a random challenge */
function _uuid()
{
return sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x', mt_rand(0, 0xffff),
mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0x0fff) | 0x4000,
mt_rand(0, 0x3fff) | 0x8000, mt_rand(0, 0xffff),
mt_rand(0, 0xffff), mt_rand(0, 0xffff));
}
?>
--EXPECTREGEX--
\-\-\-\-\-BEGIN PUBLIC KEY\-\-\-\-\-.*\-\-\-\-\-END PUBLIC KEY\-\-\-\-\-
\-\-\-\-\-BEGIN PUBLIC KEY\-\-\-\-\-.*\-\-\-\-\-END PUBLIC KEY\-\-\-\-\-
\-\-\-\-\-BEGIN PUBLIC KEY\-\-\-\-\-.*\-\-\-\-\-END PUBLIC KEY\-\-\-\-\-
\-\-\-\-\-BEGIN PUBLIC KEY\-\-\-\-\-.*\-\-\-\-\-END PUBLIC KEY\-\-\-\-\-
\-\-\-\-\-BEGIN PUBLIC KEY\-\-\-\-\-.*\-\-\-\-\-END PUBLIC KEY\-\-\-\-\-
\-\-\-\-\-BEGIN PUBLIC KEY\-\-\-\-\-.*\-\-\-\-\-END PUBLIC KEY\-\-\-\-\-
\-\-\-\-\-BEGIN PUBLIC KEY\-\-\-\-\-.*\-\-\-\-\-END PUBLIC KEY\-\-\-\-\-
\-\-\-\-\-BEGIN PUBLIC KEY\-\-\-\-\-.*\-\-\-\-\-END PUBLIC KEY\-\-\-\-\-
@@ -1,60 +0,0 @@
--TEST--
openssl_spki_export() tests for exporting public key
--SKIPIF--
<?php
if (!extension_loaded("openssl")) die("skip");
if (!@openssl_pkey_new()) die("skip cannot create private key");
?>
--FILE--
<?php
/* array of private key sizes to test */
$key_sizes = array(1024, 2048, 4096);
$pkeys = array();
foreach ($key_sizes as $key_size) {
$key_file = "file://" . dirname(__FILE__) . "/private_rsa_" . $key_size . ".key";
$pkeys[] = openssl_pkey_get_private($key_file);
}
/* array of available hashings to test */
$algo = array(
OPENSSL_ALGO_MD4,
OPENSSL_ALGO_MD5,
OPENSSL_ALGO_SHA1,
OPENSSL_ALGO_SHA224,
OPENSSL_ALGO_SHA256,
OPENSSL_ALGO_SHA384,
OPENSSL_ALGO_SHA512,
OPENSSL_ALGO_RMD160
);
/* loop over key sizes for test */
foreach ($pkeys as $pkey) {
/* loop to create and verify results */
foreach ($algo as $value) {
$spkac = openssl_spki_new($pkey, _uuid(), $value);
echo openssl_spki_export(preg_replace('/SPKAC=/', '', $spkac));
}
}
/* generate a random challenge */
function _uuid() {
return sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x', mt_rand(0, 0xffff),
mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0x0fff) | 0x4000,
mt_rand(0, 0x3fff) | 0x8000, mt_rand(0, 0xffff),
mt_rand(0, 0xffff), mt_rand(0, 0xffff));
}
?>
--EXPECTREGEX--
\-\-\-\-\-BEGIN PUBLIC KEY\-\-\-\-\-.*\-\-\-\-\-END PUBLIC KEY\-\-\-\-\-
\-\-\-\-\-BEGIN PUBLIC KEY\-\-\-\-\-.*\-\-\-\-\-END PUBLIC KEY\-\-\-\-\-
\-\-\-\-\-BEGIN PUBLIC KEY\-\-\-\-\-.*\-\-\-\-\-END PUBLIC KEY\-\-\-\-\-
\-\-\-\-\-BEGIN PUBLIC KEY\-\-\-\-\-.*\-\-\-\-\-END PUBLIC KEY\-\-\-\-\-
\-\-\-\-\-BEGIN PUBLIC KEY\-\-\-\-\-.*\-\-\-\-\-END PUBLIC KEY\-\-\-\-\-
\-\-\-\-\-BEGIN PUBLIC KEY\-\-\-\-\-.*\-\-\-\-\-END PUBLIC KEY\-\-\-\-\-
\-\-\-\-\-BEGIN PUBLIC KEY\-\-\-\-\-.*\-\-\-\-\-END PUBLIC KEY\-\-\-\-\-
\-\-\-\-\-BEGIN PUBLIC KEY\-\-\-\-\-.*\-\-\-\-\-END PUBLIC KEY\-\-\-\-\-
@@ -1,5 +1,6 @@
--TEST--
openssl_spki_export_challenge() tests for exporting challenge
Testing openssl_spki_export_challenge()
Creates SPKAC for all available key sizes & signature algorithms and exports challenge
--INI--
error_reporting=0
--SKIPIF--
@@ -11,46 +12,47 @@ if (!@openssl_pkey_new()) die("skip cannot create private key");
<?php
/* array of private key sizes to test */
$key_sizes = array(1024, 2048, 4096);
$pkeys = array();
foreach ($key_sizes as $key_size) {
$key_file = "file://" . dirname(__FILE__) . "/private_rsa_" . $key_size . ".key";
$pkeys[] = openssl_pkey_get_private($key_file);
}
$ksize = array('1024'=>1024,
'2048'=>2048,
'4096'=>4096);
/* array of available hashings to test */
$algo = array(
OPENSSL_ALGO_MD4,
OPENSSL_ALGO_MD5,
OPENSSL_ALGO_SHA1,
OPENSSL_ALGO_SHA224,
OPENSSL_ALGO_SHA256,
OPENSSL_ALGO_SHA384,
OPENSSL_ALGO_SHA512,
OPENSSL_ALGO_RMD160
);
$algo = array('md4'=>OPENSSL_ALGO_MD4,
'md5'=>OPENSSL_ALGO_MD5,
'sha1'=>OPENSSL_ALGO_SHA1,
'sha224'=>OPENSSL_ALGO_SHA224,
'sha256'=>OPENSSL_ALGO_SHA256,
'sha384'=>OPENSSL_ALGO_SHA384,
'sha512'=>OPENSSL_ALGO_SHA512,
'rmd160'=>OPENSSL_ALGO_RMD160);
/* loop over key sizes for test */
foreach ($pkeys as $pkey) {
foreach($ksize as $k => $v) {
/* generate new private key of specified size to use for tests */
$pkey = openssl_pkey_new(array('digest_alg' => 'sha512',
'private_key_type' => OPENSSL_KEYTYPE_RSA,
'private_key_bits' => $v));
openssl_pkey_export($pkey, $pass);
/* loop to create and verify results */
foreach ($algo as $value) {
foreach($algo as $key => $value) {
$spkac = openssl_spki_new($pkey, _uuid(), $value);
var_dump(openssl_spki_export_challenge(preg_replace('/SPKAC=/', '', $spkac)));
var_dump(openssl_spki_export_challenge($spkac . 'Make it fail'));
var_dump(openssl_spki_export_challenge($spkac.'Make it fail'));
}
openssl_free_key($pkey);
}
/* generate a random challenge */
function _uuid() {
return sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x', mt_rand(0, 0xffff),
mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0x0fff) | 0x4000,
mt_rand(0, 0x3fff) | 0x8000, mt_rand(0, 0xffff),
mt_rand(0, 0xffff), mt_rand(0, 0xffff));
function _uuid()
{
return sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x', mt_rand(0, 0xffff),
mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0x0fff) | 0x4000,
mt_rand(0, 0x3fff) | 0x8000, mt_rand(0, 0xffff),
mt_rand(0, 0xffff), mt_rand(0, 0xffff));
}
?>
--EXPECTREGEX--
string\(36\) \"[0-9a-f]{8}\-([0-9a-f]{4}\-){3}[0-9a-f]{12}\"
+77
View File
@@ -0,0 +1,77 @@
--TEST--
Testing openssl_spki_new()
Tests SPKAC for all available private key sizes & hashing algorithms
--SKIPIF--
<?php
if (!extension_loaded("openssl")) die("skip");
if (!@openssl_pkey_new()) die("skip cannot create private key");
?>
--FILE--
<?php
/* array of private key sizes to test */
$ksize = array('1024'=>1024,
'2048'=>2048,
'4096'=>4096);
/* array of available hashings to test */
$algo = array('md4'=>OPENSSL_ALGO_MD4,
'md5'=>OPENSSL_ALGO_MD5,
'sha1'=>OPENSSL_ALGO_SHA1,
'sha224'=>OPENSSL_ALGO_SHA224,
'sha256'=>OPENSSL_ALGO_SHA256,
'sha384'=>OPENSSL_ALGO_SHA384,
'sha512'=>OPENSSL_ALGO_SHA512,
'rmd160'=>OPENSSL_ALGO_RMD160);
/* loop over key sizes for test */
foreach($ksize as $k => $v) {
/* generate new private key of specified size to use for tests */
$pkey = openssl_pkey_new(array('digest_alg' => 'sha512',
'private_key_type' => OPENSSL_KEYTYPE_RSA,
'private_key_bits' => $v));
openssl_pkey_export($pkey, $pass);
/* loop to create and verify results */
foreach($algo as $key => $value) {
var_dump(openssl_spki_new($pkey, _uuid(), $value));
}
openssl_free_key($pkey);
}
/* generate a random challenge */
function _uuid()
{
return sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x', mt_rand(0, 0xffff),
mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0x0fff) | 0x4000,
mt_rand(0, 0x3fff) | 0x8000, mt_rand(0, 0xffff),
mt_rand(0, 0xffff), mt_rand(0, 0xffff));
}
?>
--EXPECTF--
string(478) "%s"
string(478) "%s"
string(478) "%s"
string(478) "%s"
string(478) "%s"
string(478) "%s"
string(478) "%s"
string(474) "%s"
string(830) "%s"
string(830) "%s"
string(830) "%s"
string(830) "%s"
string(830) "%s"
string(830) "%s"
string(830) "%s"
string(826) "%s"
string(1510) "%s"
string(1510) "%s"
string(1510) "%s"
string(1510) "%s"
string(1510) "%s"
string(1510) "%s"
string(1510) "%s"
string(1506) "%s"
@@ -1,73 +0,0 @@
--TEST--
openssl_spki_new() test for creating SPKI string
--SKIPIF--
<?php
if (!extension_loaded("openssl")) die("skip");
?>
--FILE--
<?php
/* array of private key sizes to test */
$key_sizes = array(1024, 2048, 4096);
$pkeys = array();
foreach ($key_sizes as $key_size) {
$key_file = "file://" . dirname(__FILE__) . "/private_rsa_" . $key_size . ".key";
$pkeys[] = openssl_pkey_get_private($key_file);
}
/* array of available hashings to test */
$algo = array(
OPENSSL_ALGO_MD4,
OPENSSL_ALGO_MD5,
OPENSSL_ALGO_SHA1,
OPENSSL_ALGO_SHA224,
OPENSSL_ALGO_SHA256,
OPENSSL_ALGO_SHA384,
OPENSSL_ALGO_SHA512,
OPENSSL_ALGO_RMD160
);
/* loop over key sizes for test */
foreach ($pkeys as $pkey) {
/* loop to create and verify results */
foreach ($algo as $value) {
var_dump(openssl_spki_new($pkey, _uuid(), $value));
}
}
/* generate a random challenge */
function _uuid() {
return sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x', mt_rand(0, 0xffff),
mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0x0fff) | 0x4000,
mt_rand(0, 0x3fff) | 0x8000, mt_rand(0, 0xffff),
mt_rand(0, 0xffff), mt_rand(0, 0xffff));
}
?>
--EXPECTF--
string(478) "%s"
string(478) "%s"
string(478) "%s"
string(478) "%s"
string(478) "%s"
string(478) "%s"
string(478) "%s"
string(474) "%s"
string(830) "%s"
string(830) "%s"
string(830) "%s"
string(830) "%s"
string(830) "%s"
string(830) "%s"
string(830) "%s"
string(826) "%s"
string(1510) "%s"
string(1510) "%s"
string(1510) "%s"
string(1510) "%s"
string(1510) "%s"
string(1510) "%s"
string(1510) "%s"
string(1506) "%s"
@@ -0,0 +1,91 @@
--TEST--
Testing openssl_spki_verify()
Creates SPKAC for all available key sizes & signature algorithms and tests for valid signature
--INI--
error_reporting=0
--SKIPIF--
<?php
if (!extension_loaded("openssl")) die("skip");
if (!@openssl_pkey_new()) die("skip cannot create private key");
?>
--FILE--
<?php
/* array of private key sizes to test */
$ksize = array('1024'=>1024,
'2048'=>2048,
'4096'=>4096);
/* array of available hashings to test */
$algo = array('sha1'=>OPENSSL_ALGO_SHA1,
'sha224'=>OPENSSL_ALGO_SHA224,
'sha256'=>OPENSSL_ALGO_SHA256,
'sha384'=>OPENSSL_ALGO_SHA384,
'sha512'=>OPENSSL_ALGO_SHA512,
'rmd160'=>OPENSSL_ALGO_RMD160);
/* loop over key sizes for test */
foreach($ksize as $k => $v) {
/* generate new private key of specified size to use for tests */
$pkey = openssl_pkey_new(array('digest_alg' => 'sha512',
'private_key_type' => OPENSSL_KEYTYPE_RSA,
'private_key_bits' => $v));
openssl_pkey_export($pkey, $pass);
/* loop to create and verify results */
foreach($algo as $key => $value) {
$spkac = openssl_spki_new($pkey, _uuid(), $value);
var_dump(openssl_spki_verify(preg_replace('/SPKAC=/', '', $spkac)));
var_dump(openssl_spki_verify($spkac.'Make it fail'));
}
openssl_free_key($pkey);
}
/* generate a random challenge */
function _uuid()
{
return sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x', mt_rand(0, 0xffff),
mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0x0fff) | 0x4000,
mt_rand(0, 0x3fff) | 0x8000, mt_rand(0, 0xffff),
mt_rand(0, 0xffff), mt_rand(0, 0xffff));
}
?>
--EXPECT--
bool(true)
bool(false)
bool(true)
bool(false)
bool(true)
bool(false)
bool(true)
bool(false)
bool(true)
bool(false)
bool(true)
bool(false)
bool(true)
bool(false)
bool(true)
bool(false)
bool(true)
bool(false)
bool(true)
bool(false)
bool(true)
bool(false)
bool(true)
bool(false)
bool(true)
bool(false)
bool(true)
bool(false)
bool(true)
bool(false)
bool(true)
bool(false)
bool(true)
bool(false)
bool(true)
bool(false)
@@ -1,88 +0,0 @@
--TEST--
openssl_spki_verify() tests for valid signature
--INI--
error_reporting=0
--SKIPIF--
<?php
if (!extension_loaded("openssl")) die("skip");
?>
--FILE--
<?php
/* array of private key sizes to test */
$key_sizes = array(1024, 2048, 4096);
$pkeys = array();
foreach ($key_sizes as $key_size) {
$key_file = "file://" . dirname(__FILE__) . "/private_rsa_" . $key_size . ".key";
$pkeys[] = openssl_pkey_get_private($key_file);
}
/* array of available hashings to test */
$algo = array(
OPENSSL_ALGO_SHA1,
OPENSSL_ALGO_SHA224,
OPENSSL_ALGO_SHA256,
OPENSSL_ALGO_SHA384,
OPENSSL_ALGO_SHA512,
OPENSSL_ALGO_RMD160
);
/* loop over key sizes for test */
foreach ($pkeys as $pkey) {
/* loop to create and verify results */
foreach ($algo as $value) {
$spkac = openssl_spki_new($pkey, _uuid(), $value);
var_dump(openssl_spki_verify(preg_replace('/SPKAC=/', '', $spkac)));
var_dump(openssl_spki_verify($spkac . 'Make it fail'));
}
}
/* generate a random challenge */
function _uuid() {
return sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x', mt_rand(0, 0xffff),
mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0x0fff) | 0x4000,
mt_rand(0, 0x3fff) | 0x8000, mt_rand(0, 0xffff),
mt_rand(0, 0xffff), mt_rand(0, 0xffff));
}
?>
--EXPECT--
bool(true)
bool(false)
bool(true)
bool(false)
bool(true)
bool(false)
bool(true)
bool(false)
bool(true)
bool(false)
bool(true)
bool(false)
bool(true)
bool(false)
bool(true)
bool(false)
bool(true)
bool(false)
bool(true)
bool(false)
bool(true)
bool(false)
bool(true)
bool(false)
bool(true)
bool(false)
bool(true)
bool(false)
bool(true)
bool(false)
bool(true)
bool(false)
bool(true)
bool(false)
bool(true)
bool(false)
@@ -1,41 +0,0 @@
--TEST--
openssl_x509_export() tests
--SKIPIF--
<?php if (!extension_loaded("openssl")) print "skip"; ?>
--FILE--
<?php
$cert_file = dirname(__FILE__) . "/cert.crt";
$a = file_get_contents($cert_file);
$b = "file://" . $cert_file;
$c = "invalid cert";
$d = openssl_x509_read($a);
$e = array();
var_dump(openssl_x509_export($a, $output)); // read cert as a binary string
var_dump(openssl_x509_export($b, $output2)); // read cert from a filename string
var_dump(openssl_x509_export($c, $output3)); // read an invalid cert, fails
var_dump(openssl_x509_export($d, $output4)); // read cert from a resource
var_dump(openssl_x509_export($e, $output5)); // read an array, fails
var_dump(strcmp($output, $a));
var_dump(strcmp($output, $output2));
var_dump(strcmp($output, $output3));
var_dump(strcmp($output, $output4)); // different
var_dump(strcmp($output, $output5)); // different
?>
--EXPECTF--
bool(true)
bool(true)
Warning: openssl_x509_export(): cannot get cert from parameter 1 in %s on line %d
bool(false)
bool(true)
Warning: openssl_x509_export(): cannot get cert from parameter 1 in %s on line %d
bool(false)
int(0)
int(0)
int(%d)
int(0)
int(%d)
@@ -1,42 +0,0 @@
--TEST--
openssl_x509_export_to_file() tests
--SKIPIF--
<?php if (!extension_loaded("openssl")) print "skip"; ?>
--FILE--
<?php
$outfilename = dirname(__FILE__) . "/openssl_x509_export_to_file__outfilename.tmp";
$cert_file = dirname(__FILE__) . "/cert.crt";
$a = file_get_contents($cert_file);
$b = "file://" . $cert_file;
$c = "invalid cert";
$d = openssl_x509_read($a);
$e = array();
var_dump(openssl_x509_export_to_file($a, $outfilename)); // read cert as a binary string
var_dump(openssl_x509_export_to_file($b, $outfilename)); // read cert from a filename string
var_dump(openssl_x509_export_to_file($c, $outfilename)); // read an invalid cert, fails
var_dump(openssl_x509_export_to_file($d, $outfilename)); // read cert from a resource
var_dump(openssl_x509_export_to_file($e, $outfilename)); // read an array, fails
echo "---\n";
var_dump($exists = file_exists($outfilename));
?>
--CLEAN--
<?php
$outfilename = dirname(__FILE__) . "/openssl_x509_export_to_file__outfilename.tmp";
if (file_exists($outfilename)) {
unlink($outfilename);
}
?>
--EXPECTF--
bool(true)
bool(true)
Warning: openssl_x509_export_to_file(): cannot get cert from parameter 1 in %s on line %d
bool(false)
bool(true)
Warning: openssl_x509_export_to_file(): cannot get cert from parameter 1 in %s on line %d
bool(false)
---
bool(true)
@@ -1,5 +1,5 @@
--TEST--
openssl_x509_fingerprint() tests
Testing openssl_x509_fingerprint()
--SKIPIF--
<?php
if (!extension_loaded("openssl")) die("skip");
@@ -1,16 +0,0 @@
--TEST--
openssl_x509_free() tests
--SKIPIF--
<?php if (!extension_loaded("openssl")) print "skip"; ?>
--FILE--
<?php
var_dump($res = openssl_x509_read("file://" . dirname(__FILE__) . "/cert.crt"));
openssl_x509_free($res);
var_dump($res);
openssl_x509_free(false);
?>
--EXPECTF--
resource(%d) of type (OpenSSL X.509)
resource(%d) of type (Unknown)
Warning: openssl_x509_free() expects parameter 1 to be resource, boolean given in %s on line %d
@@ -1,5 +1,5 @@
--TEST--
openssl_x509_parse() tests
openssl_x509_parse() basic test
--SKIPIF--
<?php if (!extension_loaded("openssl")) print "skip";
if (OPENSSL_VERSION_NUMBER < 0x10000000) die("skip Output requires OpenSSL 1.0");
@@ -1,37 +0,0 @@
--TEST--
openssl_x509_read() tests
--SKIPIF--
<?php if (!extension_loaded("openssl")) print "skip"; ?>
--FILE--
<?php
$fp = fopen(dirname(__FILE__) . "/cert.crt","r");
$a = fread($fp,8192);
fclose($fp);
$b = "file://" . dirname(__FILE__) . "/cert.crt";
$c = "invalid cert";
$d = openssl_x509_read($a);
$e = array();
$f = array($b);
var_dump(openssl_x509_read($a)); // read cert as a string
var_dump(openssl_x509_read($b)); // read cert as a filename string
var_dump(openssl_x509_read($c)); // read an invalid cert, fails
var_dump(openssl_x509_read($d)); // read cert from a resource
var_dump(openssl_x509_read($e)); // read an array
var_dump(openssl_x509_read($f)); // read an array with the filename
?>
--EXPECTF--
resource(%d) of type (OpenSSL X.509)
resource(%d) of type (OpenSSL X.509)
Warning: openssl_x509_read(): supplied parameter cannot be coerced into an X509 certificate! in %s on line %d
bool(false)
resource(%d) of type (OpenSSL X.509)
Warning: openssl_x509_read(): supplied parameter cannot be coerced into an X509 certificate! in %s on line %d
bool(false)
Warning: openssl_x509_read(): supplied parameter cannot be coerced into an X509 certificate! in %s on line %d
bool(false)
File renamed without changes.
-27
View File
@@ -1,27 +0,0 @@
-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEArbUmVW1Y+rJzZRC3DYB0kdIgvk7MAday78ybGPPDhVlbAb4C
jWbaPs4nyUCTEt9KVG0H7pXHxDbWSsC2974zdvqlP0L2op1/M2SteTcGCBOdwGH2
jORVAZL8/WbTOf9IpKAM77oN14scsyOlQBJqhh+xrLg8ksB2dOos54yDqo0Tq7R5
tldV+alKZXWlJnqRCfFuxvqtfWI5nGTAedVZhvjQfLQQgujfXHoFWoGbXn2buzfw
KGJEeqWPbQOZF/FeOJPlgOBhhDb3BAFNVCtM3k71Rblj54pNd3yvq152xsgFd0o3
s15fuSwZgerUjeEuw/wTK9k7vyp+MrIQHQmPdQIDAQABAoIBABPDKDlP12+uHbLB
1BGVK63rWg5MqKkM5A6kGIEeOoBRSilIlMHBkdLTYXNkBVeAT9SLEvvxzmhkVLzs
b+R/nxtKKMKpu6WEhZQzQAkqWWVR1gCtJH+i+ojTUDUEHcPbZ0hTbSVY5XpAOWOo
CoTfk37u3CfqTfnkK5XhjnpJYjFk60fLeTKKG90xb4WmPGCOxBZGeI9yk+gEgMVx
4qYBQEgcaJEBXebvM0q8BCDh/rlYxwQ/q0RJ6W1D84SOeyYv/9LesFZSbnUN16tA
/YezkhYVkVIrQFzh1al7NKvWEUZ3Yx3AEuggKtijlZyO9zOAOigSiFQjtqOl7S6e
jbVfLYECgYEA51E5TNvN6IW6p58wOXTmINnsW3sDYS1CyPh3TkSvWU2OqMXJxQSA
bASpXtqicAY32wkBOiazyY/+L7x1ReG/8z3tTm53AsYwkLKrgUfjdrOFhXWk8QI3
0WS/1hS7qZ4Ycxi5B2X+rPPLnc2+mUvaEX6/B2Fjbqp4nIt+ZAE8SvcCgYEAwD47
anMk8z68wdgzxY4J10sgCKfgHCe7J8ikpzloznX1HnbZTWf74FLlA/8ctfFJCVAy
4dG1s0D+JSpxxMSkk4hvi10Ha6t5U+BreD9VPAQRspGSKhn8JfwvLfKPH65uazBP
yvBtVIdagBf/msLfF33vkrQSjAEJM1njl6XMEfMCgYB1BddqNa0G3Figol0gRC6E
Iht78FC2YdJun5yj4QWgtSbd5Sn9XRinDPiufwc8izjIu9Z+F8ROzWT3u2zMzLdy
FDswuZvFsIQzP+CaB8dgbtO2v9yQ/OFGMqUGZfjGh6+w0qoQvx3HW5MAI20wWnpY
7Xkw/6jw/JcGA2AOsb1R4wKBgQCFfnF54Q1GkEk4/m4tAA4bX4KWICUCyCAxZyXX
LYl23PhiuDr7gnqockevt8ZzHWMPQY6juyFGoZoZqtinv7lc7YAvsWEGxmMQ+KUI
Mkp4y4aSjn2GGNc8dVs5t9blNBZe/oRaMwxohzkz+/Y1vJ54TK5BHCRI7is6anAd
jTchOwKBgQDP9yOdQTfUwJRUMERWmzXWU2oDXeEMdpbGPLGJ4/e/hu1CW7bdQRoc
jBSEpn3hOodmdwdmoXtbJReMCE8qS6yVHNn4orpJf+uOBr5fVnHwttFfN8HID9js
Lml8jAAQItMFw1CEPR75NVdFb7ksNKlxE9376tG63JhrTttRGwO3CA==
-----END RSA PRIVATE KEY-----
-51
View File
@@ -1,51 +0,0 @@
-----BEGIN RSA PRIVATE KEY-----
MIIJKAIBAAKCAgEAtlmPieG4yL/HQ1j98U+VqlAzO55+aSHKXOV9q5+uTevtzXVV
s+rOPUAlPkUi7kcp3Yrum+Y0rNCnTNpSmpFB2f/Y1rHb6Rxn8SXzWSq8BM0BhbCm
yE+PY3DyIBizX6isb13vJyvU7f8Ayv4xAQ/ve8ytFAnBXUdIhtQNygraxvr8aoZw
81cBRQ8NhBkk/qDZWVkOiePC9voZ05sENhL4aUZw3Xew2JtZyw+lRxheczkYYc71
OQuOKoU06j3ZpLhdhtdjpOVC6csIk9qyq8ki8t9m66a2BdiPaz1cWGZGqQg4SDrJ
0XKG6/wdSWgdUKMp0wB2Kwph2SWwLm7BQEpdtMtXnNGB2dT+lffjtqRvyT4HKO03
R9b7ZxUVA34Tzi+kX04g3e4qI4eD0bsHYwioUlkKf/q7E1+WjwaQ2LLbOUnWeKqb
wGBsZYMWeWGTc/FO4oyDJBG9gnsqmSHasAsxsW6ojsGnz9IXywpwInlz+R4pB+ua
dXHiUZEuT8lCdBUWKAtCIb/F9cNEJg/Vq0iVoWFaOYd5D4PHXV5aXjEx18ez7GvN
98XPYNXQmVBmsIlOHQpytz0RdrlstksxBqWhaBUT3ZJU6czchNgYeFsEuYKkUNK+
fwQLhA9aeT6RBdet2efhyaf4y3vQFb5kxx4JcljXjIYVR3yB9iZnD0WGQxkCAwEA
AQKCAgBHrhkQmFxs/YY04SyhySkKFBCvpPQIG7JSphuqdVCtbMrD8xXHbcu4pBh/
y+mZRPweDFkTi4C1VigNu9ywydza9wmkC7JohjQNxV9Nc9EJChVJGlHVeADjlCh5
mXwZZFK0THaQLVi8XXtQUG+u/TaksaZvtA4Avt6xsXXiMDYj9dF3hnWsEk17ehlU
DhZOyafmyW0/ovqm31V7qvoSz446w+fmBwDLhPXdLr9HnTqzjIQbHqGi1PoDmO1e
DwYZDCgns0+GKGEPSjKK/HMzuBM26b6pb5Up4yEthKdiUIICPCrzqbhfzudeqHJS
wsyTQDBWs13AOYqRM5F4Dy2EOjdvCgt2zElO0c3r/pOTplk3/v7VrsqiNN33xGfc
4zGw3d0xLjQRhA9vhG5Kdtqqs1GqZDf3mNmPxv8gHJDdB6Twkk9iNlUnV5neew6R
0KKklZvMApE+KMVrRKmez0+ab/ktpoAe9Xox9ChBfLaZQgJlDwNDktjRu8RT1da8
L6SMy5+mP+aSKxWxgNGoM0BQiv3DBriyTuyhcu+2SIr4c0LrWqedZRI1eRREZjhG
VLBpftvQH7AMTZuIHXYjtF8XcZneaa2/fI7SNH6RpPc7WJmLCF3ufjv6HVp3qA8B
ahRCgsr4sBZDJqwMkbNJQfuF/zNOAGmO5VRBodb/P9UQeEVeAQKCAQEA6TkahKZq
374hUnElMH3mmYPVxOKfqx4EMrS+MP8cjXXmiw7bWjQlufcmbMhxHaXkGiU9+/TB
VdFPtLZvo7Aa+m2sHCySJ1pG2T4kkmV9cNVExKPllraH3/QvDK3o34aA2DxgOXAT
33wxlxvmmaMmrjjP6BZduvS/W/vwL6+aA1erZbsBuA1CoeyiyE95zdcD43+TlZWi
fwCqCZ27wrKHCPFcEN/ecpjKQTQQdogDNWdJJzaTH7y3iWNOsLdTNeLRYrvu94dS
J9n7cCoLCEFzdylaXx/jGCNrnaNtqDj46JHW6XSQ6e3D0UpV2hx5V2+0q1gbEhWe
wtBrhGsHj/jj+QKCAQEAyCiOlcE6a1tjIdMihAO1hqdUiFcIKzoiDQKNBEaY9ELz
oWkuZj2fUnhjeAKhkQ4ZheH6+fk2Tt0+kU1Jl+Iym/ciE/m/N8RUyqq2FOnmwktz
yGqD9fQeLix2b2txp+0dyi1niQ+S8ZKAJBbxKTb3CBefowrkz5JK7+jWqaUDNQ5h
8KoGCcAB8kSkXGgqVOapXyGb31YdyM3X1mJGv95jO4A+OmFI2faPAOtZrg9EicSI
7U84bfFMhfhrpxZuU7Bbyz6Kg9hleAv0q/3tBFSJvMTOiuM7OFtlUAByL+pWwZ9Y
haQ4ojojsPaQ6pMmf0JNXwnp8Rhz2+QNDyFzRm/gIQKCAQEA3dmA/S/kuAL/ZZHV
g4QvyFYdEdVVdwvtiGJgDPGPsoy1ig/O3sZ+IKEWPyKIX2B/U9ObW8Hd6wlZXZix
J68Maq3Kq15GhQKeJGa1mUDLi3qDmN4jNjNZmtKHsvL3czFZ/Nep3NldPhjAf3J9
8CW/VLkcJDSqYn4QTaqhNms/APDzTKkQIIkUmj0kN5FKV2CyBUVFGWSml1MFbHJL
ug/i3cHiBvc9fhsTQeUJyAbnrnQapR+H4ge9OwZpQzaQA9FHxjjpPzLNFrWHNZH4
vpisAm0m1xfZCQwggWqFlCDlvS2FlrtYYf3XaI3ijsDJOEA9R0RfM9u3Eq/5ppO9
NNnX2QKCAQAJ63ilk14B1BWlp4EeadClS8W0vBt7iPYHDwlOHPGXqXnJlhzmlEdB
HxZO7FJ1je1V5U069k7quaxQJzRugpdfg2/87XO8n85T/QHpJ254UqT6Wc0Qc3jL
cQitnPWVDPtc+cMX193AezI+l6R8Fm1HyWPwAKo2X1m3aiK5ZaQzDPNtqf+CnDF8
gEplCgSPEJ90R4YiG3J+cTUxOs2m1K62VDTBT/D8XGvZ79ASAE+1RDhFCpgRWtQg
D5/GOCZfn23tNLxIrIDa4jzOCVelz0rEQDy8RWa59E2hGWSPW13RWsRYWzszTw5V
xuKHvaM6y15qR2OAv2V+kF7VUSMVapYBAoIBAEyZDn9H+IMQBkRyZgxPLsE5cgd3
DeR2Txn2RxQBpop9+lgniuq/NVHiUIRscynsJ01/bFifmFNkgD2cRORy7SU+wsNr
zsWlLPO1e/axdfMsT0OIBOQ84jZ6FDGi5JnqnC8zVVPU7g2iNoDEtA7ltlXknUUX
uigFoR1CXoNz8KdW+18MtYDjBLR1crfGa+zqPOpxfjoXBhehtCKG9ZxtrBSWq6mz
lR9N5Tv9USiJW1r6+85aLsC5E9ARjAxMLhTKvD+NXbQDwZJgfM/vs1eZ6eIYMYE9
lB7kMFfHKqsagNXdyhRFzfEfx+FkKTHaqC6V5rOp6q0t8AO41ZvZO/tKdi8=
-----END RSA PRIVATE KEY-----
+1 -1
View File
@@ -10,7 +10,7 @@ $(srcdir)/pdo_sql_parser.c: $(srcdir)/pdo_sql_parser.re
(cd $(top_srcdir); $(RE2C) --no-generation-date -o ext/pdo/pdo_sql_parser.c ext/pdo/pdo_sql_parser.re)
install-pdo-headers:
@echo "Installing PDO headers: $(INSTALL_ROOT)$(phpincludedir)/ext/pdo/"
@echo "Installing PDO headers: $(INSTALL_ROOT)$(phpincludedir)/ext/pdo/"
@$(mkinstalldirs) $(INSTALL_ROOT)$(phpincludedir)/ext/pdo
@for f in $(PDO_HEADER_FILES); do \
if test -f "$(top_srcdir)/$$f"; then \
+2 -1
View File
@@ -286,6 +286,8 @@ static int pdo_dblib_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_
};
nvers = sizeof(tdsver)/sizeof(tdsver[0]);
struct pdo_data_src_parser vars[] = {
{ "charset", NULL, 0 }
,{ "appname", "PHP " PDO_DBLIB_FLAVOUR, 0 }
@@ -296,7 +298,6 @@ static int pdo_dblib_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_
};
nvars = sizeof(vars)/sizeof(vars[0]);
nvers = sizeof(tdsver)/sizeof(tdsver[0]);
php_pdo_parse_data_source(dbh->data_source, dbh->data_source_len, vars, nvars);
+7 -20
View File
@@ -103,6 +103,9 @@ static int pdo_dblib_stmt_cursor_closer(pdo_stmt_t *stmt TSRMLS_DC)
/* Cancel any pending results */
dbcancel(H->link);
efree(stmt->columns);
stmt->columns = NULL;
return 1;
}
@@ -110,6 +113,9 @@ static int pdo_dblib_stmt_dtor(pdo_stmt_t *stmt TSRMLS_DC)
{
pdo_dblib_stmt *S = (pdo_dblib_stmt*)stmt->driver_data;
efree(stmt->columns);
stmt->columns = NULL;
efree(S);
return 1;
@@ -205,7 +211,7 @@ static int pdo_dblib_stmt_describe(pdo_stmt_t *stmt, int colno TSRMLS_DC)
col->name = estrdup(fname);
col->namelen = strlen(col->name);
} else {
col->namelen = spprintf(&col->name, 0, "computed%d", colno);
col->namelen = spprintf(&col->name, NULL, "computed%d", colno);
}
col->maxlen = dbcollen(H->link, colno+1);
col->param_type = PDO_PARAM_STR;
@@ -265,25 +271,6 @@ static int pdo_dblib_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr,
*ptr = tmp_ptr;
break;
}
case SQLDATETIM4:
case SQLDATETIME: {
DBDATETIME dt;
DBDATEREC di;
dbconvert(H->link, coltype, (BYTE*) *ptr, -1, SQLDATETIME, (LPBYTE) &dt, -1);
dbdatecrack(H->link, &di, &dt);
*len = spprintf((char**) &tmp_ptr, 20, "%d-%02d-%02d %02d:%02d:%02d",
#if defined(PHP_DBLIB_IS_MSSQL) || defined(MSDBLIB)
di.year, di.month, di.day, di.hour, di.minute, di.second
#else
di.dateyear, di.datemonth+1, di.datedmonth, di.datehour, di.dateminute, di.datesecond
#endif
);
*ptr = (char*) tmp_ptr;
break;
}
default:
if (dbwillconvert(coltype, SQLCHAR)) {
tmp_len = 32 + (2 * (*len)); /* FIXME: We allocate more than we need here */
-26
View File
@@ -1,26 +0,0 @@
--TEST--
PDO_DBLIB: Does not force correct dateformat
--SKIPIF--
<?php
if (!extension_loaded('pdo_dblib')) die('skip not loaded');
require dirname(__FILE__) . '/config.inc';
?>
--FILE--
<?php
require dirname(__FILE__) . '/config.inc';
$db->query('set dateformat ymd');
$rs = $db->query("select cast('1950-01-18 23:00:00' as smalldatetime) as sdt, cast('2030-01-01 23:59:59' as datetime) as dt");
var_dump($rs->fetchAll(PDO::FETCH_ASSOC));
echo "Done.\n";
?>
--EXPECT--
array(1) {
[0]=>
array(2) {
["sdt"]=>
string(19) "1950-01-18 23:00:00"
["dt"]=>
string(19) "2030-01-01 23:59:59"
}
}
Done.
-29
View File
@@ -1,29 +0,0 @@
--TEST--
PDO_DBLIB bug #68957 PDO::query doesn't support several queries
--SKIPIF--
<?php
if (!extension_loaded('pdo_dblib')) die('skip not loaded');
require dirname(__FILE__) . '/config.inc';
?>
--FILE--
<?php
require dirname(__FILE__) . '/config.inc';
$query = "declare @myInt int = 1; select @myInt;";
$stmt = $db->query($query);
$stmt->nextRowset(); // Added line
$rows = $stmt->fetchAll();
print_r($rows);
?>
--EXPECT--
Array
(
[0] => Array
(
[computed0] => 1
[0] => 1
)
)
+2 -2
View File
@@ -11,8 +11,8 @@ require __DIR__ . '/config.inc';
$sql = "
exec dbo.sp_executesql N'
SELECT TOP 1 * FROM sysobjects
SELECT TOP 1 * FROM syscolumns
SELECT * FROM sysobjects
SELECT * FROM syscolumns
'
";
$stmt = $db->query($sql);
+13 -13
View File
@@ -658,31 +658,31 @@ static int pdo_mysql_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_
init_cmd = pdo_attr_strval(driver_options, PDO_MYSQL_ATTR_INIT_COMMAND, NULL TSRMLS_CC);
if (init_cmd) {
if (mysql_options(H->server, MYSQL_INIT_COMMAND, (const char *)init_cmd)) {
str_efree(init_cmd);
efree(init_cmd);
pdo_mysql_error(dbh);
goto cleanup;
}
str_efree(init_cmd);
efree(init_cmd);
}
#ifndef PDO_USE_MYSQLND
default_file = pdo_attr_strval(driver_options, PDO_MYSQL_ATTR_READ_DEFAULT_FILE, NULL TSRMLS_CC);
if (default_file) {
if (mysql_options(H->server, MYSQL_READ_DEFAULT_FILE, (const char *)default_file)) {
str_efree(default_file);
efree(default_file);
pdo_mysql_error(dbh);
goto cleanup;
}
str_efree(default_file);
efree(default_file);
}
default_group= pdo_attr_strval(driver_options, PDO_MYSQL_ATTR_READ_DEFAULT_GROUP, NULL TSRMLS_CC);
if (default_group) {
if (mysql_options(H->server, MYSQL_READ_DEFAULT_GROUP, (const char *)default_group)) {
str_efree(default_group);
efree(default_group);
pdo_mysql_error(dbh);
goto cleanup;
}
str_efree(default_group);
efree(default_group);
}
#endif
compress = pdo_attr_lval(driver_options, PDO_MYSQL_ATTR_COMPRESS, 0 TSRMLS_CC);
@@ -702,19 +702,19 @@ static int pdo_mysql_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_
if (ssl_key || ssl_cert || ssl_ca || ssl_capath || ssl_cipher) {
mysql_ssl_set(H->server, ssl_key, ssl_cert, ssl_ca, ssl_capath, ssl_cipher);
if (ssl_key) {
str_efree(ssl_key);
efree(ssl_key);
}
if (ssl_cert) {
str_efree(ssl_cert);
efree(ssl_cert);
}
if (ssl_ca) {
str_efree(ssl_ca);
efree(ssl_ca);
}
if (ssl_capath) {
str_efree(ssl_capath);
efree(ssl_capath);
}
if (ssl_cipher) {
str_efree(ssl_cipher);
efree(ssl_cipher);
}
}
@@ -724,10 +724,10 @@ static int pdo_mysql_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_
if (public_key) {
if (mysql_options(H->server, MYSQL_SERVER_PUBLIC_KEY, public_key)) {
pdo_mysql_error(dbh);
str_efree(public_key);
efree(public_key);
goto cleanup;
}
str_efree(public_key);
efree(public_key);
}
}
#endif
-23
View File
@@ -1,23 +0,0 @@
--TEST--
Bug #71569 (#70389 fix causes segmentation fault)
--SKIPIF--
<?php
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'skipif.inc');
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
MySQLPDOTest::skip();
?>
--FILE--
<?php
require(dirname(__FILE__). DIRECTORY_SEPARATOR . 'config.inc');
try {
new PDO(PDO_MYSQL_TEST_DSN, PDO_MYSQL_TEST_USER, PDO_MYSQL_TEST_PASS, [
PDO::MYSQL_ATTR_INIT_COMMAND => null,
]);
} catch (PDOException $e) {
echo $e->getMessage();
}
?>
--EXPECT--
SQLSTATE[42000] [1065] Query was empty
+1 -1
View File
@@ -1249,7 +1249,7 @@ PHP_MINFO_FUNCTION(pgsql)
#else
php_info_print_table_row(2, "Multibyte character support", "disabled");
#endif
#if defined(USE_SSL) || defined(USE_OPENSSL)
#ifdef USE_SSL
php_info_print_table_row(2, "SSL support", "enabled");
#else
php_info_print_table_row(2, "SSL support", "disabled");
+2 -9
View File
@@ -1791,11 +1791,8 @@ static int phar_analyze_path(const char *fname, const char *ext, int ext_len, in
#ifdef PHP_WIN32
phar_unixify_path_separators(realpath, strlen(realpath));
#endif
slash = strstr(realpath, filename);
if (slash) {
slash += ((ext - fname) + ext_len);
*slash = '\0';
}
slash = strstr(realpath, filename) + ((ext - fname) + ext_len);
*slash = '\0';
slash = strrchr(realpath, '/');
if (slash) {
@@ -2242,10 +2239,6 @@ int phar_split_fname(const char *filename, int filename_len, char **arch, int *a
#endif
int ext_len;
if (CHECK_NULL_PATH(filename, filename_len)) {
return FAILURE;
}
if (!strncasecmp(filename, "phar://", 7)) {
filename += 7;
filename_len -= 7;
+20 -20
View File
@@ -478,7 +478,7 @@ PHP_METHOD(Phar, mount)
int fname_len, arch_len, entry_len, path_len, actual_len;
phar_archive_data **pphar;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pp", &path, &path_len, &actual, &actual_len) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &path, &path_len, &actual, &actual_len) == FAILURE) {
return;
}
@@ -960,7 +960,7 @@ PHP_METHOD(Phar, createDefaultStub)
int index_len = 0, webindex_len = 0;
size_t stub_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|pp", &index, &index_len, &webindex, &webindex_len) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ss", &index, &index_len, &webindex, &webindex_len) == FAILURE) {
return;
}
@@ -1004,7 +1004,7 @@ PHP_METHOD(Phar, loadPhar)
char *fname, *alias = NULL, *error;
int fname_len, alias_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|s!", &fname, &fname_len, &alias, &alias_len) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s!", &fname, &fname_len, &alias, &alias_len) == FAILURE) {
return;
}
@@ -1083,7 +1083,7 @@ PHP_METHOD(Phar, isValidPharFilename)
int fname_len, ext_len, is_executable;
zend_bool executable = 1;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|b", &fname, &fname_len, &executable) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|b", &fname, &fname_len, &executable) == FAILURE) {
return;
}
@@ -1154,11 +1154,11 @@ PHP_METHOD(Phar, __construct)
is_data = instanceof_function(Z_OBJCE_P(zobj), phar_ce_data TSRMLS_CC);
if (is_data) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|ls!l", &fname, &fname_len, &flags, &alias, &alias_len, &format) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ls!l", &fname, &fname_len, &flags, &alias, &alias_len, &format) == FAILURE) {
return;
}
} else {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|ls!", &fname, &fname_len, &flags, &alias, &alias_len) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ls!", &fname, &fname_len, &flags, &alias, &alias_len) == FAILURE) {
return;
}
}
@@ -1326,7 +1326,7 @@ PHP_METHOD(Phar, unlinkArchive)
int fname_len, zname_len, arch_len, entry_len;
phar_archive_data *phar;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &fname, &fname_len) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &fname, &fname_len) == FAILURE) {
RETURN_FALSE;
}
@@ -1756,7 +1756,7 @@ PHP_METHOD(Phar, buildFromDirectory)
return;
}
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|s", &dir, &dir_len, &regex, &regex_len) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &dir, &dir_len, &regex, &regex_len) == FAILURE) {
RETURN_FALSE;
}
@@ -2630,7 +2630,7 @@ PHP_METHOD(Phar, delete)
return;
}
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &fname, &fname_len) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &fname, &fname_len) == FAILURE) {
RETURN_FALSE;
}
@@ -3442,7 +3442,7 @@ PHP_METHOD(Phar, copy)
PHAR_ARCHIVE_OBJECT();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "pp", &oldfile, &oldfile_len, &newfile, &newfile_len) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &oldfile, &oldfile_len, &newfile, &newfile_len) == FAILURE) {
return;
}
@@ -3548,7 +3548,7 @@ PHP_METHOD(Phar, offsetExists)
PHAR_ARCHIVE_OBJECT();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &fname, &fname_len) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &fname, &fname_len) == FAILURE) {
return;
}
@@ -3585,7 +3585,7 @@ PHP_METHOD(Phar, offsetGet)
phar_entry_info *entry;
PHAR_ARCHIVE_OBJECT();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &fname, &fname_len) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &fname, &fname_len) == FAILURE) {
return;
}
@@ -3733,8 +3733,8 @@ PHP_METHOD(Phar, offsetSet)
return;
}
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "pr", &fname, &fname_len, &zresource) == FAILURE
&& zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ps", &fname, &fname_len, &cont_str, &cont_len) == FAILURE) {
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "sr", &fname, &fname_len, &zresource) == FAILURE
&& zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &fname, &fname_len, &cont_str, &cont_len) == FAILURE) {
return;
}
@@ -3772,7 +3772,7 @@ PHP_METHOD(Phar, offsetUnset)
return;
}
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &fname, &fname_len) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &fname, &fname_len) == FAILURE) {
return;
}
@@ -3819,7 +3819,7 @@ PHP_METHOD(Phar, addEmptyDir)
PHAR_ARCHIVE_OBJECT();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &dirname, &dirname_len) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &dirname, &dirname_len) == FAILURE) {
return;
}
@@ -3844,7 +3844,7 @@ PHP_METHOD(Phar, addFile)
PHAR_ARCHIVE_OBJECT();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|s", &fname, &fname_len, &localname, &localname_len) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &fname, &fname_len, &localname, &localname_len) == FAILURE) {
return;
}
@@ -3888,7 +3888,7 @@ PHP_METHOD(Phar, addFromString)
PHAR_ARCHIVE_OBJECT();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ps", &localname, &localname_len, &cont_str, &cont_len) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &localname, &localname_len, &cont_str, &cont_len) == FAILURE) {
return;
}
@@ -4315,7 +4315,7 @@ PHP_METHOD(Phar, extractTo)
PHAR_ARCHIVE_OBJECT();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|z!b", &pathto, &pathto_len, &zval_files, &overwrite) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z!b", &pathto, &pathto_len, &zval_files, &overwrite) == FAILURE) {
return;
}
@@ -4454,7 +4454,7 @@ PHP_METHOD(PharFileInfo, __construct)
phar_archive_data *phar_data;
zval *zobj = getThis(), arg1;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p", &fname, &fname_len) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &fname, &fname_len) == FAILURE) {
return;
}
+1 -3
View File
@@ -500,9 +500,7 @@ bail:
entry.link = estrndup(hdr->linkname, linkname_len);
}
phar_set_inode(&entry TSRMLS_CC);
zend_hash_update(&myphar->manifest, entry.filename, entry.filename_len, (void*)&entry, sizeof(phar_entry_info), (void **) &newentry);
ZEND_ASSERT(newentry != NULL);
zend_hash_add(&myphar->manifest, entry.filename, entry.filename_len, (void*)&entry, sizeof(phar_entry_info), (void **) &newentry);
if (entry.is_persistent) {
++entry.manifest_pos;
+9 -9
View File
@@ -126,19 +126,19 @@ echo $e->getMessage() . "\n";
--EXPECTF--
Warning: Phar::mungServer() expects parameter 1 to be array, %string given in %sbadparameters.php on line %d
Warning: Phar::createDefaultStub() expects parameter 1 to be a valid path, array given in %sbadparameters.php on line %d
Warning: Phar::createDefaultStub() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d
Warning: Phar::loadPhar() expects parameter 1 to be a valid path, array given in %sbadparameters.php on line %d
Warning: Phar::loadPhar() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d
Warning: Phar::canCompress() expects parameter 1 to be long, %string given in %sbadparameters.php on line %d
Warning: Phar::__construct() expects parameter 1 to be a valid path, array given in %sbadparameters.php on line %d
Warning: Phar::__construct() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d
Warning: Phar::convertToExecutable() expects parameter 1 to be long, array given in %sbadparameters.php on line %d
Warning: Phar::convertToData() expects parameter 1 to be long, array given in %sbadparameters.php on line %d
Warning: PharData::delete() expects parameter 1 to be a valid path, array given in %sbadparameters.php on line %d
Warning: PharData::delete() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d
Cannot write out phar archive, phar is read-only
Entry oops does not exist and cannot be deleted
%sfiles/frontcontroller10.phar
@@ -165,18 +165,18 @@ Phar is readonly, cannot change compression
Warning: Phar::copy() expects exactly 2 parameters, 1 given in %sbadparameters.php on line %d
Cannot copy "a" to "b", phar is read-only
Warning: Phar::offsetExists() expects parameter 1 to be a valid path, array given in %sbadparameters.php on line %d
Warning: Phar::offsetExists() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d
Warning: Phar::offsetGet() expects parameter 1 to be a valid path, array given in %sbadparameters.php on line %d
Warning: Phar::offsetGet() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d
Warning: Phar::offsetSet() expects exactly 2 parameters, 1 given in %sbadparameters.php on line %d
Warning: PharData::offsetUnset() expects parameter 1 to be a valid path, array given in %sbadparameters.php on line %d
Warning: PharData::offsetUnset() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d
Write operations disabled by the php.ini setting phar.readonly
Warning: Phar::addEmptyDir() expects parameter 1 to be a valid path, array given in %sbadparameters.php on line %d
Warning: Phar::addEmptyDir() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d
Warning: Phar::addFile() expects parameter 1 to be a valid path, array given in %sbadparameters.php on line %d
Warning: Phar::addFile() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d
Warning: Phar::addFromString() expects exactly 2 parameters, 1 given in %sbadparameters.php on line %d
Write operations disabled by the php.ini setting phar.readonly
+2 -3
View File
@@ -48,12 +48,11 @@ try {
<?php
@unlink(__DIR__."/bug64931.phar");
?>
--EXPECTF--
--EXPECT--
Test
CAUGHT: Cannot create any files in magic ".phar" directory
CAUGHT: Cannot create any files in magic ".phar" directory
CAUGHT: Cannot create any files in magic ".phar" directory
CAUGHT: Cannot create any files in magic ".phar" directory
Warning: Phar::addFromString() expects parameter 1 to be a valid path, string given in %s/bug64931.php on line %d
CAUGHT: Cannot create any files in magic ".phar" directory
===DONE===
Binary file not shown.
+3 -3
View File
@@ -8,8 +8,8 @@ $p = new PharData(__DIR__."/bug71331.tar");
?>
DONE
--EXPECTF--
Fatal error: Uncaught exception 'UnexpectedValueException' with message 'phar error: "%s%ebug71331.tar" is a corrupted tar file (invalid entry size)' in %s%ebug71331.php:2
Fatal error: Uncaught exception 'UnexpectedValueException' with message 'phar error: "%s/bug71331.tar" is a corrupted tar file (invalid entry size)' in %s/bug71331.php:2
Stack trace:
#0 %s%ebug71331.php(2): PharData->__construct('%s')
#0 %s/bug71331.php(2): PharData->__construct('%s')
#1 {main}
thrown in %s%ebug71331.php on line 2
thrown in %s/bug71331.php on line 2
-1
View File
@@ -7,7 +7,6 @@ Phar: bug #71488: Stack overflow when decompressing tar archives
$p = new PharData(__DIR__."/bug71488.tar");
$newp = $p->decompress("test");
?>
DONE
--CLEAN--
<?php
-17
View File
@@ -1,17 +0,0 @@
--TEST--
Phar: bug #71498: Out-of-Bound Read in phar_parse_zipfile()
--SKIPIF--
<?php if (!extension_loaded("phar")) die("skip"); ?>
--FILE--
<?php
try {
$p = new PharData(__DIR__."/bug71498.zip");
} catch(UnexpectedValueException $e) {
echo $e->getMessage();
}
?>
DONE
--EXPECTF--
phar error: end of central directory not found in zip-based phar "%s%ebug71498.zip"
DONE
Binary file not shown.
-25
View File
@@ -1,25 +0,0 @@
--TEST--
Phar - Bug #71625 - Crash in php7.dll
--INI--
phar.readonly=0
--SKIPIF--
<?php
if (!extension_loaded("phar") || !extension_loaded("zlib")) die("skip");
if(substr(PHP_OS, 0, 3) != 'WIN' ) {
die('skip windows only test');
}
?>
--FILE--
<?php
$phar = new Phar("A:A:.phar");
$phar["hello_habr.txt"] = '<? Hello Habr!?>';
?>
DONE
--EXPECTF--
Fatal error: Uncaught exception 'UnexpectedValueException' with message 'Cannot create phar 'A:A:.phar', file extension (or combination) not recognised or the directory does not exist' in %sbug71625.php:%d
Stack trace:
#0 %sbug71625.php(%d): Phar->__construct('A:A:.phar')
#1 {main}
thrown in %sbug71625.php on line %d
Loaded 100 of 141 files, more files were not shown because too many files have changed in this diff. Show more