Skip to content

Commit 7c6ac6b

Browse files
committed
Merge remote-tracking branch 'origin/str_size_and_int64_56_backport' into str_size_and_int64
* origin/str_size_and_int64_56_backport: (23 commits) updated libs versions added some notes about the win build system UPGRADING note about bug #67072 UPGRADING note about bug #67072 UPGRADING note about bug #67072 refixed the test related to bug #67072 Improved the fix for bug #67072, thanks Nikita Fixed test case for 5328d42 These links to ~helly don't work anymore. updated NEWS updated NEWS Fixed bug #67072 Echoing unserialized "SplFileObject" crash updated UPGRADING updated UPGRADING correct the bug #67081 fix updated NEWS updated NEWS Fixed bug #67081 DOMDocumentType->internalSubset returns entire DOCTYPE tag, not only the subset updated NEWS Fixed bug #67079 Missing MIME types for XML/XSL files ...
2 parents c0faf60 + 3eaf40c commit 7c6ac6b

File tree

17 files changed

+289
-60
lines changed

17 files changed

+289
-60
lines changed

Zend/tests/generators/errors/serialize_unserialize_error.phpt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,11 @@ Stack trace:
3232
#0 %s(%d): serialize(Object(Generator))
3333
#1 {main}
3434

35-
exception 'Exception' with message 'Unserialization of 'Generator' is not allowed' in %s:%d
36-
Stack trace:
37-
#0 [internal function]: Generator->__wakeup()
38-
#1 %s(%d): unserialize('O:9:"Generator"...')
39-
#2 {main}
4035

36+
Warning: Erroneous data format for unserializing 'Generator' in %sserialize_unserialize_error.php on line %d
37+
38+
Notice: unserialize(): Error at offset 19 of 20 bytes in %sserialize_unserialize_error.php on line %s
39+
bool(false)
4140
exception 'Exception' with message 'Unserialization of 'Generator' is not allowed' in %s:%d
4241
Stack trace:
4342
#0 %s(%d): unserialize('C:9:"Generator"...')

