Skip to content

Commit

Permalink
Merge branch 'master' into str_size_and_int64
Browse files Browse the repository at this point in the history
* master: (79 commits)
  ldap_escape() notes
  Increment version number, since this will be 5.5.6.
  Added Zend Debugger to the note about the load order (by trash4you at online dot de)
  Added a LICENSE file to make it easier for PECL binary distributions to conform with the license.
  Fix Coverity issue reporting wrong sizeof()
  Fixed bug #65939 (Space before ";" breaks php.ini parsing). (brainstorm at nopcode dot org)
  exif NEWS
  add tests for bug #62523
  Merged PR #293 (Exif crash on unknown encoding was fixed) By: 	Draal Conflicts: 	configure.in 	main/php_version.h
  fix bug #65936 (dangling context pointer causes crash)
  remove TRAVIS check in test source
  Fixed compilation warning
  Just SKIP that test on travis
  Fixed issue #115 (path issue when using phar).
  fix memory leak on error (from Coverity scan)
  fix argument type & remove warning
  fix const warnings in intl methods
  Fix coverity issue with -1 returned by findOffset not being handled by getPreferredTag
  fix possibility of access to *storedType without initialization
  Fix coverity issue with -1 returned by findOffset not being handled by getPreferredTag
  ...

Conflicts:
	Zend/zend_compile.c
	ext/intl/collator/collator_create.c
	ext/intl/locale/locale_methods.c
	ext/intl/msgformat/msgformat_format.c
	ext/intl/msgformat/msgformat_parse.c
  • Loading branch information
weltling committed Oct 25, 2013
2 parents f0fdb82 + dfe4b15 commit 4fc7dc6
Show file tree
Hide file tree
Showing 126 changed files with 1,053 additions and 906 deletions.
1 change: 1 addition & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ PHP NEWS
- Openssl:
. Added crypto_method option for the ssl stream context. (Martin Jansen)
. Added certificate fingerprint support. (Tjerk Meesters)
. Added explicit TLSv1.1 and TLSv1.2 stream transports. (Daniel Lowrey)
. Fixed bug #65729 (CN_match gives false positive). (Tjerk Meesters)

- PDO_pgsql:
Expand Down
6 changes: 6 additions & 0 deletions UPGRADING
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ PHP X.Y UPGRADE NOTES
- Openssl:
Added string openssl_x509_fingerprint($x509, $type, $binary).

- LDAP:
Added ldap_escape($value, $ignore = "", $flags = 0).

========================================
6. New Classes and Interfaces
========================================
Expand Down Expand Up @@ -113,6 +116,9 @@ PHP X.Y UPGRADE NOTES
9. New Global Constants
========================================

- LDAP:
LDAP_ESCAPE_FILTER int(1)
LDAP_ESCAPE_DN int(2)

========================================
10. Changes to INI File Handling
Expand Down
6 changes: 3 additions & 3 deletions Zend/RFCs/003.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ Modified: 2001-09-17
1. Background/Need
==================

Many internal function of PHP will reject parameters because of their
Many internal functions of PHP will reject parameters because of their
type (the array and variable function come to mind). For userland
this is not an easy task as there is no uniform way to do it. An
addition to the engine for requiring loose types would allow
delevopers to know that the data passed to their functions is of the
developers to know that the data passed to their functions are of the
correct type and reduce the need for duplicating the same code in
every function to check for the type of data.

