Skip to content

Commit 83e251a

Browse files
author
Yasuo Ohgaki
committed
Merge branch 'PHP-5.5' of git.php.net:php-src into PHP-5.5
* 'PHP-5.5' of git.php.net:php-src: (30 commits) Fix duplicated 5.5.2 NEWS in my tree fix typo merge news for 5.5.2 Update NEWS Update NEWS With --enable-dtrace, the correct PIC/non-PIC .o files on Solaris and Linux are now used. DTrace is part of Oracle Linux. See https://oss.oracle.com/projects/DTrace/ fix cve number New news section Prepare news for PHP-5.5.2 Reduce compiler noise by removing unused variables and labels Fixed #65431 in zend_exception.c by Sixd Reduce (some) compile noise of 'unused variable' and 'may be used uninitialized' warnings. Skip test if SKIP_ONLINE_TESTS set Fix CVE-2013-4073 - handling of certs with null bytes Fix CVE-2013-4073 - handling of certs with null bytes Fixed #65431 (Discarded qualifiers from pointer target warnings when using --enable-dtrace) by Sixd removed unused vars fixed strndup usage in the pgsql ext use mysqlnd, some tests fail otherwise ensure notices are not ignored when tests need them ...
2 parents 9d95a1a + 803045e commit 83e251a

File tree

89 files changed

+1095
-90
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+1095
-90
lines changed

NEWS

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,9 @@ PHP NEWS
33
?? ??? 2013, PHP 5.5.3
44

55
- Core:
6-
. Fixed bug #62691 (solaris sed has no -i switch). (Chris Jones)
7-
. Fixed bug #61268 (--enable-dtrace leads make to clobber
8-
Zend/zend_dtrace.d) (Chris Jones)
9-
10-
- Sessions:
11-
. Implemented strict sessions RFC (https://wiki.php.net/rfc/strict_sessions)
12-
which protects against session fixation attacks and session collisions.
13-
(Yasuo Ohgaki)
14-
- Pgsql:
15-
. Fixed bug #62978 (Disallow possible SQL injections with pg_select()/pg_update()
16-
/pg_delete()/pg_insert()). (Yasuo)
6+
. Fixed bug #62692 (PHP fails to build with DTrace). (Chris Jones, Kris Van Hees)
177

18-
?? ??? 2013, PHP 5.5.2
8+
15 Aug 2013, PHP 5.5.2
199

2010
- Core:
2111
. Fixed bug #65372 (Segfault in gc_zval_possible_root when return reference
@@ -26,22 +16,47 @@ PHP NEWS
2616
. Fixed bug #65304 (Use of max int in array_sum). (Laruence)
2717
. Fixed bug #65291 (get_defined_constants() causes PHP to crash in a very
2818
limited case). (Arpad)
19+
. Fixed bug #62691 (solaris sed has no -i switch). (Chris Jones)
20+
. Fixed bug #61345 (CGI mode - make install don't work). (Michael Heimpold)
21+
. Fixed bug #61268 (--enable-dtrace leads make to clobber
22+
Zend/zend_dtrace.d) (Chris Jones)
23+
24+
- DOM:
25+
. Added flags option to DOMDocument::schemaValidate() and
26+
DOMDocument::schemaValidateSource(). Added LIBXML_SCHEMA_CREATE flag.
27+
(Chris Wright)
2928

3029
- OPcache:
3130
. Added opcache.restrict_api configuration directive that may limit
32-
usage of OPcahce API functions only to patricular script(s). (Dmitry)
31+
usage of OPcache API functions only to particular script(s). (Dmitry)
3332
. Added support for glob symbols in blacklist entries (?, *, **).
3433
(Terry Elison, Dmitry)
3534
. Fixed bug #65338 (Enabling both php_opcache and php_wincache AVs on
3635
shutdown). (Dmitry)
3736