ext/dom/documenttype.c

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,7 @@ int dom_documenttype_internal_subset_read(dom_object *obj, zval **retval TSRMLS_
188188
{
189189

190190
xmlDtdPtr dtdptr;
191-
xmlDtd *intsubset;
192-
xmlOutputBuffer *buff = NULL;
191+
xmlDtdPtr intsubset;
193192

194193
dtdptr = (xmlDtdPtr) dom_object_get_node(obj);
195194

@@ -200,22 +199,37 @@ int dom_documenttype_internal_subset_read(dom_object *obj, zval **retval TSRMLS_
200199

201200
ALLOC_ZVAL(*retval);
202201

203-
if (dtdptr->doc != NULL && ((intsubset = dtdptr->doc->intSubset) != NULL)) {
204-
buff = xmlAllocOutputBuffer(NULL);
205-
if (buff != NULL) {
206-
xmlNodeDumpOutput (buff, NULL, (xmlNodePtr) intsubset, 0, 0, NULL);
207-
xmlOutputBufferFlush(buff);
202+
if (dtdptr->doc != NULL && ((intsubset = xmlGetIntSubset(dtdptr->doc)) != NULL) && intsubset->children != NULL) {
203+
smart_str ret_buf = {0};
204+
xmlNodePtr cur = intsubset->children;
205+
206+
while (cur != NULL) {
207+
xmlOutputBuffer *buff = xmlAllocOutputBuffer(NULL);
208+
209+
if (buff != NULL) {
210+
xmlNodeDumpOutput (buff, NULL, cur, 0, 0, NULL);
211+
xmlOutputBufferFlush(buff);
212+
208213
#ifdef LIBXML2_NEW_BUFFER
209-
ZVAL_STRINGL(*retval, xmlOutputBufferGetContent(buff), xmlOutputBufferGetSize(buff), 1);
214+
smart_str_appendl(&ret_buf, xmlOutputBufferGetContent(buff), xmlOutputBufferGetSize(buff));
210215
#else
211-
ZVAL_STRINGL(*retval, buff->buffer->content, buff->buffer->use, 1);
216+
smart_str_appendl(&ret_buf, buff->buffer->content, buff->buffer->use);
212217
#endif
213-
(void)xmlOutputBufferClose(buff);
218+
219+
(void)xmlOutputBufferClose(buff);
220+
}
221+
222+
cur = cur->next;
223+
}
224+
225+
if (ret_buf.len) {
226+
ZVAL_STRINGL(*retval, ret_buf.c, ret_buf.len, 1);
227+
smart_str_free(&ret_buf);
214228
return SUCCESS;
215229
}
216230
}
217231

218-
ZVAL_EMPTY_STRING(*retval);
232+
ZVAL_NULL(*retval);
219233

220234
return SUCCESS;
221235

ext/dom/tests/DOMDocumentType_basic_001.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,6 @@ print 'notation: '.$notation->nodeName."\n";
4343
publicId: -//OASIS//DTD DocBook XML//EN
4444
systemId: docbookx.dtd
4545
name: chapter
46-
internalSubset: <!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML//EN" "docbookx.dtd">
46+
internalSubset:
4747
entity: logo
48-
notation: gif
48+
notation: gif

ext/dom/tests/bug67081.phpt

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
--TEST--
2+
Bug #67081 DOMDocumentType->internalSubset returns entire DOCTYPE tag, not only the subset
3+
--SKIPIF--
4+
<?php
5+
require_once('skipif.inc');
6+
?>
7+
--FILE--
8+
<?php
9+
$domDocument = new DOMDocument();
10+
$domDocument->load(dirname(__FILE__) . DIRECTORY_SEPARATOR . "bug67081_0.xml");
11+
var_dump($domDocument->doctype->internalSubset);
12+
13+
$domDocument = new DOMDocument();
14+
$domDocument->load(dirname(__FILE__) . DIRECTORY_SEPARATOR . "bug67081_1.xml");
15+
var_dump($domDocument->doctype->internalSubset);
16+
17+
$domDocument = new DOMDocument();
18+
$domDocument->load(dirname(__FILE__) . DIRECTORY_SEPARATOR . "bug67081_2.xml");
19+
var_dump($domDocument->doctype->internalSubset);
20+
21+
$domDocument = new DOMDocument();
22+
$domDocument->load(dirname(__FILE__) . DIRECTORY_SEPARATOR . "dom.xml");
23+
var_dump($domDocument->doctype->internalSubset);
24+
?>
25+
===DONE===
26+
--EXPECT--
27+
string(19) "<!ELEMENT a EMPTY>
28+
"
29+
string(38) "<!ELEMENT a EMPTY>
30+
<!ELEMENT b EMPTY>
31+
"
32+
NULL
33+
string(277) "<!ENTITY % incent SYSTEM "dom.ent">
34+
<!ENTITY amp "&#38;#38;">
35+
<!ENTITY gt "&#62;">
36+
<!ENTITY % coreattrs "title CDATA #IMPLIED">
37+
<!ENTITY % attrs "%coreattrs;">
38+
<!ATTLIST foo bar CDATA #IMPLIED>
39+
<!ELEMENT foo (#PCDATA)>
40+
<!ELEMENT root (foo)+>
41+
<!ATTLIST th title CDATA #IMPLIED>
42+
"
43+
===DONE===

ext/dom/tests/bug67081_0.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0"?>
2+
<!DOCTYPE a [
3+
<!ELEMENT a EMPTY>
4+
]>
5+
<a></a>
6+

ext/dom/tests/bug67081_1.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0"?>
2+
<!DOCTYPE a [
3+
<!ELEMENT a EMPTY>
4+
<!ELEMENT b EMPTY>
5+
]>
6+
<a></a>
7+

ext/dom/tests/bug67081_2.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0"?>
2+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4+
<a></a>
5+

ext/fileinfo/config.m4

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,41 @@ if test "$PHP_FILEINFO" != "no"; then
1313
libmagic/is_tar.c libmagic/magic.c libmagic/print.c \
1414
libmagic/readcdf.c libmagic/readelf.c libmagic/softmagic.c"
1515

16+
AC_MSG_CHECKING([for strcasestr])
17+
AC_TRY_RUN([
18+
#include <string.h>
19+
#include <strings.h>
20+
#include <stdlib.h>
21+
22+
int main(void)
23+
{
24+
char *s0, *s1, *ret;
25+
26+
s0 = (char *) malloc(42);
27+
s1 = (char *) malloc(8);
28+
29+
memset(s0, 'X', 42);
30+
s0[24] = 'Y';
31+
s0[26] = 'Z';
32+
s0[41] = '\0';
33+
memset(s1, 'x', 8);
34+
s1[0] = 'y';
35+
s1[2] = 'Z';
36+
s1[7] = '\0';
37+
38+
ret = strcasestr(s0, s1);
39+
40+
return !(NULL != ret);
41+
}
42+
],[
43+
dnl using the platform implementation
44+
AC_MSG_RESULT(yes)
45+
],[
46+
AC_MSG_RESULT(no)
47+
AC_MSG_NOTICE(using libmagic strcasestr implementation)
48+
libmagic_sources="$libmagic_sources libmagic/strcasestr.c"
49+
])
50+
1651
PHP_NEW_EXTENSION(fileinfo, fileinfo.c $libmagic_sources, $ext_shared,,-I@ext_srcdir@/libmagic)
1752
PHP_ADD_BUILD_DIR($ext_builddir/libmagic)
1853

ext/fileinfo/libmagic/strcasestr.c

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
/* $NetBSD: strcasestr.c,v 1.3 2005/11/29 03:12:00 christos Exp $ */
2+
3+
/*-
4+
* Copyright (c) 1990, 1993
5+
* The Regents of the University of California. All rights reserved.
6+
*
7+
* This code is derived from software contributed to Berkeley by
8+
* Chris Torek.
9+
*
10+
* Redistribution and use in source and binary forms, with or without
11+
* modification, are permitted provided that the following conditions
12+
* are met:
13+
* 1. Redistributions of source code must retain the above copyright
14+
* notice, this list of conditions and the following disclaimer.
15+
* 2. Redistributions in binary form must reproduce the above copyright
16+
* notice, this list of conditions and the following disclaimer in the
17+
* documentation and/or other materials provided with the distribution.
18+
* 3. Neither the name of the University nor the names of its contributors
19+
* may be used to endorse or promote products derived from this software
20+
* without specific prior written permission.
21+
*
22+
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25+
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28+
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29+
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31+
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32+
* SUCH DAMAGE.
33+
*/
34+
35+
#if defined(LIBC_SCCS) && !defined(lint)
36+
__RCSID("$NetBSD: strcasestr.c,v 1.3 2005/11/29 03:12:00 christos Exp $");
37+
__RCSID("$NetBSD: strncasecmp.c,v 1.2 2007/06/04 18:19:27 christos Exp $");
38+
#endif /* LIBC_SCCS and not lint */
39+
40+
#include <assert.h>
41+
#include <ctype.h>
42+
#include <string.h>
43+
44+
static int
45+
_strncasecmp(const char *s1, const char *s2, size_t n)
46+
{
47+
if (n != 0) {
48+
const unsigned char *us1 = (const unsigned char *)s1,
49+
*us2 = (const unsigned char *)s2;
50+
51+
do {
52+
if (tolower(*us1) != tolower(*us2++))
53+
return tolower(*us1) - tolower(*--us2);
54+
if (*us1++ == '\0')
55+
break;
56+
} while (--n != 0);
57+
}
58+
return 0;
59+
}
60+
61+
/*
62+
* Find the first occurrence of find in s, ignore case.
63+
*/
64+
char *
65+
strcasestr(const char *s, const char *find)
66+
{
67+
char c, sc;
68+
size_t len;
69+
70+
if ((c = *find++) != 0) {
71+
c = tolower((unsigned char)c);
72+
len = strlen(find);
73+
do {
74+
do {
75+
if ((sc = *s++) == 0)
76+
return (NULL);
77+
} while ((char)tolower((unsigned char)sc) != c);
78+
} while (_strncasecmp(s, find, len) != 0);
79+
s--;
80+
}
81+
return (char *)(intptr_t)(s);
82+
}

ext/spl/README

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ code in the file spl.php or in the corresponding .inc file in the examples
44
subdirectory. Based on the internal implementations or the files in the
55
examples subdirectory there are also some .php files to experiment with.
66

7-
For more information look at: http://php.net/~helly/php/ext/spl
7+
For more information look at: http://php.net/manual/en/book.spl.php

ext/spl/spl.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,6 @@
145145
* - Debug session 2 <a href="http://talks.somabo.de/200509_toronto_iterator_debug_session_1.pps">[pps]</a>, <a href="http://talks.somabo.de/200509_toronto_iterator_debug_session_1.pdf">[pdf]</a>, <a href="http://taks.somabo.de/200411_php_conference_frankfrurt_iterator_debug_session.swf">[swf]</a>
146146
* - Debug session 3 <a href="http://talks.somabo.de/200509_toronto_iterator_debug_session_2.pps">[pps]</a>, <a href="http://talks.somabo.de/200509_toronto_iterator_debug_session_2.pdf">[pdf]</a>
147147
*
148-
* You can download this documentation as a chm file
149-
* <a href="http://php.net/~helly/php/ext/spl/spl.chm">here</a>.
150-
*
151148
* (c) Marcus Boerger, 2003 - 2007
152149
*/
153150

ext/standard/tests/serialize/005.phpt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,11 @@ object(TestNAOld)#%d (0) {
156156
}
157157
===NANew===
158158
unserializer(TestNANew)
159-
TestNew::__wakeup()
160-
object(TestNANew)#%d (0) {
161-
}
159+
160+
Warning: Erroneous data format for unserializing 'TestNANew' in %s005.php on line %d
161+
162+
Notice: unserialize(): Error at offset 19 of 20 bytes in %s005.php on line %d
163+
bool(false)
162164
===NANew2===
163165
unserializer(TestNANew2)
164166
TestNew::unserialize()
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
--TEST--
2+
Bug #67072 Echoing unserialized "SplFileObject" crash
3+
--FILE--
4+
<?php
5+
echo unserialize('O:13:"SplFileObject":1:{s:9:"*filename";s:15:"/home/flag/flag";}');
6+
?>
7+
===DONE==
8+
--EXPECTF--
9+
Warning: Erroneous data format for unserializing 'SplFileObject' in %sbug67072.php on line %d
10+
11+
Notice: unserialize(): Error at offset 24 of 64 bytes in %sbug67072.php on line %d
12+
===DONE==

0 commit comments

Comments
 (0)