Expand Down Expand Up @@ -57,7 +57,7 @@ function foo (array $var){
===========

Mis-matches in type should be reported as fatal errors and should halt
the execution of a script as that function can not be run and code
the execution of a script as that function cannot be run and code
following could not reliably run.


Expand Down
20 changes: 20 additions & 0 deletions Zend/tests/bug65911.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
--TEST--
Bug #65911 (scope resolution operator - strange behavior with $this)
--FILE--
<?php
class A {}

class B
{
public function go()
{
$this->foo = 'bar';
echo A::$this->foo; // should not output 'bar'
}
}

$obj = new B();
$obj->go();
?>
--EXPECTF--
Fatal error: Access to undeclared static property: A::$this in %s on line %d
273 changes: 137 additions & 136 deletions Zend/zend_compile.c

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Zend/zend_language_parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ inner_statement:
statement
| function_declaration_statement
| class_declaration_statement
| T_HALT_COMPILER '(' ')' ';' { zend_error(E_COMPILE_ERROR, "__HALT_COMPILER() can only be used from the outermost scope"); }
| T_HALT_COMPILER '(' ')' ';' { zend_error_noreturn(E_COMPILE_ERROR, "__HALT_COMPILER() can only be used from the outermost scope"); }
;


Expand Down Expand Up @@ -1202,7 +1202,7 @@ isset_variables:

isset_variable:
variable { zend_do_isset_or_isempty(ZEND_ISSET, &$$, &$1 TSRMLS_CC); }
| expr_without_variable { zend_error(E_COMPILE_ERROR, "Cannot use isset() on the result of an expression (you can use \"null !== expression\" instead)"); }
| expr_without_variable { zend_error_noreturn(E_COMPILE_ERROR, "Cannot use isset() on the result of an expression (you can use \"null !== expression\" instead)"); }
;

class_constant:
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_multibyte.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ static size_t dummy_encoding_converter(unsigned char **to, size_t *to_length, co
static int dummy_encoding_list_parser(const char *encoding_list, size_t encoding_list_len, const zend_encoding ***return_list, size_t *return_size, int persistent TSRMLS_DC)
{
*return_list = pemalloc(0, persistent);
return_size = 0;
*return_size = 0;
return SUCCESS;
}

Expand Down
4 changes: 2 additions & 2 deletions Zend/zend_opcode.c
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ static void zend_check_finally_breakout(zend_op_array *op_array, zend_uint op_nu
CG(in_compilation) = 1;
CG(active_op_array) = op_array;
CG(zend_lineno) = op_array->opcodes[op_num].lineno;
zend_error(E_COMPILE_ERROR, "jump out of a finally block is disallowed");
zend_error_noreturn(E_COMPILE_ERROR, "jump out of a finally block is disallowed");
}
}
}
Expand Down Expand Up @@ -710,7 +710,7 @@ ZEND_API int pass_two(zend_op_array *op_array TSRMLS_DC)
if (op_array->fn_flags & ZEND_ACC_GENERATOR) {
if (opline->op1_type != IS_CONST || Z_TYPE_P(opline->op1.zv) != IS_NULL) {
CG(zend_lineno) = opline->lineno;
zend_error(E_COMPILE_ERROR, "Generators cannot return values using \"return\"");
zend_error_noreturn(E_COMPILE_ERROR, "Generators cannot return values using \"return\"");
}

opline->opcode = ZEND_GENERATOR_RETURN;
Expand Down
1 change: 1 addition & 0 deletions ext/bz2/bz2_filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ static php_stream_filter_status_t php_bz2_decompress_filter(
status = BZ2_bzDecompressInit(streamp, 0, data->small_footprint);

if (BZ_OK != status) {
php_stream_bucket_delref(bucket TSRMLS_CC);
return PSFS_ERR_FATAL;
}

Expand Down
1 change: 1 addition & 0 deletions ext/date/php_date.c
Original file line number Diff line number Diff line change
Expand Up @@ -1406,6 +1406,7 @@ PHPAPI signed long php_parse_date(char *string, signed long *now)

parsed_time = timelib_strtotime(string, strlen(string), &error, DATE_TIMEZONEDB, php_date_parse_tzfile_wrapper);
if (error->error_count) {
timelib_time_dtor(parsed_time);
timelib_error_container_dtor(error);
return -1;
}
Expand Down
9 changes: 6 additions & 3 deletions ext/dba/dba.c
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,8 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
char *file_mode;
char mode[4], *pmode, *lock_file_mode = NULL;
int persistent_flag = persistent ? STREAM_OPEN_PERSISTENT : 0;
char *opened_path, *lock_name;
char *opened_path = NULL;
char *lock_name;

if(ac < 2) {
WRONG_PARAM_COUNT;
Expand Down Expand Up @@ -848,8 +849,10 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
if (!persistent) {
info->lock.name = opened_path;
} else {
info->lock.name = pestrdup(opened_path, persistent);
efree(opened_path);
if (opened_path) {
info->lock.name = pestrdup(opened_path, persistent);
efree(opened_path);
}
}
}
}
Expand Down
12 changes: 7 additions & 5 deletions ext/exif/exif.c
Original file line number Diff line number Diff line change
Expand Up @@ -2633,14 +2633,15 @@ static int exif_process_user_comment(image_info_type *ImageInfo, char **pszInfoP
} else {
decode = ImageInfo->decode_unicode_le;
}
/* XXX this will fail again if encoding_converter returns on error something different than SIZE_MAX */
if (zend_multibyte_encoding_converter(
(unsigned char**)pszInfoPtr,
&len,
(unsigned char*)szValuePtr,
ByteCount,
zend_multibyte_fetch_encoding(ImageInfo->encode_unicode TSRMLS_CC),
zend_multibyte_fetch_encoding(decode TSRMLS_CC)
TSRMLS_CC) < 0) {
TSRMLS_CC) == (size_t)-1) {
len = exif_process_string_raw(pszInfoPtr, szValuePtr, ByteCount);
}
return len;
Expand All @@ -2653,14 +2654,15 @@ static int exif_process_user_comment(image_info_type *ImageInfo, char **pszInfoP
*pszEncoding = estrdup((const char*)szValuePtr);
szValuePtr = szValuePtr+8;
ByteCount -= 8;
/* XXX this will fail again if encoding_converter returns on error something different than SIZE_MAX */
if (zend_multibyte_encoding_converter(
(unsigned char**)pszInfoPtr,
&len,
(unsigned char*)szValuePtr,
ByteCount,
zend_multibyte_fetch_encoding(ImageInfo->encode_jis TSRMLS_CC),
zend_multibyte_fetch_encoding(ImageInfo->motorola_intel ? ImageInfo->decode_jis_be : ImageInfo->decode_jis_le TSRMLS_CC)
TSRMLS_CC) < 0) {
TSRMLS_CC) == (size_t)-1) {
len = exif_process_string_raw(pszInfoPtr, szValuePtr, ByteCount);
}
return len;
Expand Down Expand Up @@ -2690,16 +2692,16 @@ static int exif_process_user_comment(image_info_type *ImageInfo, char **pszInfoP
static int exif_process_unicode(image_info_type *ImageInfo, xp_field_type *xp_field, int tag, char *szValuePtr, int ByteCount TSRMLS_DC)
{
xp_field->tag = tag;

/* Copy the comment */
/* XXX this will fail again if encoding_converter returns on error something different than SIZE_MAX */
if (zend_multibyte_encoding_converter(
(unsigned char**)&xp_field->value,
&xp_field->size,
(unsigned char*)szValuePtr,
ByteCount,
zend_multibyte_fetch_encoding(ImageInfo->encode_unicode TSRMLS_CC),
zend_multibyte_fetch_encoding(ImageInfo->motorola_intel ? ImageInfo->decode_unicode_be : ImageInfo->decode_unicode_le TSRMLS_CC)
TSRMLS_CC) < 0) {
TSRMLS_CC) == (size_t)-1) {
xp_field->size = exif_process_string_raw(&xp_field->value, szValuePtr, ByteCount);
}
return xp_field->size;
Expand Down
9 changes: 9 additions & 0 deletions ext/exif/tests/bug62523_1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions ext/exif/tests/bug62523_1.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
--TEST--
Bug 62523 (php crashes with segfault when exif_read_data called)
--SKIPIF--
<?php
extension_loaded("exif") or die("skip need exif");
?>
--FILE--
<?php
echo "Test\n";
var_dump(count(exif_read_data(__DIR__."/bug62523_1.jpg")));
?>
Done
--EXPECTF--
Test

Warning: exif_read_data(bug62523_1.jpg): File not supported in %sbug62523_1.php on line %d
int(1)
Done
Binary file added ext/exif/tests/bug62523_2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions ext/exif/tests/bug62523_2.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
--TEST--
Bug 62523 (php crashes with segfault when exif_read_data called)
--SKIPIF--
<?php
extension_loaded("exif") or die("skip need exif");
?>
--FILE--
<?php
echo "Test\n";
var_dump(count(exif_read_data(__DIR__."/bug62523_2.jpg")));
?>
Done
--EXPECT--
Test
int(76)
Done
12 changes: 12 additions & 0 deletions ext/exif/tests/bug62523_3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions ext/exif/tests/bug62523_3.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
--TEST--
Bug 62523 (php crashes with segfault when exif_read_data called)
--SKIPIF--
<?php
extension_loaded("exif") or die("skip need exif");
?>
--FILE--
<?php
echo "Test\n";
var_dump(count(exif_read_data(__DIR__."/bug62523_3.jpg")));
?>
Done
--EXPECTF--
Test

Warning: exif_read_data(bug62523_3.jpg): File not supported in %sbug62523_3.php on line %d
int(1)
Done
Binary file added ext/exif/tests/exif_encoding_crash.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions ext/exif/tests/exif_encoding_crash.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
--TEST--
PHP crash when zend_multibyte_encoding_converter returns (size_t)-1)
--SKIPIF--
<?php if (!extension_loaded('exif')) print 'skip exif extension not available';?>
--FILE--
<?php
$infile = dirname(__FILE__).'/exif_encoding_crash.jpg';
$exif_data = exif_read_data($infile);
echo "*** no core dump ***\n";
?>
===DONE===
--EXPECT--
*** no core dump ***
===DONE===
2 changes: 1 addition & 1 deletion ext/filter/logical_filters.c
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ void php_filter_validate_ip(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
if (flags & FILTER_FLAG_NO_RES_RANGE) {
if (
(ip[0] == 0) ||
(ip[0] == 100 && (ip[1] >= 64 || ip[1] <= 127)) ||
(ip[0] == 100 && (ip[1] >= 64 && ip[1] <= 127)) ||
(ip[0] == 128 && ip[1] == 0) ||
(ip[0] == 191 && ip[1] == 255) ||
(ip[0] == 169 && ip[1] == 254) ||
Expand Down
2 changes: 1 addition & 1 deletion ext/filter/tests/018.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var_dump(filter_var("192.168.0.1", FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE
var_dump(filter_var("192.0.34.166", FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE));
var_dump(filter_var("127.0.0.1", FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE));
var_dump(filter_var("192.0.0.1", FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE));
var_dump(filter_var("100.0.0.0", FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE));
var_dump(filter_var("100.64.0.0", FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE));
var_dump(filter_var("100.127.255.255", FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE));
var_dump(filter_var("192.0.34.166", FILTER_VALIDATE_IP));
var_dump(filter_var("256.1237.123.1", FILTER_VALIDATE_IP));
Expand Down
8 changes: 4 additions & 4 deletions ext/ftp/ftp.c
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ ftp_alloc(ftpbuf_t *ftp, const long size, char **response)
return 0;
}

if (response && ftp->inbuf) {
if (response) {
*response = estrdup(ftp->inbuf);
}

Expand Down Expand Up @@ -1638,7 +1638,7 @@ ftp_genlist(ftpbuf_t *ftp, const char *cmd, const char *path TSRMLS_DC)
if (ftp->resp == 226) {
ftp->data = data_close(ftp, data);
php_stream_close(tmpstream);
return ecalloc(1, sizeof(char**));
return ecalloc(1, sizeof(char*));
}

/* pull data buffer into tmpfile */
Expand Down Expand Up @@ -1666,11 +1666,11 @@ ftp_genlist(ftpbuf_t *ftp, const char *cmd, const char *path TSRMLS_DC)
}
}

ftp->data = data = data_close(ftp, data);
ftp->data = data_close(ftp, data);

php_stream_rewind(tmpstream);

ret = safe_emalloc((lines + 1), sizeof(char**), size * sizeof(char*));
ret = safe_emalloc((lines + 1), sizeof(char*), size);

entry = ret;
text = (char*) (ret + lines + 1);
Expand Down
2 changes: 1 addition & 1 deletion ext/gd/php_gd.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@

PHPAPI extern const char php_sig_gif[3];
PHPAPI extern const char php_sig_jpg[3];
PHPAPI extern const char php_sig_png[3];
PHPAPI extern const char php_sig_png[8];

extern zend_module_entry gd_module_entry;
#define phpext_gd_ptr &gd_module_entry
Expand Down
2 changes: 1 addition & 1 deletion ext/intl/collator/collator_create.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
/* {{{ */
static void collator_ctor(INTERNAL_FUNCTION_PARAMETERS)
{
char* locale;
const char* locale;
zend_str_size_int locale_len = 0;
zval* object;
Collator_object* co;
Expand Down
6 changes: 3 additions & 3 deletions ext/intl/dateformat/dateformat_parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ static void internal_parse_to_timestamp(IntlDateFormatter_object *dfo, char* tex
}
/* }}} */

static void add_to_localtime_arr( IntlDateFormatter_object *dfo, zval* return_value, UCalendar parsed_calendar, long calendar_field, char* key_name TSRMLS_DC)
static void add_to_localtime_arr( IntlDateFormatter_object *dfo, zval* return_value, const UCalendar *parsed_calendar, long calendar_field, char* key_name TSRMLS_DC)
{
long calendar_field_val = ucal_get( parsed_calendar, calendar_field, &INTL_DATA_ERROR_CODE(dfo));
INTL_METHOD_CHECK_STATUS( dfo, "Date parsing - localtime failed : could not get a field from calendar" );
Expand All @@ -83,7 +83,7 @@ static void add_to_localtime_arr( IntlDateFormatter_object *dfo, zval* return_va
*/
static void internal_parse_to_localtime(IntlDateFormatter_object *dfo, char* text_to_parse, int32_t text_len, int32_t *parse_pos, zval *return_value TSRMLS_DC)
{
UCalendar* parsed_calendar = NULL;
UCalendar *parsed_calendar = NULL;
UChar* text_utf16 = NULL;
zend_str_size_int text_utf16_len = 0;
long isInDST = 0;
Expand All @@ -92,7 +92,7 @@ static void internal_parse_to_localtime(IntlDateFormatter_object *dfo, char* tex
intl_convert_utf8_to_utf16(&text_utf16, &text_utf16_len, text_to_parse, text_len, &INTL_DATA_ERROR_CODE(dfo));
INTL_METHOD_CHECK_STATUS(dfo, "Error converting timezone to UTF-16" );

parsed_calendar = udat_getCalendar(DATE_FORMAT_OBJECT(dfo));
parsed_calendar = (UCalendar *)udat_getCalendar(DATE_FORMAT_OBJECT(dfo));
udat_parseCalendar( DATE_FORMAT_OBJECT(dfo), parsed_calendar, text_utf16, text_utf16_len, parse_pos, &INTL_DATA_ERROR_CODE(dfo));

if (text_utf16) {
Expand Down
Loading

0 comments on commit 4fc7dc6

Please sign in to comment.