37+
- Openssl:
38+
. Fixed handling null bytes in subjectAltName (CVE-2013-4248).
39+
(Christian Heimes)
40+
3841
- PDO_mysql:
3942
. Fixed bug #65299 (pdo mysql parsing errors). (Johannes)
4043

44+
- Pgsql:
45+
. Fixed bug #62978 (Disallow possible SQL injections with pg_select()/pg_update()
46+
/pg_delete()/pg_insert()). (Yasuo)
47+
4148
- Phar:
4249
. Fixed bug #65028 (Phar::buildFromDirectory creates corrupt archives for
4350
some specific contents). (Stas)
4451

52+
- Sessions:
53+
. Implemented strict sessions RFC (https://wiki.php.net/rfc/strict_sessions)
54+
which protects against session fixation attacks and session collisions.
55+
(Yasuo Ohgaki)
56+
. Fixed possible buffer overflow under Windows. Note: Not a security fix.
57+
(Yasuo)
58+
. Changed session.auto_start to PHP_INI_PERDIR. (Yasuo)
59+
4560
- SOAP:
4661
. Fixed bug #65018 (SoapHeader problems with SoapServer). (Dmitry)
4762

UPGRADING

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,10 @@ PHP 5.5 UPGRADE NOTES
182182
- Since 5.5.2, spl_autoload_functions() returns different names for
183183
different lambda functions registered via spl_autoload_register().
184184

185+
- Since 5.5.3, DOMDocument::schemaValidateSource() and
186+
DOMDocument::schemaValidate() accept flag parameter. Only flag
187+
available now is LIBXML_SCHEMA_CREATE. Default is 0.
188+
185189
========================================
186190
5. New Functions
187191
========================================

Zend/zend.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1098,7 +1098,7 @@ ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
10981098
if(DTRACE_ERROR_ENABLED()) {
10991099
char *dtrace_error_buffer;
11001100
zend_vspprintf(&dtrace_error_buffer, 0, format, args);
1101-
DTRACE_ERROR(dtrace_error_buffer, error_filename, error_lineno);
1101+
DTRACE_ERROR(dtrace_error_buffer, (char *)error_filename, error_lineno);
11021102
efree(dtrace_error_buffer);
11031103
}
11041104
#endif /* HAVE_DTRACE */

Zend/zend_dtrace.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
#ifdef HAVE_DTRACE
2626
/* PHP DTrace probes {{{ */
27-
static inline char *dtrace_get_executed_filename(TSRMLS_D)
27+
static inline const char *dtrace_get_executed_filename(TSRMLS_D)
2828
{
2929
if (EG(current_execute_data) && EG(current_execute_data)->op_array) {
3030
return EG(current_execute_data)->op_array->filename;
@@ -36,9 +36,9 @@ static inline char *dtrace_get_executed_filename(TSRMLS_D)
3636
ZEND_API zend_op_array *dtrace_compile_file(zend_file_handle *file_handle, int type TSRMLS_DC)
3737
{
3838
zend_op_array *res;
39-
DTRACE_COMPILE_FILE_ENTRY(file_handle->opened_path, file_handle->filename);
39+
DTRACE_COMPILE_FILE_ENTRY(file_handle->opened_path, (char *)file_handle->filename);
4040
res = compile_file(file_handle, type TSRMLS_CC);
41-
DTRACE_COMPILE_FILE_RETURN(file_handle->opened_path, file_handle->filename);
41+
DTRACE_COMPILE_FILE_RETURN(file_handle->opened_path, (char *)file_handle->filename);
4242

4343
return res;
4444
}
@@ -47,7 +47,7 @@ ZEND_API zend_op_array *dtrace_compile_file(zend_file_handle *file_handle, int t
4747
ZEND_API void dtrace_execute_ex(zend_execute_data *execute_data TSRMLS_DC)
4848
{
4949
int lineno;
50-
char *scope, *filename, *funcname, *classname;
50+
const char *scope, *filename, *funcname, *classname;
5151
scope = filename = funcname = classname = NULL;
5252

5353
/* we need filename and lineno for both execute and function probes */
@@ -65,41 +65,41 @@ ZEND_API void dtrace_execute_ex(zend_execute_data *execute_data TSRMLS_DC)
6565
}
6666

6767
if (DTRACE_EXECUTE_ENTRY_ENABLED()) {
68-
DTRACE_EXECUTE_ENTRY(filename, lineno);
68+
DTRACE_EXECUTE_ENTRY((char *)filename, lineno);
6969
}
7070

7171
if (DTRACE_FUNCTION_ENTRY_ENABLED() && funcname != NULL) {
72-
DTRACE_FUNCTION_ENTRY(funcname, filename, lineno, classname, scope);
72+
DTRACE_FUNCTION_ENTRY((char *)funcname, (char *)filename, lineno, (char *)classname, (char *)scope);
7373
}
7474

7575
execute_ex(execute_data TSRMLS_CC);
7676

7777
if (DTRACE_FUNCTION_RETURN_ENABLED() && funcname != NULL) {
78-
DTRACE_FUNCTION_RETURN(funcname, filename, lineno, classname, scope);
78+
DTRACE_FUNCTION_RETURN((char *)funcname, (char *)filename, lineno, (char *)classname, (char *)scope);
7979
}
8080

8181
if (DTRACE_EXECUTE_RETURN_ENABLED()) {
82-
DTRACE_EXECUTE_RETURN(filename, lineno);
82+
DTRACE_EXECUTE_RETURN((char *)filename, lineno);
8383
}
8484
}
8585

8686
ZEND_API void dtrace_execute_internal(zend_execute_data *execute_data_ptr, zend_fcall_info *fci, int return_value_used TSRMLS_DC)
8787
{
8888
int lineno;
89-
char *filename;
89+
const char *filename;
9090
if (DTRACE_EXECUTE_ENTRY_ENABLED() || DTRACE_EXECUTE_RETURN_ENABLED()) {
9191
filename = dtrace_get_executed_filename(TSRMLS_C);
9292
lineno = zend_get_executed_lineno(TSRMLS_C);
9393
}
9494

9595
if (DTRACE_EXECUTE_ENTRY_ENABLED()) {
96-
DTRACE_EXECUTE_ENTRY(filename, lineno);
96+
DTRACE_EXECUTE_ENTRY((char *)filename, lineno);
9797
}
9898

9999
execute_internal(execute_data_ptr, fci, return_value_used TSRMLS_CC);
100100

101101
if (DTRACE_EXECUTE_RETURN_ENABLED()) {
102-
DTRACE_EXECUTE_RETURN(filename, lineno);
102+
DTRACE_EXECUTE_RETURN((char *)filename, lineno);
103103
}
104104
}
105105

Zend/zend_exceptions.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,12 @@ void zend_throw_exception_internal(zval *exception TSRMLS_DC) /* {{{ */
8585
{
8686
#ifdef HAVE_DTRACE
8787
if (DTRACE_EXCEPTION_THROWN_ENABLED()) {
88-
char *classname;
89-
int name_len;
88+
const char *classname;
89+
zend_uint name_len;
9090

9191
if (exception != NULL) {
9292
zend_get_object_classname(exception, &classname, &name_len TSRMLS_CC);
93-
DTRACE_EXCEPTION_THROWN(classname);
93+
DTRACE_EXCEPTION_THROWN((char *)classname);
9494
} else {
9595
DTRACE_EXCEPTION_THROWN(NULL);
9696
}

Zend/zend_vm_def.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3010,7 +3010,7 @@ ZEND_VM_HANDLER(107, ZEND_CATCH, CONST, CV)
30103010

30113011
#ifdef HAVE_DTRACE
30123012
if (DTRACE_EXCEPTION_CAUGHT_ENABLED()) {
3013-
DTRACE_EXCEPTION_CAUGHT(ce->name);
3013+
DTRACE_EXCEPTION_CAUGHT((char *)ce->name);
30143014
}
30153015
#endif /* HAVE_DTRACE */
30163016

Zend/zend_vm_execute.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7121,7 +7121,7 @@ static int ZEND_FASTCALL ZEND_CATCH_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_A
71217121

71227122
#ifdef HAVE_DTRACE
71237123
if (DTRACE_EXCEPTION_CAUGHT_ENABLED()) {
7124-
DTRACE_EXCEPTION_CAUGHT(ce->name);
7124+
DTRACE_EXCEPTION_CAUGHT((char *)ce->name);
71257125
}
71267126
#endif /* HAVE_DTRACE */
71277127

acinclude.m4

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2925,17 +2925,17 @@ dnl providerdesc
29252925
dnl header-file
29262926
ac_hdrobj=$2
29272927
2928-
dnl Add providerdesc.o into global objects when needed
2928+
dnl Add providerdesc.o or .lo into global objects when needed
29292929
case $host_alias in
29302930
*freebsd*)
29312931
PHP_GLOBAL_OBJS="[$]PHP_GLOBAL_OBJS [$]ac_bdir[$]ac_provsrc.o"
29322932
PHP_LDFLAGS="$PHP_LDFLAGS -lelf"
29332933
;;
29342934
*solaris*)
2935-
PHP_GLOBAL_OBJS="[$]PHP_GLOBAL_OBJS [$]ac_bdir[$]ac_provsrc.o"
2935+
PHP_GLOBAL_OBJS="[$]PHP_GLOBAL_OBJS [$]ac_bdir[$]ac_provsrc.lo"
29362936
;;
29372937
*linux*)
2938-
PHP_GLOBAL_OBJS="[$]PHP_GLOBAL_OBJS [$]ac_bdir[$]ac_provsrc.o"
2938+
PHP_GLOBAL_OBJS="[$]PHP_GLOBAL_OBJS [$]ac_bdir[$]ac_provsrc.lo"
29392939
;;
29402940
esac
29412941
@@ -2969,12 +2969,46 @@ dnl in GNU Make which causes the .d file to be overwritten (Bug 61268)
29692969
$abs_srcdir/$ac_provsrc:;
29702970
29712971
$ac_bdir[$]ac_hdrobj: $abs_srcdir/$ac_provsrc
2972-
CFLAGS="\$(CFLAGS_CLEAN)" dtrace -h -C -s $ac_srcdir[$]ac_provsrc -o \$[]@.bak && \$(SED) 's,PHP_,DTRACE_,g' \$[]@.bak > \$[]@
2972+
CFLAGS="\$(CFLAGS_CLEAN)" dtrace -h -C -s $ac_srcdir[$]ac_provsrc -o \$[]@.bak && \$(SED) -e 's,PHP_,DTRACE_,g' \$[]@.bak > \$[]@
29732973
29742974
\$(PHP_DTRACE_OBJS): $ac_bdir[$]ac_hdrobj
29752975
2976+
EOF
2977+
2978+
case $host_alias in
2979+
*solaris*|*linux*)
2980+
dtrace_prov_name="`echo $ac_provsrc | $SED -e 's#\(.*\)\/##'`.o"
2981+
dtrace_lib_dir="`echo $ac_bdir[$]ac_provsrc | $SED -e 's#\(.*\)/[^/]*#\1#'`/.libs"
2982+
dtrace_d_obj="`echo $ac_bdir[$]ac_provsrc | $SED -e 's#\(.*\)/\([^/]*\)#\1/.libs/\2#'`.o"
2983+
dtrace_nolib_objs='$(PHP_DTRACE_OBJS:.lo=.o)'
2984+
for ac_lo in $PHP_DTRACE_OBJS; do
2985+
dtrace_lib_objs="[$]dtrace_lib_objs `echo $ac_lo | $SED -e 's,\.lo$,.o,' -e 's#\(.*\)\/#\1\/.libs\/#'`"
2986+
done;
2987+
dnl Always attempt to create both PIC and non-PIC DTrace objects (Bug 63692)
2988+
cat>>Makefile.objects<<EOF
2989+
$ac_bdir[$]ac_provsrc.lo: \$(PHP_DTRACE_OBJS)
2990+
echo "[#] Generated by Makefile for libtool" > \$[]@
2991+
@test -d "$dtrace_lib_dir" || mkdir $dtrace_lib_dir
2992+
if CFLAGS="\$(CFLAGS_CLEAN)" dtrace -G -o $dtrace_d_obj -s $abs_srcdir/$ac_provsrc $dtrace_lib_objs 2> /dev/null && test -f "$dtrace_d_obj"; then [\\]
2993+
echo "pic_object=['].libs/$dtrace_prov_name[']" >> \$[]@ [;\\]
2994+
else [\\]
2995+
echo "pic_object='none'" >> \$[]@ [;\\]
2996+
fi
2997+
if CFLAGS="\$(CFLAGS_CLEAN)" dtrace -G -o $ac_bdir[$]ac_provsrc.o -s $abs_srcdir/$ac_provsrc $dtrace_nolib_objs 2> /dev/null && test -f "$ac_bdir[$]ac_provsrc.o"; then [\\]
2998+
echo "non_pic_object=[']$dtrace_prov_name[']" >> \$[]@ [;\\]
2999+
else [\\]
3000+
echo "non_pic_object='none'" >> \$[]@ [;\\]
3001+
fi
3002+
3003+
EOF
3004+
3005+
;;
3006+
*)
3007+
cat>>Makefile.objects<<EOF
29763008
$ac_bdir[$]ac_provsrc.o: \$(PHP_DTRACE_OBJS)
29773009
CFLAGS="\$(CFLAGS_CLEAN)" dtrace -G -o \$[]@ -s $abs_srcdir/$ac_provsrc $dtrace_objs
29783010
29793011
EOF
3012+
;;
3013+
esac
29803014
])

ext/date/php_date.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,7 +1041,7 @@ char *php_date_short_day_name(timelib_sll y, timelib_sll m, timelib_sll d)
10411041
static char *date_format(char *format, int format_len, timelib_time *t, int localtime)
10421042
{
10431043
smart_str string = {0};
1044-
int i, length;
1044+
int i, length = 0;
10451045
char buffer[97];
10461046
timelib_time_offset *offset = NULL;
10471047
timelib_sll isoweek, isoyear;
@@ -2538,8 +2538,8 @@ PHPAPI int php_date_initialize(php_date_obj *dateobj, /*const*/ char *time_str,
25382538
timelib_time *now;
25392539
timelib_tzinfo *tzi = NULL;
25402540
timelib_error_container *err = NULL;
2541-
int type = TIMELIB_ZONETYPE_ID, new_dst;
2542-
char *new_abbr;
2541+
int type = TIMELIB_ZONETYPE_ID, new_dst = 0;
2542+
char *new_abbr = NULL;
25432543
timelib_sll new_offset;
25442544

25452545
if (dateobj->time) {

ext/dom/document.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1973,14 +1973,15 @@ static void _dom_document_schema_validate(INTERNAL_FUNCTION_PARAMETERS, int type
19731973
xmlDoc *docp;
19741974
dom_object *intern;
19751975
char *source = NULL, *valid_file = NULL;
1976-
int source_len = 0;
1976+
int source_len = 0, valid_opts = 0;
1977+
long flags = 0;
19771978
xmlSchemaParserCtxtPtr parser;
19781979
xmlSchemaPtr sptr;
19791980
xmlSchemaValidCtxtPtr vptr;
19801981
int is_valid;
19811982
char resolved_path[MAXPATHLEN + 1];
19821983

1983-
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Op", &id, dom_document_class_entry, &source, &source_len) == FAILURE) {
1984+
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Op|l", &id, dom_document_class_entry, &source, &source_len, &flags) == FAILURE) {
19841985
return;
19851986
}
19861987

@@ -2029,6 +2030,13 @@ static void _dom_document_schema_validate(INTERNAL_FUNCTION_PARAMETERS, int type
20292030
RETURN_FALSE;
20302031
}
20312032

2033+
#if LIBXML_VERSION >= 20614
2034+
if (flags & XML_SCHEMA_VAL_VC_I_CREATE) {
2035+
valid_opts |= XML_SCHEMA_VAL_VC_I_CREATE;
2036+
}
2037+
#endif
2038+
2039+
xmlSchemaSetValidOptions(vptr, valid_opts);
20322040
xmlSchemaSetValidErrors(vptr, php_libxml_error_handler, php_libxml_error_handler, vptr);
20332041
is_valid = xmlSchemaValidateDoc(vptr, docp);
20342042
xmlSchemaFree(sptr);
@@ -2042,14 +2050,14 @@ static void _dom_document_schema_validate(INTERNAL_FUNCTION_PARAMETERS, int type
20422050
}
20432051
/* }}} */
20442052

2045-
/* {{{ proto boolean dom_document_schema_validate_file(string filename); */
2053+
/* {{{ proto boolean dom_document_schema_validate_file(string filename, int flags); */
20462054
PHP_FUNCTION(dom_document_schema_validate_file)
20472055
{
20482056
_dom_document_schema_validate(INTERNAL_FUNCTION_PARAM_PASSTHRU, DOM_LOAD_FILE);
20492057
}
20502058
/* }}} end dom_document_schema_validate_file */
20512059

2052-
/* {{{ proto boolean dom_document_schema_validate(string source); */
2060+
/* {{{ proto boolean dom_document_schema_validate(string source, int flags); */
20532061
PHP_FUNCTION(dom_document_schema_validate_xml)
20542062
{
20552063
_dom_document_schema_validate(INTERNAL_FUNCTION_PARAM_PASSTHRU, DOM_LOAD_STRING);
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
--TEST--
2+
Test DOMDocument::loadXML() basic behavior
3+
--DESCRIPTION--
4+
This test verifies the basic behaviour of the method
5+
Environment variables used in the test:
6+
- XML_FILE: the xml file to load
7+
- LOAD_OPTIONS: the second parameter to pass to the method
8+
- EXPECTED_RESULT: the expected result
9+
--CREDITS--
10+
Antonio Diaz Ruiz <dejalatele@gmail.com>
11+
--INI--
12+
assert.bail=true
13+
--SKIPIF--
14+
<?php include('skipif.inc'); ?>
15+
--ENV--
16+
XML_FILE=/book.xml
17+
LOAD_OPTIONS=0
18+
EXPECTED_RESULT=1
19+
--FILE_EXTERNAL--
20+
domdocumentloadxml_test_method.php
21+
--EXPECT--
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
--TEST--
2+
Test DOMDocument::loadXML() detects not-well formed XML
3+
--DESCRIPTION--
4+
This test verifies the method detects an opening and ending tag mismatch
5+
Environment variables used in the test:
6+
- XML_FILE: the xml file to load
7+
- LOAD_OPTIONS: the second parameter to pass to the method
8+
- EXPECTED_RESULT: the expected result
9+
--CREDITS--
10+
Antonio Diaz Ruiz <dejalatele@gmail.com>
11+
--INI--
12+
assert.bail=true
13+
--SKIPIF--
14+
<?php include('skipif.inc'); ?>
15+
--ENV--
16+
XML_FILE=/not_well_formed.xml
17+
LOAD_OPTIONS=0
18+
EXPECTED_RESULT=0
19+
--FILE_EXTERNAL--
20+
domdocumentloadxml_test_method.php
21+
--EXPECTF--
22+
Warning: DOMDocument::load%r(XML){0,1}%r(): Opening and ending tag mismatch: title line 5 and book %s
23+
24+
Warning: DOMDocument::load%r(XML){0,1}%r(): expected '>' %s
25+
26+
Warning: DOMDocument::load%r(XML){0,1}%r(): Premature end of data in tag books %s

0 commit comments

Comments
 (0)