From 9c6742670ae048ebaee3d6a82f93e0303250df35 Mon Sep 17 00:00:00 2001 From: George Wang Date: Wed, 30 Jul 2014 14:53:07 -0400 Subject: [PATCH 001/102] Updated NEWS regarding LiteSpeed SAPI --- NEWS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/NEWS b/NEWS index 1badfb85794..ba78c0f6b7f 100644 --- a/NEWS +++ b/NEWS @@ -17,4 +17,7 @@ PHP NEWS - XSL: . Fixed bug #64776 (The XSLT extension is not thread safe). (Mike) +- LiteSpeed: + . Updated LiteSpeed SAPI code from V5.5 to V6.6. (George Wang) + <<< NOTE: Insert NEWS from last stable release here prior to actual release! >>> From 51be35cf386583b731a13fa37fc685370b015890 Mon Sep 17 00:00:00 2001 From: Mauricio Vieira Date: Sat, 5 Jul 2014 15:16:35 -0300 Subject: [PATCH 002/102] Tests for writeAttributeNS and xmlwriter_write_attribute_ns --- ext/xmlwriter/tests/011.phpt | 35 ++++++++++++++++++++++++++++++++ ext/xmlwriter/tests/OO_010.phpt | 36 +++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 ext/xmlwriter/tests/011.phpt create mode 100644 ext/xmlwriter/tests/OO_010.phpt diff --git a/ext/xmlwriter/tests/011.phpt b/ext/xmlwriter/tests/011.phpt new file mode 100644 index 00000000000..51861673a1e --- /dev/null +++ b/ext/xmlwriter/tests/011.phpt @@ -0,0 +1,35 @@ +--TEST-- +XMLWriter: libxml2 XML Writer, write_attribute_ns function +--CREDITS-- +Mauricio Vieira +#testfest PHPSP on 2014-07-05 +--SKIPIF-- + +--FILE-- +"\'&'); +xmlwriter_write_element($xw, 'chars', "special characters: <>\"'&"); +xmlwriter_end_element($xw); +xmlwriter_end_document($xw); +// Force to write and empty the buffer +$output = xmlwriter_flush($xw, true); +print $output; +?> +--EXPECT-- + + + + special characters: <>"'& + + diff --git a/ext/xmlwriter/tests/OO_010.phpt b/ext/xmlwriter/tests/OO_010.phpt new file mode 100644 index 00000000000..d4444bafe81 --- /dev/null +++ b/ext/xmlwriter/tests/OO_010.phpt @@ -0,0 +1,36 @@ +--TEST-- +XMLWriter: libxml2 XML Writer, writeAttributeNS method +--CREDITS-- +Mauricio Vieira +#testfest PHPSP on 2014-07-05 +--SKIPIF-- + +--FILE-- +openMemory(); +$xw->setIndent(TRUE); +$xw->setIndentString(' '); +$xw->startDocument('1.0', "UTF-8"); +$xw->startElement('root'); +$xw->startElementNS('ns1', 'child1', 'urn:ns1'); +$xw->writeAttributeNS('ns1', 'att1', 'urn:ns1', '<>"\'&'); +$xw->writeElement('chars', "special characters: <>\"'&"); +$xw->endElement(); +$xw->endDocument(); +// Force to write and empty the buffer +$output = $xw->flush(true); +print $output; +?> +--EXPECT-- + + + + special characters: <>"'& + + From 8afe869cabf36ea1d3e3dbb8c0b29facd7d831d5 Mon Sep 17 00:00:00 2001 From: Mauricio Vieira Date: Sat, 5 Jul 2014 16:23:41 -0300 Subject: [PATCH 003/102] xmlwriter_full_end_element tests --- ext/xmlwriter/tests/012.phpt | 38 ++++++++++++++++++++++++++++++++ ext/xmlwriter/tests/OO_011.phpt | 39 +++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+) create mode 100644 ext/xmlwriter/tests/012.phpt create mode 100644 ext/xmlwriter/tests/OO_011.phpt diff --git a/ext/xmlwriter/tests/012.phpt b/ext/xmlwriter/tests/012.phpt new file mode 100644 index 00000000000..b6a4ad8c563 --- /dev/null +++ b/ext/xmlwriter/tests/012.phpt @@ -0,0 +1,38 @@ +--TEST-- +XMLWriter: libxml2 XML Writer, full_end_element function +--CREDITS-- +Mauricio Vieira +#testfest PHPSP on 2014-07-05 +--SKIPIF-- + +--FILE-- +"\'&'); +xmlwriter_write_element($xw, 'chars', "special characters: <>\"'&"); +xmlwriter_end_element($xw); +xmlwriter_start_element($xw, 'empty'); +xmlwriter_full_end_element($xw); +xmlwriter_full_end_element($xw); +// Force to write and empty the buffer +$output = xmlwriter_flush($xw, true); +print $output; +?> +--EXPECT-- + + + + special characters: <>"'& + + + diff --git a/ext/xmlwriter/tests/OO_011.phpt b/ext/xmlwriter/tests/OO_011.phpt new file mode 100644 index 00000000000..0407e1b05f9 --- /dev/null +++ b/ext/xmlwriter/tests/OO_011.phpt @@ -0,0 +1,39 @@ +--TEST-- +XMLWriter: libxml2 XML Writer, fullEndElement method +--CREDITS-- +Mauricio Vieira +#testfest PHPSP on 2014-07-05 +--SKIPIF-- + +--FILE-- +openMemory(); +$xw->setIndent(TRUE); +$xw->setIndentString(' '); +$xw->startDocument('1.0', "UTF-8"); +$xw->startElement('root'); +$xw->startElementNS('ns1', 'child1', 'urn:ns1'); +$xw->writeAttributeNS('ns1', 'att1', 'urn:ns1', '<>"\'&'); +$xw->writeElement('chars', "special characters: <>\"'&"); +$xw->endElement(); +$xw->startElement('empty'); +$xw->fullEndElement(); +$xw->fullEndElement(); +// Force to write and empty the buffer +$output = $xw->flush(true); +print $output; +?> +--EXPECT-- + + + + special characters: <>"'& + + + From cba1150cdbb9b488aba369f0ba93908c6b6ebb1b Mon Sep 17 00:00:00 2001 From: Marcelo Diniz Date: Sat, 5 Jul 2014 15:34:09 -0300 Subject: [PATCH 004/102] tests image gd --- tests/marcelod/imagealphablending_error1.phpt | 19 +++++++++++++++++++ .../imagecolorresolvealpha_error3.phpt | 19 +++++++++++++++++++ tests/marcelod/imagesavealpha_error2.phpt | 19 +++++++++++++++++++ 3 files changed, 57 insertions(+) create mode 100644 tests/marcelod/imagealphablending_error1.phpt create mode 100644 tests/marcelod/imagecolorresolvealpha_error3.phpt create mode 100644 tests/marcelod/imagesavealpha_error2.phpt diff --git a/tests/marcelod/imagealphablending_error1.phpt b/tests/marcelod/imagealphablending_error1.phpt new file mode 100644 index 00000000000..6d49f32b071 --- /dev/null +++ b/tests/marcelod/imagealphablending_error1.phpt @@ -0,0 +1,19 @@ +--TEST-- +test imagealphablending without arguments + +--CREDITS-- +Marcelo Diniz + +--FILE-- + + +--EXPECTF-- +Warning: imagealphablending() expects exactly 2 parameters, 0 given in %s on line %d \ No newline at end of file diff --git a/tests/marcelod/imagecolorresolvealpha_error3.phpt b/tests/marcelod/imagecolorresolvealpha_error3.phpt new file mode 100644 index 00000000000..735b4c97dbd --- /dev/null +++ b/tests/marcelod/imagecolorresolvealpha_error3.phpt @@ -0,0 +1,19 @@ +--TEST-- +test imagecolorresolvealpha without arguments + +--CREDITS-- +Marcelo Diniz + +--FILE-- + + +--EXPECTF-- +Warning: imagecolorresolvealpha() expects exactly 5 parameters, 0 given in %s on line %d \ No newline at end of file diff --git a/tests/marcelod/imagesavealpha_error2.phpt b/tests/marcelod/imagesavealpha_error2.phpt new file mode 100644 index 00000000000..1a7083d5267 --- /dev/null +++ b/tests/marcelod/imagesavealpha_error2.phpt @@ -0,0 +1,19 @@ +--TEST-- +test imagesavealpha without arguments + +--CREDITS-- +Marcelo Diniz + +--FILE-- + + +--EXPECTF-- +Warning: imagesavealpha() expects exactly 2 parameters, 0 given in %s on line %d \ No newline at end of file From 2d2bac2e4c27e298c0e9e37e09ca2c149ee6734c Mon Sep 17 00:00:00 2001 From: Archil Imnadze Date: Mon, 8 Sep 2014 13:13:34 +0400 Subject: [PATCH 005/102] Update CODING_STANDARDS --- CODING_STANDARDS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CODING_STANDARDS b/CODING_STANDARDS index 27fff07f60f..2664d12bd5f 100644 --- a/CODING_STANDARDS +++ b/CODING_STANDARDS @@ -42,7 +42,7 @@ Exceptions: 4. When writing functions that deal with strings, be sure to remember that PHP holds the length property of each string, and that it - shouldn't be calculated with strlen(). Write your functions in a such + shouldn't be calculated with strlen(). Write your functions in such a way so that they'll take advantage of the length property, both for efficiency and in order for them to be binary-safe. Functions that change strings and obtain their new lengths while From 1392643048f1fa6a8b3ecebd41203c76aea25f91 Mon Sep 17 00:00:00 2001 From: Tim Siebels Date: Fri, 12 Sep 2014 15:04:32 +0200 Subject: [PATCH 006/102] Correct two zlib tests to use a string, not a const --- ext/zlib/tests/gzfile_variation4.phpt | 2 +- ext/zlib/tests/readgzfile_variation4.phpt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/zlib/tests/gzfile_variation4.phpt b/ext/zlib/tests/gzfile_variation4.phpt index 3310231566a..9b3128125a5 100644 --- a/ext/zlib/tests/gzfile_variation4.phpt +++ b/ext/zlib/tests/gzfile_variation4.phpt @@ -2,7 +2,7 @@ Test function gzfile() by substituting argument 1 with float values. --SKIPIF-- --FILE-- --FILE-- Date: Sun, 14 Sep 2014 08:24:00 +0800 Subject: [PATCH 007/102] Indention fix indent with tab instead of spaces --- ext/opcache/zend_accelerator_module.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c index 001c3ee9ed2..7b65c412276 100644 --- a/ext/opcache/zend_accelerator_module.c +++ b/ext/opcache/zend_accelerator_module.c @@ -242,7 +242,7 @@ static ZEND_INI_MH(OnEnable) } ZEND_INI_BEGIN() - STD_PHP_INI_BOOLEAN("opcache.enable" , "1", PHP_INI_ALL, OnEnable, enabled , zend_accel_globals, accel_globals) + STD_PHP_INI_BOOLEAN("opcache.enable" , "1", PHP_INI_ALL, OnEnable, enabled , zend_accel_globals, accel_globals) STD_PHP_INI_BOOLEAN("opcache.use_cwd" , "1", PHP_INI_SYSTEM, OnUpdateBool, accel_directives.use_cwd , zend_accel_globals, accel_globals) STD_PHP_INI_BOOLEAN("opcache.validate_timestamps", "1", PHP_INI_ALL , OnUpdateBool, accel_directives.validate_timestamps, zend_accel_globals, accel_globals) STD_PHP_INI_BOOLEAN("opcache.inherited_hack" , "1", PHP_INI_SYSTEM, OnUpdateBool, accel_directives.inherited_hack , zend_accel_globals, accel_globals) @@ -448,7 +448,7 @@ static zend_module_entry accel_module_entry = { NULL, NULL, zend_accel_info, - ACCELERATOR_VERSION "FE", + ACCELERATOR_VERSION "FE", STANDARD_MODULE_PROPERTIES }; From c370435f8948b43ae8ce4ce9fb7d6f9e2048e674 Mon Sep 17 00:00:00 2001 From: Sobak Date: Sun, 28 Sep 2014 12:44:40 +0200 Subject: [PATCH 008/102] Update comments in php.ini --- php.ini-development | 11 ++++------- php.ini-production | 11 ++++------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/php.ini-development b/php.ini-development index 594ddb6cebf..a8ad5d9914b 100644 --- a/php.ini-development +++ b/php.ini-development @@ -293,20 +293,17 @@ serialize_precision = 17 ; open_basedir, if set, limits all file operations to the defined directory ; and below. This directive makes most sense if used in a per-directory -; or per-virtualhost web server configuration file. This directive is -; *NOT* affected by whether Safe Mode is turned On or Off. +; or per-virtualhost web server configuration file. ; http://php.net/open-basedir ;open_basedir = ; This directive allows you to disable certain functions for security reasons. -; It receives a comma-delimited list of function names. This directive is -; *NOT* affected by whether Safe Mode is turned On or Off. +; It receives a comma-delimited list of function names. ; http://php.net/disable-functions disable_functions = ; This directive allows you to disable certain classes for security reasons. -; It receives a comma-delimited list of class names. This directive is -; *NOT* affected by whether Safe Mode is turned On or Off. +; It receives a comma-delimited list of class names. ; http://php.net/disable-classes disable_classes = @@ -1028,7 +1025,7 @@ smtp_port = 25 ; Force the addition of the specified parameters to be passed as extra parameters ; to the sendmail binary. These parameters will always replace the value of -; the 5th parameter to mail(), even in safe mode. +; the 5th parameter to mail(). ;mail.force_extra_parameters = ; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename diff --git a/php.ini-production b/php.ini-production index c07ed21c387..5f6542aaaa9 100644 --- a/php.ini-production +++ b/php.ini-production @@ -293,20 +293,17 @@ serialize_precision = 17 ; open_basedir, if set, limits all file operations to the defined directory ; and below. This directive makes most sense if used in a per-directory -; or per-virtualhost web server configuration file. This directive is -; *NOT* affected by whether Safe Mode is turned On or Off. +; or per-virtualhost web server configuration file. ; http://php.net/open-basedir ;open_basedir = ; This directive allows you to disable certain functions for security reasons. -; It receives a comma-delimited list of function names. This directive is -; *NOT* affected by whether Safe Mode is turned On or Off. +; It receives a comma-delimited list of function names. ; http://php.net/disable-functions disable_functions = ; This directive allows you to disable certain classes for security reasons. -; It receives a comma-delimited list of class names. This directive is -; *NOT* affected by whether Safe Mode is turned On or Off. +; It receives a comma-delimited list of class names. ; http://php.net/disable-classes disable_classes = @@ -1026,7 +1023,7 @@ smtp_port = 25 ; Force the addition of the specified parameters to be passed as extra parameters ; to the sendmail binary. These parameters will always replace the value of -; the 5th parameter to mail(), even in safe mode. +; the 5th parameter to mail(). ;mail.force_extra_parameters = ; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename From c0b83ba2be76bcc51c97549bf5328a9c8e97a748 Mon Sep 17 00:00:00 2001 From: Rodrigo Wanderley de Melo Cardoso Date: Sun, 28 Sep 2014 19:03:32 -0300 Subject: [PATCH 009/102] teste basico da funcao timezone_version_get --- ext/date/tests/timezone_version_get_basic1.phpt | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 ext/date/tests/timezone_version_get_basic1.phpt diff --git a/ext/date/tests/timezone_version_get_basic1.phpt b/ext/date/tests/timezone_version_get_basic1.phpt new file mode 100644 index 00000000000..27224e3d44e --- /dev/null +++ b/ext/date/tests/timezone_version_get_basic1.phpt @@ -0,0 +1,12 @@ +--TEST-- +timezone_version_get: Test that timezone_location_get returns a date concatenated with a dot and a version number +--CREDITS-- +Rodrigo Wanderley de Melo Cardoso +#PHPTestFest2014 São Paulo 2014-07-05 +--INI-- +date.timezone=UTC +--FILE-- + +--EXPECTREGEX-- +^[12][0-9]{3}.[0-9]+$ \ No newline at end of file From 813830e763514a0b716c4813c4c57c8e82401be7 Mon Sep 17 00:00:00 2001 From: Rodrigo Prado de Jesus Date: Sat, 5 Jul 2014 17:25:11 -0300 Subject: [PATCH 010/102] added various tests for XSLTProcessor and one test for iconv extension --- ext/iconv/tests/iconv_basic_001.phpt | 18 ++++++ .../tests/xsltprocessor_hasExsltSupport.phpt | 13 ++++ ...sExsltSupport_not_available_extension.phpt | 13 ++++ ...cessor_hasExsltSupport_wrongparam_001.phpt | 13 ++++ .../tests/xsltprocessor_transformToDoc.phpt | 51 ++++++++++++++++ ...sltprocessor_transformToDoc_nullparam.phpt | 54 ++++++++++++++++ ...ocessor_transformToDoc_wrongparam_001.phpt | 56 +++++++++++++++++ ...ocessor_transformToDoc_wrongparam_002.phpt | 54 ++++++++++++++++ ...ocessor_transformToDoc_wrongparam_003.phpt | 56 +++++++++++++++++ ...ocessor_transformToDoc_wrongparam_004.phpt | 56 +++++++++++++++++ .../tests/xsltprocessor_transformToURI.phpt | 53 ++++++++++++++++ ...sltprocessor_transformToURI_nullparam.phpt | 54 ++++++++++++++++ ...ocessor_transformToURI_wrongparam_001.phpt | 57 +++++++++++++++++ ...ocessor_transformToURI_wrongparam_002.phpt | 57 +++++++++++++++++ ...ocessor_transformToURI_wrongparam_003.phpt | 57 +++++++++++++++++ ...ocessor_transformToURI_wrongparam_004.phpt | 56 +++++++++++++++++ .../tests/xsltprocessor_transformToXML.phpt | 61 +++++++++++++++++++ ...sltprocessor_transformToXML_nullparam.phpt | 54 ++++++++++++++++ ...ocessor_transformToXML_wrongparam_001.phpt | 55 +++++++++++++++++ ...ocessor_transformToXML_wrongparam_002.phpt | 54 ++++++++++++++++ ...ocessor_transformToXML_wrongparam_003.phpt | 55 +++++++++++++++++ ...ocessor_transformToXML_wrongparam_004.phpt | 55 +++++++++++++++++ 22 files changed, 1052 insertions(+) create mode 100644 ext/iconv/tests/iconv_basic_001.phpt create mode 100644 ext/xsl/tests/xsltprocessor_hasExsltSupport.phpt create mode 100644 ext/xsl/tests/xsltprocessor_hasExsltSupport_not_available_extension.phpt create mode 100644 ext/xsl/tests/xsltprocessor_hasExsltSupport_wrongparam_001.phpt create mode 100644 ext/xsl/tests/xsltprocessor_transformToDoc.phpt create mode 100644 ext/xsl/tests/xsltprocessor_transformToDoc_nullparam.phpt create mode 100644 ext/xsl/tests/xsltprocessor_transformToDoc_wrongparam_001.phpt create mode 100644 ext/xsl/tests/xsltprocessor_transformToDoc_wrongparam_002.phpt create mode 100644 ext/xsl/tests/xsltprocessor_transformToDoc_wrongparam_003.phpt create mode 100644 ext/xsl/tests/xsltprocessor_transformToDoc_wrongparam_004.phpt create mode 100644 ext/xsl/tests/xsltprocessor_transformToURI.phpt create mode 100644 ext/xsl/tests/xsltprocessor_transformToURI_nullparam.phpt create mode 100644 ext/xsl/tests/xsltprocessor_transformToURI_wrongparam_001.phpt create mode 100644 ext/xsl/tests/xsltprocessor_transformToURI_wrongparam_002.phpt create mode 100644 ext/xsl/tests/xsltprocessor_transformToURI_wrongparam_003.phpt create mode 100644 ext/xsl/tests/xsltprocessor_transformToURI_wrongparam_004.phpt create mode 100644 ext/xsl/tests/xsltprocessor_transformToXML.phpt create mode 100644 ext/xsl/tests/xsltprocessor_transformToXML_nullparam.phpt create mode 100644 ext/xsl/tests/xsltprocessor_transformToXML_wrongparam_001.phpt create mode 100644 ext/xsl/tests/xsltprocessor_transformToXML_wrongparam_002.phpt create mode 100644 ext/xsl/tests/xsltprocessor_transformToXML_wrongparam_003.phpt create mode 100644 ext/xsl/tests/xsltprocessor_transformToXML_wrongparam_004.phpt diff --git a/ext/iconv/tests/iconv_basic_001.phpt b/ext/iconv/tests/iconv_basic_001.phpt new file mode 100644 index 00000000000..e5c5ddc4283 --- /dev/null +++ b/ext/iconv/tests/iconv_basic_001.phpt @@ -0,0 +1,18 @@ +--TEST-- +Test the basics to function iconv. +--CREDITS-- +Rodrigo Prado de Jesus +--SKIPIF-- + +--FILE-- + +--EXPECT-- +string(15) "Zlutoucky kun\n" \ No newline at end of file diff --git a/ext/xsl/tests/xsltprocessor_hasExsltSupport.phpt b/ext/xsl/tests/xsltprocessor_hasExsltSupport.phpt new file mode 100644 index 00000000000..22671293074 --- /dev/null +++ b/ext/xsl/tests/xsltprocessor_hasExsltSupport.phpt @@ -0,0 +1,13 @@ +--TEST-- +Test the basics to function XSLTProcessor::hasExsltSupport(). +--CREDITS-- +Rodrigo Prado de Jesus +--SKIPIF-- + +--FILE-- +hasExsltSupport()); +?> +--EXPECTF-- +bool(true) \ No newline at end of file diff --git a/ext/xsl/tests/xsltprocessor_hasExsltSupport_not_available_extension.phpt b/ext/xsl/tests/xsltprocessor_hasExsltSupport_not_available_extension.phpt new file mode 100644 index 00000000000..d8b8fa846dc --- /dev/null +++ b/ext/xsl/tests/xsltprocessor_hasExsltSupport_not_available_extension.phpt @@ -0,0 +1,13 @@ +--TEST-- +Test the basics to function XSLTProcessor::hasExsltSupport() when the xsl extension os not available. +--CREDITS-- +Rodrigo Prado de Jesus +--SKIPIF-- + +--FILE-- +hasExsltSupport()); +?> +--EXPECTF-- +Fatal error: Class 'XSLTProcessor' not found in %s on line %i \ No newline at end of file diff --git a/ext/xsl/tests/xsltprocessor_hasExsltSupport_wrongparam_001.phpt b/ext/xsl/tests/xsltprocessor_hasExsltSupport_wrongparam_001.phpt new file mode 100644 index 00000000000..107157fa284 --- /dev/null +++ b/ext/xsl/tests/xsltprocessor_hasExsltSupport_wrongparam_001.phpt @@ -0,0 +1,13 @@ +--TEST-- +Check XSLTProcessor::hasExsltSupport() with 1 parameter +--CREDITS-- +Rodrigo Prado de Jesus +--SKIPIF-- + +--FILE-- +hasExsltSupport('stringValue')); +?> +--EXPECTF-- +bool(true) \ No newline at end of file diff --git a/ext/xsl/tests/xsltprocessor_transformToDoc.phpt b/ext/xsl/tests/xsltprocessor_transformToDoc.phpt new file mode 100644 index 00000000000..ff4be47e3fe --- /dev/null +++ b/ext/xsl/tests/xsltprocessor_transformToDoc.phpt @@ -0,0 +1,51 @@ +--TEST-- +Test the basics to function XSLTProcessor::transformToDoc(). +--CREDITS-- +Rodrigo Prado de Jesus +--SKIPIF-- + +--FILE-- + + + royopa + + +EOB; +$xsl = << + + + + +

Users

+ + + + +
+ +
+ +
+
+EOB; + +$xmldoc = new DOMDocument('1.0', 'utf-8'); +$xmldoc->loadXML($xml); + +$xsldoc = new DOMDocument('1.0', 'utf-8'); +$xsldoc->loadXML($xsl); + +$proc = new XSLTProcessor(); +$proc->registerPHPFunctions(); +$proc->importStyleSheet($xsldoc); + +var_dump($proc->transformToDoc($xmldoc)->firstChild->tagName); +?> +--EXPECT-- +string(4) "html" \ No newline at end of file diff --git a/ext/xsl/tests/xsltprocessor_transformToDoc_nullparam.phpt b/ext/xsl/tests/xsltprocessor_transformToDoc_nullparam.phpt new file mode 100644 index 00000000000..735fd72958d --- /dev/null +++ b/ext/xsl/tests/xsltprocessor_transformToDoc_nullparam.phpt @@ -0,0 +1,54 @@ +--TEST-- +Check XSLTProcessor::transformToDoc() with null parameter +--CREDITS-- +Rodrigo Prado de Jesus +--SKIPIF-- + +--FILE-- + + + bob + + + joe + + +EOB; +$xsl = << + + + + +

Users

+ + + + +
+ +
+ +
+
+EOB; + +$xmldoc = new DOMDocument('1.0', 'utf-8'); +$xmldoc->loadXML($xml); + +$xsldoc = new DOMDocument('1.0', 'utf-8'); +$xsldoc->loadXML($xsl); + +$proc = new XSLTProcessor(); +$proc->registerPHPFunctions(); +$proc->importStyleSheet($xsldoc); + +echo $proc->transformToDoc(null); +?> +--EXPECTF-- +Warning: XSLTProcessor::transformToDoc() expects parameter 1 to be object, null given in %s on line %i \ No newline at end of file diff --git a/ext/xsl/tests/xsltprocessor_transformToDoc_wrongparam_001.phpt b/ext/xsl/tests/xsltprocessor_transformToDoc_wrongparam_001.phpt new file mode 100644 index 00000000000..1460de39a46 --- /dev/null +++ b/ext/xsl/tests/xsltprocessor_transformToDoc_wrongparam_001.phpt @@ -0,0 +1,56 @@ +--TEST-- +Check XSLTProcessor::transformToDoc() with array parameter +--CREDITS-- +Rodrigo Prado de Jesus +--SKIPIF-- + +--FILE-- + + + bob + + + joe + + +EOB; +$xsl = << + + + + +

Users

+ + + + +
+ +
+ +
+
+EOB; + +$xmldoc = new DOMDocument('1.0', 'utf-8'); +$xmldoc->loadXML($xml); + +$xsldoc = new DOMDocument('1.0', 'utf-8'); +$xsldoc->loadXML($xsl); + +$proc = new XSLTProcessor(); +$proc->registerPHPFunctions(); +$proc->importStyleSheet($xsldoc); + +$wrong_parameter = array(); + +echo $proc->transformToDoc($wrong_parameter); +?> +--EXPECTF-- +Warning: XSLTProcessor::transformToDoc() expects parameter 1 to be object, array given in %s on line %i \ No newline at end of file diff --git a/ext/xsl/tests/xsltprocessor_transformToDoc_wrongparam_002.phpt b/ext/xsl/tests/xsltprocessor_transformToDoc_wrongparam_002.phpt new file mode 100644 index 00000000000..2c6c99ae254 --- /dev/null +++ b/ext/xsl/tests/xsltprocessor_transformToDoc_wrongparam_002.phpt @@ -0,0 +1,54 @@ +--TEST-- +Check XSLTProcessor::transformToDoc() with 4 parameters +--CREDITS-- +Rodrigo Prado de Jesus +--SKIPIF-- + +--FILE-- + + + bob + + + joe + + +EOB; +$xsl = << + + + + +

Users

+ + + + +
+ +
+ +
+
+EOB; + +$xmldoc = new DOMDocument('1.0', 'utf-8'); +$xmldoc->loadXML($xml); + +$xsldoc = new DOMDocument('1.0', 'utf-8'); +$xsldoc->loadXML($xsl); + +$proc = new XSLTProcessor(); +$proc->registerPHPFunctions(); +$proc->importStyleSheet($xsldoc); + +echo $proc->transformToDoc($xmldoc, 'string', 98, true); +?> +--EXPECTF-- +Warning: XSLTProcessor::transformToDoc() expects at most 2 parameters, 4 given in %s on line %i diff --git a/ext/xsl/tests/xsltprocessor_transformToDoc_wrongparam_003.phpt b/ext/xsl/tests/xsltprocessor_transformToDoc_wrongparam_003.phpt new file mode 100644 index 00000000000..19fc3e44ef6 --- /dev/null +++ b/ext/xsl/tests/xsltprocessor_transformToDoc_wrongparam_003.phpt @@ -0,0 +1,56 @@ +--TEST-- +Check XSLTProcessor::transformToDoc() with string parameter +--CREDITS-- +Rodrigo Prado de Jesus +--SKIPIF-- + +--FILE-- + + + bob + + + joe + + +EOB; +$xsl = << + + + + +

Users

+ + + + +
+ +
+ +
+
+EOB; + +$xmldoc = new DOMDocument('1.0', 'utf-8'); +$xmldoc->loadXML($xml); + +$xsldoc = new DOMDocument('1.0', 'utf-8'); +$xsldoc->loadXML($xsl); + +$proc = new XSLTProcessor(); +$proc->registerPHPFunctions(); +$proc->importStyleSheet($xsldoc); + +$wrong_parameter = 'stringValue'; + +echo $proc->transformToDoc($wrong_parameter); +?> +--EXPECTF-- +Warning: XSLTProcessor::transformToDoc() expects parameter 1 to be object, string given in %s on line %i \ No newline at end of file diff --git a/ext/xsl/tests/xsltprocessor_transformToDoc_wrongparam_004.phpt b/ext/xsl/tests/xsltprocessor_transformToDoc_wrongparam_004.phpt new file mode 100644 index 00000000000..8df84b7cbe1 --- /dev/null +++ b/ext/xsl/tests/xsltprocessor_transformToDoc_wrongparam_004.phpt @@ -0,0 +1,56 @@ +--TEST-- +Check XSLTProcessor::transformToDoc() with boolean parameter +--CREDITS-- +Rodrigo Prado de Jesus +--SKIPIF-- + +--FILE-- + + + bob + + + joe + + +EOB; +$xsl = << + + + + +

Users

+ + + + +
+ +
+ +
+
+EOB; + +$xmldoc = new DOMDocument('1.0', 'utf-8'); +$xmldoc->loadXML($xml); + +$xsldoc = new DOMDocument('1.0', 'utf-8'); +$xsldoc->loadXML($xsl); + +$proc = new XSLTProcessor(); +$proc->registerPHPFunctions(); +$proc->importStyleSheet($xsldoc); + +$wrong_parameter = true; + +echo $proc->transformToDoc($wrong_parameter); +?> +--EXPECTF-- +Warning: XSLTProcessor::transformToDoc() expects parameter 1 to be object, boolean given in %s on line %i \ No newline at end of file diff --git a/ext/xsl/tests/xsltprocessor_transformToURI.phpt b/ext/xsl/tests/xsltprocessor_transformToURI.phpt new file mode 100644 index 00000000000..27ed4e2975c --- /dev/null +++ b/ext/xsl/tests/xsltprocessor_transformToURI.phpt @@ -0,0 +1,53 @@ +--TEST-- +Test the basics to function XSLTProcessor::transformToURI(). +--CREDITS-- +Rodrigo Prado de Jesus +--SKIPIF-- + +--FILE-- + + + bob + + + joe + + +EOB; +$xsl = << + + + + + + + + +
+ +
+ +
+
+EOB; + +$xmldoc = new DOMDocument('1.0', 'utf-8'); +$xmldoc->loadXML($xml); + +$xsldoc = new DOMDocument('1.0', 'utf-8'); +$xsldoc->loadXML($xsl); + +$proc = new XSLTProcessor(); +$proc->registerPHPFunctions(); +$proc->importStyleSheet($xsldoc); + +var_dump($proc->transformToURI($xsldoc, 'php://output')); +?> +--EXPECTF-- +int(56) \ No newline at end of file diff --git a/ext/xsl/tests/xsltprocessor_transformToURI_nullparam.phpt b/ext/xsl/tests/xsltprocessor_transformToURI_nullparam.phpt new file mode 100644 index 00000000000..69afeaf7bed --- /dev/null +++ b/ext/xsl/tests/xsltprocessor_transformToURI_nullparam.phpt @@ -0,0 +1,54 @@ +--TEST-- +Check XSLTProcessor::transformToURI() with null parameters +--CREDITS-- +Rodrigo Prado de Jesus +--SKIPIF-- + +--FILE-- + + + bob + + + joe + + +EOB; +$xsl = << + + + + +

Users

+ + + + +
+ +
+ +
+
+EOB; + +$xmldoc = new DOMDocument('1.0', 'utf-8'); +$xmldoc->loadXML($xml); + +$xsldoc = new DOMDocument('1.0', 'utf-8'); +$xsldoc->loadXML($xsl); + +$proc = new XSLTProcessor(); +$proc->registerPHPFunctions(); +$proc->importStyleSheet($xsldoc); + +echo $proc->transformToURI(null, null); +?> +--EXPECTF-- +Warning: XSLTProcessor::transformToUri() expects parameter 1 to be object, null given in %s on line %i \ No newline at end of file diff --git a/ext/xsl/tests/xsltprocessor_transformToURI_wrongparam_001.phpt b/ext/xsl/tests/xsltprocessor_transformToURI_wrongparam_001.phpt new file mode 100644 index 00000000000..64b98ce7e57 --- /dev/null +++ b/ext/xsl/tests/xsltprocessor_transformToURI_wrongparam_001.phpt @@ -0,0 +1,57 @@ +--TEST-- +Check XSLTProcessor::transformToURI() with array parameter +--CREDITS-- +Rodrigo Prado de Jesus +--SKIPIF-- + +--FILE-- + + + bob + + + joe + + +EOB; +$xsl = << + + + + +

Users

+ + + + +
+ +
+ +
+
+EOB; + +$xmldoc = new DOMDocument('1.0', 'utf-8'); +$xmldoc->loadXML($xml); + +$xsldoc = new DOMDocument('1.0', 'utf-8'); +$xsldoc->loadXML($xsl); + +$proc = new XSLTProcessor(); +$proc->registerPHPFunctions(); +$proc->importStyleSheet($xsldoc); + +$wrong_parameter = array(); +$uri = 'php://output'; + +echo $proc->transformToURI($wrong_parameter, $uri); +?> +--EXPECTF-- +Warning: XSLTProcessor::transformToUri() expects parameter 1 to be object, array given in %s on line %i \ No newline at end of file diff --git a/ext/xsl/tests/xsltprocessor_transformToURI_wrongparam_002.phpt b/ext/xsl/tests/xsltprocessor_transformToURI_wrongparam_002.phpt new file mode 100644 index 00000000000..7f497ba2b86 --- /dev/null +++ b/ext/xsl/tests/xsltprocessor_transformToURI_wrongparam_002.phpt @@ -0,0 +1,57 @@ +--TEST-- +Check XSLTProcessor::transformToURI() with string parameter +--CREDITS-- +Rodrigo Prado de Jesus +--SKIPIF-- + +--FILE-- + + + bob + + + joe + + +EOB; +$xsl = << + + + + +

Users

+ + + + +
+ +
+ +
+
+EOB; + +$xmldoc = new DOMDocument('1.0', 'utf-8'); +$xmldoc->loadXML($xml); + +$xsldoc = new DOMDocument('1.0', 'utf-8'); +$xsldoc->loadXML($xsl); + +$proc = new XSLTProcessor(); +$proc->registerPHPFunctions(); +$proc->importStyleSheet($xsldoc); + +$wrong_parameter = 'stringValue'; +$uri = 'php://output'; + +echo $proc->transformToURI($wrong_parameter, $uri); +?> +--EXPECTF-- +Warning: XSLTProcessor::transformToUri() expects parameter 1 to be object, string given in %s on line %i \ No newline at end of file diff --git a/ext/xsl/tests/xsltprocessor_transformToURI_wrongparam_003.phpt b/ext/xsl/tests/xsltprocessor_transformToURI_wrongparam_003.phpt new file mode 100644 index 00000000000..c7742422fd9 --- /dev/null +++ b/ext/xsl/tests/xsltprocessor_transformToURI_wrongparam_003.phpt @@ -0,0 +1,57 @@ +--TEST-- +Check XSLTProcessor::transformToURI() with boolean parameter +--CREDITS-- +Rodrigo Prado de Jesus +--SKIPIF-- + +--FILE-- + + + bob + + + joe + + +EOB; +$xsl = << + + + + +

Users

+ + + + +
+ +
+ +
+
+EOB; + +$xmldoc = new DOMDocument('1.0', 'utf-8'); +$xmldoc->loadXML($xml); + +$xsldoc = new DOMDocument('1.0', 'utf-8'); +$xsldoc->loadXML($xsl); + +$proc = new XSLTProcessor(); +$proc->registerPHPFunctions(); +$proc->importStyleSheet($xsldoc); + +$wrong_parameter = false; +$uri = 'php://output'; + +echo $proc->transformToURI($wrong_parameter, $uri); +?> +--EXPECTF-- +Warning: XSLTProcessor::transformToUri() expects parameter 1 to be object, boolean given in %s on line %i \ No newline at end of file diff --git a/ext/xsl/tests/xsltprocessor_transformToURI_wrongparam_004.phpt b/ext/xsl/tests/xsltprocessor_transformToURI_wrongparam_004.phpt new file mode 100644 index 00000000000..c1de1d93c3e --- /dev/null +++ b/ext/xsl/tests/xsltprocessor_transformToURI_wrongparam_004.phpt @@ -0,0 +1,56 @@ +--TEST-- +Check XSLTProcessor::transformToURI() with 3 parameters +--CREDITS-- +Rodrigo Prado de Jesus +--SKIPIF-- + +--FILE-- + + + bob + + + joe + + +EOB; +$xsl = << + + + + +

Users

+ + + + +
+ +
+ +
+
+EOB; + +$xmldoc = new DOMDocument('1.0', 'utf-8'); +$xmldoc->loadXML($xml); + +$xsldoc = new DOMDocument('1.0', 'utf-8'); +$xsldoc->loadXML($xsl); + +$proc = new XSLTProcessor(); +$proc->registerPHPFunctions(); +$proc->importStyleSheet($xsldoc); + +$uri = 'php://output'; + +echo $proc->transformToURI($xsldoc, $uri, 'stringValue'); +?> +--EXPECTF-- +Warning: XSLTProcessor::transformToUri() expects exactly 2 parameters, 3 given in %s on line %i \ No newline at end of file diff --git a/ext/xsl/tests/xsltprocessor_transformToXML.phpt b/ext/xsl/tests/xsltprocessor_transformToXML.phpt new file mode 100644 index 00000000000..c70200d1029 --- /dev/null +++ b/ext/xsl/tests/xsltprocessor_transformToXML.phpt @@ -0,0 +1,61 @@ +--TEST-- +Test the basics to function XSLTProcessor::transformToXml(). +--CREDITS-- +Rodrigo Prado de Jesus +--SKIPIF-- + +--FILE-- + + + bob + + + joe + + +EOB; +$xsl = << + + + + +

Users

+ + + + +
+ +
+ +
+
+EOB; + +$xmldoc = new DOMDocument('1.0', 'utf-8'); +$xmldoc->loadXML($xml); + +$xsldoc = new DOMDocument('1.0', 'utf-8'); +$xsldoc->loadXML($xsl); + +$proc = new XSLTProcessor(); +$proc->registerPHPFunctions(); +$proc->importStyleSheet($xsldoc); + +var_dump($proc->transformToXML($xmldoc)); +?> +--EXPECT-- +string(135) " +

Users

+ + + +
Bob
Joe
+ +" \ No newline at end of file diff --git a/ext/xsl/tests/xsltprocessor_transformToXML_nullparam.phpt b/ext/xsl/tests/xsltprocessor_transformToXML_nullparam.phpt new file mode 100644 index 00000000000..a7689df0781 --- /dev/null +++ b/ext/xsl/tests/xsltprocessor_transformToXML_nullparam.phpt @@ -0,0 +1,54 @@ +--TEST-- +Check XSLTProcessor::transformToXml() with null parameter +--CREDITS-- +Rodrigo Prado de Jesus +--SKIPIF-- + +--FILE-- + + + bob + + + joe + + +EOB; +$xsl = << + + + + +

Users

+ + + + +
+ +
+ +
+
+EOB; + +$xmldoc = new DOMDocument('1.0', 'utf-8'); +$xmldoc->loadXML($xml); + +$xsldoc = new DOMDocument('1.0', 'utf-8'); +$xsldoc->loadXML($xsl); + +$proc = new XSLTProcessor(); +$proc->registerPHPFunctions(); +$proc->importStyleSheet($xsldoc); + +echo $proc->transformToXML(null); +?> +--EXPECTF-- +Warning: XSLTProcessor::transformToXml() expects parameter 1 to be object, null given in %s on line %i diff --git a/ext/xsl/tests/xsltprocessor_transformToXML_wrongparam_001.phpt b/ext/xsl/tests/xsltprocessor_transformToXML_wrongparam_001.phpt new file mode 100644 index 00000000000..32e1a8095bd --- /dev/null +++ b/ext/xsl/tests/xsltprocessor_transformToXML_wrongparam_001.phpt @@ -0,0 +1,55 @@ +--TEST-- +Check XSLTProcessor::transformToXML() with array parameter +--CREDITS-- +Rodrigo Prado de Jesus +--SKIPIF-- + +--FILE-- + + + bob + + + joe + + +EOB; +$xsl = << + + + + +

Users

+ + + + +
+ +
+ +
+
+EOB; + +$xmldoc = new DOMDocument('1.0', 'utf-8'); +$xmldoc->loadXML($xml); + +$xsldoc = new DOMDocument('1.0', 'utf-8'); +$xsldoc->loadXML($xsl); + +$proc = new XSLTProcessor(); +$proc->registerPHPFunctions(); +$proc->importStyleSheet($xsldoc); + +$wrong_parameter = array(); +echo $proc->transformToXML($wrong_parameter); +?> +--EXPECTF-- +Warning: XSLTProcessor::transformToXml() expects parameter 1 to be object, array given in %s on line %d \ No newline at end of file diff --git a/ext/xsl/tests/xsltprocessor_transformToXML_wrongparam_002.phpt b/ext/xsl/tests/xsltprocessor_transformToXML_wrongparam_002.phpt new file mode 100644 index 00000000000..69b9305e131 --- /dev/null +++ b/ext/xsl/tests/xsltprocessor_transformToXML_wrongparam_002.phpt @@ -0,0 +1,54 @@ +--TEST-- +Check XSLTProcessor::transformToXML() with 3 parameters +--CREDITS-- +Rodrigo Prado de Jesus +--SKIPIF-- + +--FILE-- + + + bob + + + joe + + +EOB; +$xsl = << + + + + +

Users

+ + + + +
+ +
+ +
+
+EOB; + +$xmldoc = new DOMDocument('1.0', 'utf-8'); +$xmldoc->loadXML($xml); + +$xsldoc = new DOMDocument('1.0', 'utf-8'); +$xsldoc->loadXML($xsl); + +$proc = new XSLTProcessor(); +$proc->registerPHPFunctions(); +$proc->importStyleSheet($xsldoc); + +echo $proc->transformToXML($xmldoc, 'string', 98); +?> +--EXPECTF-- +Warning: XSLTProcessor::transformToXml() expects exactly 1 parameter, 3 given in %s on line %i diff --git a/ext/xsl/tests/xsltprocessor_transformToXML_wrongparam_003.phpt b/ext/xsl/tests/xsltprocessor_transformToXML_wrongparam_003.phpt new file mode 100644 index 00000000000..05cb7ebd9ec --- /dev/null +++ b/ext/xsl/tests/xsltprocessor_transformToXML_wrongparam_003.phpt @@ -0,0 +1,55 @@ +--TEST-- +Check XSLTProcessor::transformToXML() with string parameter +--CREDITS-- +Rodrigo Prado de Jesus +--SKIPIF-- + +--FILE-- + + + bob + + + joe + + +EOB; +$xsl = << + + + + +

Users

+ + + + +
+ +
+ +
+
+EOB; + +$xmldoc = new DOMDocument('1.0', 'utf-8'); +$xmldoc->loadXML($xml); + +$xsldoc = new DOMDocument('1.0', 'utf-8'); +$xsldoc->loadXML($xsl); + +$proc = new XSLTProcessor(); +$proc->registerPHPFunctions(); +$proc->importStyleSheet($xsldoc); + +$wrong_parameter = 'stringValue'; +echo $proc->transformToXML($wrong_parameter); +?> +--EXPECTF-- +Warning: XSLTProcessor::transformToXml() expects parameter 1 to be object, string given in %s on line %d \ No newline at end of file diff --git a/ext/xsl/tests/xsltprocessor_transformToXML_wrongparam_004.phpt b/ext/xsl/tests/xsltprocessor_transformToXML_wrongparam_004.phpt new file mode 100644 index 00000000000..87db6e14d65 --- /dev/null +++ b/ext/xsl/tests/xsltprocessor_transformToXML_wrongparam_004.phpt @@ -0,0 +1,55 @@ +--TEST-- +Check XSLTProcessor::transformToXML() with boolean parameter +--CREDITS-- +Rodrigo Prado de Jesus +--SKIPIF-- + +--FILE-- + + + bob + + + joe + + +EOB; +$xsl = << + + + + +

Users

+ + + + +
+ +
+ +
+
+EOB; + +$xmldoc = new DOMDocument('1.0', 'utf-8'); +$xmldoc->loadXML($xml); + +$xsldoc = new DOMDocument('1.0', 'utf-8'); +$xsldoc->loadXML($xsl); + +$proc = new XSLTProcessor(); +$proc->registerPHPFunctions(); +$proc->importStyleSheet($xsldoc); + +$wrong_parameter = true; +echo $proc->transformToXML($wrong_parameter); +?> +--EXPECTF-- +Warning: XSLTProcessor::transformToXml() expects parameter 1 to be object, boolean given in %s on line %d \ No newline at end of file From d89b1dad8a3e98c09ed2f96e3ee4dd85dc9bcb8a Mon Sep 17 00:00:00 2001 From: Rodrigo Prado de Jesus Date: Sun, 28 Sep 2014 20:30:52 -0300 Subject: [PATCH 011/102] added some tests to datetime and dateinterval functions --- ...date_interval_create_from_date_string.phpt | 34 +++++++++++++++ ...val_create_from_date_string_nullparam.phpt | 42 +++++++++++++++++++ ...reate_from_date_string_wrongparam_001.phpt | 11 +++++ ...reate_from_date_string_wrongparam_002.phpt | 9 ++++ ext/date/tests/date_timestamp_set.phpt | 19 +++++++++ .../tests/date_timestamp_set_nullparam.phpt | 17 ++++++++ .../tests/date_timestamp_set_nullparam2.phpt | 24 +++++++++++ .../date_timestamp_set_wrongparam_001.phpt | 17 ++++++++ .../date_timestamp_set_wrongparam_002.phpt | 15 +++++++ .../date_timestamp_set_wrongparam_003.phpt | 19 +++++++++ .../date_timestamp_set_wrongparam_004.phpt | 17 ++++++++ ext/date/tests/timezone_version_get.phpt | 13 ++++++ 12 files changed, 237 insertions(+) create mode 100644 ext/date/tests/date_interval_create_from_date_string.phpt create mode 100644 ext/date/tests/date_interval_create_from_date_string_nullparam.phpt create mode 100644 ext/date/tests/date_interval_create_from_date_string_wrongparam_001.phpt create mode 100644 ext/date/tests/date_interval_create_from_date_string_wrongparam_002.phpt create mode 100644 ext/date/tests/date_timestamp_set.phpt create mode 100644 ext/date/tests/date_timestamp_set_nullparam.phpt create mode 100644 ext/date/tests/date_timestamp_set_nullparam2.phpt create mode 100644 ext/date/tests/date_timestamp_set_wrongparam_001.phpt create mode 100644 ext/date/tests/date_timestamp_set_wrongparam_002.phpt create mode 100644 ext/date/tests/date_timestamp_set_wrongparam_003.phpt create mode 100644 ext/date/tests/date_timestamp_set_wrongparam_004.phpt create mode 100644 ext/date/tests/timezone_version_get.phpt diff --git a/ext/date/tests/date_interval_create_from_date_string.phpt b/ext/date/tests/date_interval_create_from_date_string.phpt new file mode 100644 index 00000000000..9a1745c9acf --- /dev/null +++ b/ext/date/tests/date_interval_create_from_date_string.phpt @@ -0,0 +1,34 @@ +--TEST-- +Test date_interval_create_from_date_string() function : basic functionality +--CREDITS-- +Rodrigo Prado de Jesus +--FILE-- +d); + +$string = '2 weeks'; //14 days +$i = date_interval_create_from_date_string($string); +var_dump($i->d); + +$string = '3 months'; +$i = date_interval_create_from_date_string($string); +var_dump($i->m); + +$string = '4 years'; +$i = date_interval_create_from_date_string($string); +var_dump($i->y); + +$string = '1 year + 1 day'; +$i = date_interval_create_from_date_string($string); +var_dump($i->y); +var_dump($i->d); +?> +--EXPECTF-- +int(1) +int(14) +int(3) +int(4) +int(1) +int(1) \ No newline at end of file diff --git a/ext/date/tests/date_interval_create_from_date_string_nullparam.phpt b/ext/date/tests/date_interval_create_from_date_string_nullparam.phpt new file mode 100644 index 00000000000..369db5714ac --- /dev/null +++ b/ext/date/tests/date_interval_create_from_date_string_nullparam.phpt @@ -0,0 +1,42 @@ +--TEST-- +Test date_interval_create_from_date_string() function : null parameter +--CREDITS-- +Rodrigo Prado de Jesus +--FILE-- + +--EXPECTF-- +object(DateInterval)#1 (15) { + ["y"]=> + int(0) + ["m"]=> + int(0) + ["d"]=> + int(0) + ["h"]=> + int(0) + ["i"]=> + int(0) + ["s"]=> + int(0) + ["weekday"]=> + int(0) + ["weekday_behavior"]=> + int(0) + ["first_last_day_of"]=> + int(0) + ["invert"]=> + int(0) + ["days"]=> + int(0) + ["special_type"]=> + int(0) + ["special_amount"]=> + int(0) + ["have_weekday_relative"]=> + int(0) + ["have_special_relative"]=> + int(0) +} \ No newline at end of file diff --git a/ext/date/tests/date_interval_create_from_date_string_wrongparam_001.phpt b/ext/date/tests/date_interval_create_from_date_string_wrongparam_001.phpt new file mode 100644 index 00000000000..15db956553f --- /dev/null +++ b/ext/date/tests/date_interval_create_from_date_string_wrongparam_001.phpt @@ -0,0 +1,11 @@ +--TEST-- +Test date_interval_create_from_date_string() function : wrong parameter (array) +--CREDITS-- +Rodrigo Prado de Jesus +--FILE-- + +--EXPECTF-- +Warning: date_interval_create_from_date_string() expects parameter 1 to be string, array given in %s on line %d \ No newline at end of file diff --git a/ext/date/tests/date_interval_create_from_date_string_wrongparam_002.phpt b/ext/date/tests/date_interval_create_from_date_string_wrongparam_002.phpt new file mode 100644 index 00000000000..a3407c39679 --- /dev/null +++ b/ext/date/tests/date_interval_create_from_date_string_wrongparam_002.phpt @@ -0,0 +1,9 @@ +--TEST-- +Test date_interval_create_from_date_string() function : with 2 parameters (wrong). +Rodrigo Prado de Jesus +--FILE-- + +--EXPECTF-- +Warning: date_interval_create_from_date_string() expects exactly 1 parameter, 2 given in %s on line %d \ No newline at end of file diff --git a/ext/date/tests/date_timestamp_set.phpt b/ext/date/tests/date_timestamp_set.phpt new file mode 100644 index 00000000000..e01660193f1 --- /dev/null +++ b/ext/date/tests/date_timestamp_set.phpt @@ -0,0 +1,19 @@ +--TEST-- +Test the basics to function date_timestamp_set(). +--CREDITS-- +Rodrigo Prado de Jesus +--INI-- +date.timezone = UTC; +date_default_timezone_set("America/Sao_Paulo"); +--FILE-- + (U) => T Y-M-d H:i:s')); +?> +--EXPECTF-- +string(47) "021 => (1234567890) => UTC 2009-Feb-13 23:31:30" \ No newline at end of file diff --git a/ext/date/tests/date_timestamp_set_nullparam.phpt b/ext/date/tests/date_timestamp_set_nullparam.phpt new file mode 100644 index 00000000000..1bcb800242b --- /dev/null +++ b/ext/date/tests/date_timestamp_set_nullparam.phpt @@ -0,0 +1,17 @@ +--TEST-- +Test the function date_timestamp_set() with first null parameter. +--CREDITS-- +Rodrigo Prado de Jesus +--INI-- +date.timezone = UTC; +date_default_timezone_set("America/Sao_Paulo"); +--FILE-- + +--EXPECTF-- +Warning: date_timestamp_set() expects parameter 1 to be DateTime, null given in %s on line %d \ No newline at end of file diff --git a/ext/date/tests/date_timestamp_set_nullparam2.phpt b/ext/date/tests/date_timestamp_set_nullparam2.phpt new file mode 100644 index 00000000000..1442da4426f --- /dev/null +++ b/ext/date/tests/date_timestamp_set_nullparam2.phpt @@ -0,0 +1,24 @@ +--TEST-- +Test the function date_timestamp_set() with second null parameter. +--CREDITS-- +Rodrigo Prado de Jesus +--INI-- +date.timezone = UTC; +date_default_timezone_set("America/Sao_Paulo"); +--FILE-- + +--EXPECTF-- +object(DateTime)#1 (3) { + ["date"]=> + string(26) "1970-01-01 00:00:00.000000" + ["timezone_type"]=> + int(3) + ["timezone"]=> + string(3) "UTC" +} \ No newline at end of file diff --git a/ext/date/tests/date_timestamp_set_wrongparam_001.phpt b/ext/date/tests/date_timestamp_set_wrongparam_001.phpt new file mode 100644 index 00000000000..9a0fca99c1d --- /dev/null +++ b/ext/date/tests/date_timestamp_set_wrongparam_001.phpt @@ -0,0 +1,17 @@ +--TEST-- +Check the function date_timestamp_set() with first parameter wrong (array). +--CREDITS-- +Rodrigo Prado de Jesus +--INI-- +date.timezone = UTC; +date_default_timezone_set("America/Sao_Paulo"); +--FILE-- + +--EXPECTF-- +Warning: date_timestamp_set() expects parameter 1 to be DateTime, array given in %s on line %d \ No newline at end of file diff --git a/ext/date/tests/date_timestamp_set_wrongparam_002.phpt b/ext/date/tests/date_timestamp_set_wrongparam_002.phpt new file mode 100644 index 00000000000..ed31cb217d7 --- /dev/null +++ b/ext/date/tests/date_timestamp_set_wrongparam_002.phpt @@ -0,0 +1,15 @@ +--TEST-- +Check the function date_timestamp_set() with first parameter wrong (integer). +--CREDITS-- +Rodrigo Prado de Jesus +--INI-- +date.timezone = UTC; +date_default_timezone_set("America/Sao_Paulo"); +--FILE-- + +--EXPECTF-- +Warning: date_timestamp_set() expects parameter 1 to be DateTime, integer given in %s on line %d \ No newline at end of file diff --git a/ext/date/tests/date_timestamp_set_wrongparam_003.phpt b/ext/date/tests/date_timestamp_set_wrongparam_003.phpt new file mode 100644 index 00000000000..f965334d9de --- /dev/null +++ b/ext/date/tests/date_timestamp_set_wrongparam_003.phpt @@ -0,0 +1,19 @@ +--TEST-- +Check the function date_timestamp_set() with second parameter wrong (array). +--CREDITS-- +Rodrigo Prado de Jesus +--INI-- +date.timezone = UTC; +date_default_timezone_set("America/Sao_Paulo"); +--FILE-- + +--EXPECTF-- +Warning: date_timestamp_set() expects parameter 2 to be long, array given in %s on line %d \ No newline at end of file diff --git a/ext/date/tests/date_timestamp_set_wrongparam_004.phpt b/ext/date/tests/date_timestamp_set_wrongparam_004.phpt new file mode 100644 index 00000000000..b171e98bd46 --- /dev/null +++ b/ext/date/tests/date_timestamp_set_wrongparam_004.phpt @@ -0,0 +1,17 @@ +--TEST-- +Check the function date_timestamp_set() with 3 parameters. +--CREDITS-- +Rodrigo Prado de Jesus +--INI-- +date.timezone = UTC; +date_default_timezone_set("America/Sao_Paulo"); +--FILE-- + +--EXPECTF-- +Warning: date_timestamp_set() expects exactly 2 parameters, 3 given in %s on line %d \ No newline at end of file diff --git a/ext/date/tests/timezone_version_get.phpt b/ext/date/tests/timezone_version_get.phpt new file mode 100644 index 00000000000..e0760042896 --- /dev/null +++ b/ext/date/tests/timezone_version_get.phpt @@ -0,0 +1,13 @@ +--TEST-- +Test the basics to function timezone_version_get(). +--CREDITS-- +Rodrigo Prado de Jesus +--INI-- +date.timezone = UTC; +date_default_timezone_set("America/Sao_Paulo"); +--FILE-- + +--EXPECTREGEX-- +string\([6-7]\) \"20[0-9][0-9]\.[1-9][0-9]?\" \ No newline at end of file From 8cd23d49db3482bf408c82f6287d8df5988b072d Mon Sep 17 00:00:00 2001 From: Pedro MFA Evangelista Date: Sat, 5 Jul 2014 17:20:30 -0300 Subject: [PATCH 012/102] Add a test for the exception cases of readline_read_history --- .../tests/readline_read_history_error_001.phpt | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 ext/readline/tests/readline_read_history_error_001.phpt diff --git a/ext/readline/tests/readline_read_history_error_001.phpt b/ext/readline/tests/readline_read_history_error_001.phpt new file mode 100644 index 00000000000..db1e001694a --- /dev/null +++ b/ext/readline/tests/readline_read_history_error_001.phpt @@ -0,0 +1,12 @@ +--TEST-- +readline_read_history() function - Error cases +--SKIPIF-- + +--EXPECT-- +bool(false) +bool(false) From 2c6ecbbea110328970ea4265a1b0245e692f8f3f Mon Sep 17 00:00:00 2001 From: Pedro MFA Evangelista Date: Sat, 5 Jul 2014 17:30:05 -0300 Subject: [PATCH 013/102] Add my information to this test --- ext/readline/tests/readline_read_history_error_001.phpt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ext/readline/tests/readline_read_history_error_001.phpt b/ext/readline/tests/readline_read_history_error_001.phpt index db1e001694a..0a65a66d5cd 100644 --- a/ext/readline/tests/readline_read_history_error_001.phpt +++ b/ext/readline/tests/readline_read_history_error_001.phpt @@ -1,7 +1,9 @@ --TEST-- readline_read_history() function - Error cases +--CREDITS-- +Pedro Manoel Evangelista --SKIPIF-- - --FILE-- Date: Mon, 29 Sep 2014 09:53:26 +0200 Subject: [PATCH 014/102] added missing INSTALL_ROOT --- ext/phar/Makefile.frag | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/phar/Makefile.frag b/ext/phar/Makefile.frag index ed6de9fd67b..18b4a744db7 100644 --- a/ext/phar/Makefile.frag +++ b/ext/phar/Makefile.frag @@ -39,7 +39,7 @@ install-pharcmd: pharcmd -@$(mkinstalldirs) $(INSTALL_ROOT)$(bindir) $(INSTALL) $(builddir)/phar.phar $(INSTALL_ROOT)$(bindir) -@rm -f $(INSTALL_ROOT)$(bindir)/phar - $(LN_S) -f $(bindir)/phar.phar $(INSTALL_ROOT)$(bindir)/phar + $(LN_S) -f $(INSTALL_ROOT)$(bindir)/phar.phar $(INSTALL_ROOT)$(bindir)/phar @$(mkinstalldirs) $(INSTALL_ROOT)$(mandir)/man1 @$(INSTALL_DATA) $(builddir)/phar.1 $(INSTALL_ROOT)$(mandir)/man1/phar.1 @$(INSTALL_DATA) $(builddir)/phar.phar.1 $(INSTALL_ROOT)$(mandir)/man1/phar.phar.1 From 17759439d771f31cf742e8c6ad78d1a8c6b83294 Mon Sep 17 00:00:00 2001 From: Paulo Eduardo Date: Tue, 15 Jul 2014 18:36:45 -0300 Subject: [PATCH 015/102] Test PHP Init Fail Without Params --- ext/curl/tests/curl_multi_init_param.phpt | 27 +++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 ext/curl/tests/curl_multi_init_param.phpt diff --git a/ext/curl/tests/curl_multi_init_param.phpt b/ext/curl/tests/curl_multi_init_param.phpt new file mode 100644 index 00000000000..e7848976aa6 --- /dev/null +++ b/ext/curl/tests/curl_multi_init_param.phpt @@ -0,0 +1,27 @@ +--TEST-- +Test curl_multi_init() fail if any parameter is passed +--CREDITS-- +Paulo Eduardo +#testfest SP 2014 +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +Warning: curl_multi_init() expects exactly 0 parameters, %d given in %s on line %d +NULL +===DONE=== From c46453801e181fb4365cd7ee3e497d2389396fb3 Mon Sep 17 00:00:00 2001 From: Reeze Xia Date: Wed, 8 Oct 2014 23:27:52 +0800 Subject: [PATCH 016/102] Fix php.ini-*'s comment about directive: request_order request_order directive only support register G,P,C but not all of the EGPCS global variables. The doc is ok. --- php.ini-development | 14 +++++++------- php.ini-production | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/php.ini-development b/php.ini-development index 61519f05aab..0529d3eb8cb 100644 --- a/php.ini-development +++ b/php.ini-development @@ -607,13 +607,13 @@ html_errors = On ; http://php.net/variables-order variables_order = "GPCS" -; This directive determines which super global data (G,P,C,E & S) should -; be registered into the super global array REQUEST. If so, it also determines -; the order in which that data is registered. The values for this directive are -; specified in the same manner as the variables_order directive, EXCEPT one. -; Leaving this value empty will cause PHP to use the value set in the -; variables_order directive. It does not mean it will leave the super globals -; array REQUEST empty. +; This directive determines which super global data (G,P & C) should be +; registered into the super global array REQUEST. If so, it also determines +; the order in which that data is registered. The values for this directive +; are specified in the same manner as the variables_order directive, +; EXCEPT one. Leaving this value empty will cause PHP to use the value set +; in the variables_order directive. It does not mean it will leave the super +; globals array REQUEST empty. ; Default Value: None ; Development Value: "GP" ; Production Value: "GP" diff --git a/php.ini-production b/php.ini-production index a455b825b5a..8535b298b12 100644 --- a/php.ini-production +++ b/php.ini-production @@ -607,13 +607,13 @@ html_errors = On ; http://php.net/variables-order variables_order = "GPCS" -; This directive determines which super global data (G,P,C,E & S) should -; be registered into the super global array REQUEST. If so, it also determines -; the order in which that data is registered. The values for this directive are -; specified in the same manner as the variables_order directive, EXCEPT one. -; Leaving this value empty will cause PHP to use the value set in the -; variables_order directive. It does not mean it will leave the super globals -; array REQUEST empty. +; This directive determines which super global data (G,P & C) should be +; registered into the super global array REQUEST. If so, it also determines +; the order in which that data is registered. The values for this directive +; are specified in the same manner as the variables_order directive, +; EXCEPT one. Leaving this value empty will cause PHP to use the value set +; in the variables_order directive. It does not mean it will leave the super +; globals array REQUEST empty. ; Default Value: None ; Development Value: "GP" ; Production Value: "GP" From 5b5f99ef1877d4d77d188d86dd03874135f05c7b Mon Sep 17 00:00:00 2001 From: Adam Harvey Date: Wed, 24 Sep 2014 20:00:25 +0000 Subject: [PATCH 017/102] Add BEGIN_EXTERN_C() and END_EXTERN_C() to .h files missing them. --- Zend/zend_float.h | 4 ++++ Zend/zend_vm.h | 4 ++++ Zend/zend_vm_opcodes.h | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/Zend/zend_float.h b/Zend/zend_float.h index 33f8e93fbf3..d9e4f4be88e 100644 --- a/Zend/zend_float.h +++ b/Zend/zend_float.h @@ -21,6 +21,8 @@ #ifndef ZEND_FLOAT_H #define ZEND_FLOAT_H +BEGIN_EXTERN_C() + /* Define functions for FP initialization and de-initialization. */ @@ -28,6 +30,8 @@ extern ZEND_API void zend_init_fpu(TSRMLS_D); extern ZEND_API void zend_shutdown_fpu(TSRMLS_D); extern ZEND_API void zend_ensure_fpu_mode(TSRMLS_D); +END_EXTERN_C() + /* Copy of the contents of xpfpa.h (which is under public domain) See http://wiki.php.net/rfc/rounding for details. diff --git a/Zend/zend_vm.h b/Zend/zend_vm.h index 078be15b743..e403e7cc928 100644 --- a/Zend/zend_vm.h +++ b/Zend/zend_vm.h @@ -21,9 +21,13 @@ #ifndef ZEND_VM_H #define ZEND_VM_H +BEGIN_EXTERN_C() + ZEND_API void zend_vm_use_old_executor(void); ZEND_API void zend_vm_set_opcode_handler(zend_op* opcode); +END_EXTERN_C() + #define ZEND_VM_SET_OPCODE_HANDLER(opline) zend_vm_set_opcode_handler(opline) #endif diff --git a/Zend/zend_vm_opcodes.h b/Zend/zend_vm_opcodes.h index 4ed726d217f..89a1afad493 100644 --- a/Zend/zend_vm_opcodes.h +++ b/Zend/zend_vm_opcodes.h @@ -21,8 +21,12 @@ #ifndef ZEND_VM_OPCODES_H #define ZEND_VM_OPCODES_H +BEGIN_EXTERN_C() + ZEND_API const char *zend_get_opcode_name(zend_uchar opcode); +END_EXTERN_C() + #define ZEND_NOP 0 #define ZEND_ADD 1 #define ZEND_SUB 2 From 087150de95f8e356e44e07cebb842f6c507e987e Mon Sep 17 00:00:00 2001 From: Adam Harvey Date: Fri, 31 Oct 2014 10:09:14 -0700 Subject: [PATCH 018/102] Update NEWS after rebase. --- NEWS | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NEWS b/NEWS index 9e5e1388c81..59922340197 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,10 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 2014, PHP 5.5.20 +- Core: + . Fixed bug #68091 (Some Zend headers lack appropriate extern "C" blocks). + (Adam) + ?? ??? 2014, PHP 5.5.19 From 4bb836be207db33bb5ef69766f46acb60a554e30 Mon Sep 17 00:00:00 2001 From: Adam Harvey Date: Fri, 31 Oct 2014 10:10:49 -0700 Subject: [PATCH 019/102] Update the VM generation script, per Bob. --- Zend/zend_vm_gen.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Zend/zend_vm_gen.php b/Zend/zend_vm_gen.php index 08657e5f31e..41febfa44dc 100644 --- a/Zend/zend_vm_gen.php +++ b/Zend/zend_vm_gen.php @@ -1181,7 +1181,9 @@ function gen_vm($def, $skel) { out($f, $GLOBALS['header_text']); fputs($f, "#ifndef ZEND_VM_OPCODES_H\n#define ZEND_VM_OPCODES_H\n\n"); + fputs($f, "BEGIN_EXTERN_C()\n\n"); fputs($f, "ZEND_API const char *zend_get_opcode_name(zend_uchar opcode);\n\n"); + fputs($f, "END_EXTERN_C()\n\n"); foreach ($opcodes as $code => $dsc) { $code = str_pad((string)$code,$code_len," ",STR_PAD_LEFT); From a5c5d9a0e1b3d7164fc258971a41331444bb1733 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Wed, 5 Nov 2014 19:38:23 +0100 Subject: [PATCH 020/102] Minor: typo fix in filter_var comment --- ext/filter/filter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/filter/filter.c b/ext/filter/filter.c index 530dce6f533..46c3fb2eea0 100644 --- a/ext/filter/filter.c +++ b/ext/filter/filter.c @@ -760,7 +760,7 @@ PHP_FUNCTION(filter_input) /* }}} */ /* {{{ proto mixed filter_var(mixed variable [, long filter [, mixed options]]) - * Returns the filtered version of the vriable. + * Returns the filtered version of the variable. */ PHP_FUNCTION(filter_var) { From 479c03dfc51da95a34fe9c4a58c8bfd6967059cf Mon Sep 17 00:00:00 2001 From: Anthon Pang Date: Sat, 8 Nov 2014 08:58:44 -0500 Subject: [PATCH 021/102] fix typo in UPGRADING.INTERNALS --- UPGRADING.INTERNALS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UPGRADING.INTERNALS b/UPGRADING.INTERNALS index 92cebc8db32..dfec37c46f3 100644 --- a/UPGRADING.INTERNALS +++ b/UPGRADING.INTERNALS @@ -31,7 +31,7 @@ PHP 7.0 INTERNALS UPGRADE NOTES Integer types Integers do no more depend on the firm 'long' type. Instead a platform - dependent integer type is used, it is called zend_long. That datatype is + independent integer type is used, it is called zend_long. That datatype is defined dynamically to guarantee the consistent 64 bit support. The zval field representing user land integer it bound to zend_long. From a0909f0a127d3312cf32436384a40d1894560d6a Mon Sep 17 00:00:00 2001 From: Mathieu CARBONNEAUX Date: Mon, 10 Nov 2014 12:31:21 +0100 Subject: [PATCH 022/102] add php_create_socket/php_destroy_socket PHP_SOCKETS_API to abel to create socket ressource in other ext --- ext/sockets/php_sockets.h | 2 ++ ext/sockets/sockets.c | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ext/sockets/php_sockets.h b/ext/sockets/php_sockets.h index b1ee5798c9d..209b4d16599 100644 --- a/ext/sockets/php_sockets.h +++ b/ext/sockets/php_sockets.h @@ -70,6 +70,8 @@ struct sockaddr_un { #endif PHP_SOCKETS_API int php_sockets_le_socket(void); +PHP_SOCKETS_API php_socket *php_create_socket(void); +PHP_SOCKETS_API void php_destroy_socket(zend_resource *rsrc TSRMLS_DC); #define php_sockets_le_socket_name "Socket" diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c index 0dab51bed61..584d98576f7 100644 --- a/ext/sockets/sockets.c +++ b/ext/sockets/sockets.c @@ -384,7 +384,7 @@ PHP_SOCKETS_API int php_sockets_le_socket(void) /* {{{ */ /* allocating function to make programming errors due to uninitialized fields * less likely */ -static php_socket *php_create_socket(void) /* {{{ */ +PHP_SOCKETS_API php_socket *php_create_socket(void) /* {{{ */ { php_socket *php_sock = emalloc(sizeof(php_socket)); @@ -398,7 +398,7 @@ static php_socket *php_create_socket(void) /* {{{ */ } /* }}} */ -static void php_destroy_socket(zend_resource *rsrc TSRMLS_DC) /* {{{ */ +PHP_SOCKETS_API void php_destroy_socket(zend_resource *rsrc TSRMLS_DC) /* {{{ */ { php_socket *php_sock = rsrc->ptr; From e8868959edb34019ddb69aaecbb3c792d2f517a6 Mon Sep 17 00:00:00 2001 From: Alexander Lisachenko Date: Fri, 14 Nov 2014 15:36:56 +0300 Subject: [PATCH 023/102] Fix incorrect argument reflection info for array_multisort() --- ext/standard/basic_functions.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index a168069cfb6..758bbaab456 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -549,12 +549,9 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_array_multisort, 0, 0, 1) ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, arr1) /* ARRAY_INFO(0, arg1, 0) */ - ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, SORT_ASC_or_SORT_DESC) - ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, SORT_REGULAR_or_SORT_NUMERIC_or_SORT_STRING) - ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, arr2) - ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, SORT_ASC_or_SORT_DESC) - ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, SORT_REGULAR_or_SORT_NUMERIC_or_SORT_STRING) - ZEND_ARG_VARIADIC_INFO(ZEND_SEND_PREFER_REF, more_array_and_sort_options) + ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, sort_order) + ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, sort_flags) + ZEND_ARG_VARIADIC_INFO(ZEND_SEND_PREFER_REF, arr2) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_array_rand, 0, 0, 1) From 9fb816f45ad9baa46b91514e70f755eb88539e85 Mon Sep 17 00:00:00 2001 From: George Wang Date: Thu, 20 Nov 2014 16:49:01 -0500 Subject: [PATCH 024/102] made lsapi_main.c compatible with PHP7/phpng . --- sapi/litespeed/lsapi_main.c | 118 ++++++++++++++++++++++++++++-------- 1 file changed, 92 insertions(+), 26 deletions(-) diff --git a/sapi/litespeed/lsapi_main.c b/sapi/litespeed/lsapi_main.c index 6bdf9b7d0c0..bcc0390235d 100644 --- a/sapi/litespeed/lsapi_main.c +++ b/sapi/litespeed/lsapi_main.c @@ -155,7 +155,7 @@ static int sapi_lsapi_ub_write(const char *str, uint str_length TSRMLS_DC) /* {{{ sapi_lsapi_flush */ -static void sapi_lsapi_flush( void * server_context ) +static void sapi_lsapi_flush( void * server_context TSRMLS_DC ) { if ( lsapi_mode ) { if ( LSAPI_Flush() == -1) { @@ -200,7 +200,12 @@ static char *sapi_lsapi_getenv( char * name, size_t name_len TSRMLS_DC ) static int add_variable( const char * pKey, int keyLen, const char * pValue, int valLen, void * arg ) { - int filter_arg = (arg == PG(http_globals)[TRACK_VARS_ENV])?PARSE_ENV:PARSE_SERVER; +#if PHP_MAJOR_VERSION >= 7 + int filter_arg = (Z_ARR_P((zval *)arg) == Z_ARR(PG(http_globals)[TRACK_VARS_ENV])) + ? PARSE_ENV : PARSE_SERVER; +#else + int filter_arg = (arg == PG(http_globals)[TRACK_VARS_ENV])?PARSE_ENV:PARSE_SERVER; +#endif char * new_val = (char *) pValue; unsigned int new_val_len; @@ -238,27 +243,45 @@ static void litespeed_php_import_environment_variables(zval *array_ptr TSRMLS_DC size_t alloc_size = sizeof(buf); unsigned long nlen; /* ptrdiff_t is not portable */ - if (PG(http_globals)[TRACK_VARS_ENV] && - array_ptr != PG(http_globals)[TRACK_VARS_ENV] && - Z_TYPE_P(PG(http_globals)[TRACK_VARS_ENV]) == IS_ARRAY && - zend_hash_num_elements(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_ENV])) > 0 +#if PHP_MAJOR_VERSION >= 7 + if (Z_TYPE(PG(http_globals)[TRACK_VARS_ENV]) == IS_ARRAY && + Z_ARR_P(array_ptr) != Z_ARR(PG(http_globals)[TRACK_VARS_ENV]) && + zend_hash_num_elements(Z_ARRVAL(PG(http_globals)[TRACK_VARS_ENV])) > 0 ) { - zval_dtor(array_ptr); - *array_ptr = *PG(http_globals)[TRACK_VARS_ENV]; - INIT_PZVAL(array_ptr); - zval_copy_ctor(array_ptr); + zval_dtor(array_ptr); + ZVAL_DUP(array_ptr, &PG(http_globals)[TRACK_VARS_ENV]); return; - } else if (PG(http_globals)[TRACK_VARS_SERVER] && - array_ptr != PG(http_globals)[TRACK_VARS_SERVER] && - Z_TYPE_P(PG(http_globals)[TRACK_VARS_SERVER]) == IS_ARRAY && - zend_hash_num_elements(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER])) > 0 + } else if (Z_TYPE(PG(http_globals)[TRACK_VARS_SERVER]) == IS_ARRAY && + Z_ARR_P(array_ptr) != Z_ARR(PG(http_globals)[TRACK_VARS_SERVER]) && + zend_hash_num_elements(Z_ARRVAL(PG(http_globals)[TRACK_VARS_SERVER])) > 0 ) { - zval_dtor(array_ptr); - *array_ptr = *PG(http_globals)[TRACK_VARS_SERVER]; - INIT_PZVAL(array_ptr); - zval_copy_ctor(array_ptr); + zval_dtor(array_ptr); + ZVAL_DUP(array_ptr, &PG(http_globals)[TRACK_VARS_SERVER]); return; } +#else + if (PG(http_globals)[TRACK_VARS_ENV] && + array_ptr != PG(http_globals)[TRACK_VARS_ENV] && + Z_TYPE_P(PG(http_globals)[TRACK_VARS_ENV]) == IS_ARRAY && + zend_hash_num_elements(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_ENV])) > 0 + ) { + zval_dtor(array_ptr); + *array_ptr = *PG(http_globals)[TRACK_VARS_ENV]; + INIT_PZVAL(array_ptr); + zval_copy_ctor(array_ptr); + return; + } else if (PG(http_globals)[TRACK_VARS_SERVER] && + array_ptr != PG(http_globals)[TRACK_VARS_SERVER] && + Z_TYPE_P(PG(http_globals)[TRACK_VARS_SERVER]) == IS_ARRAY && + zend_hash_num_elements(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER])) > 0 + ) { + zval_dtor(array_ptr); + *array_ptr = *PG(http_globals)[TRACK_VARS_SERVER]; + INIT_PZVAL(array_ptr); + zval_copy_ctor(array_ptr); + return; + } +#endif for (env = environ; env != NULL && *env != NULL; env++) { p = strchr(*env, '='); @@ -592,6 +615,9 @@ static int lsapi_module_main(int show_source TSRMLS_DC) static int alter_ini( const char * pKey, int keyLen, const char * pValue, int valLen, void * arg ) { +#if PHP_MAJOR_VERSION >= 7 + zend_string * psKey; +#endif int type = ZEND_INI_PERDIR; if ( '\001' == *pKey ) { ++pKey; @@ -606,9 +632,19 @@ static int alter_ini( const char * pKey, int keyLen, const char * pValue, int va engine = 0; } else - zend_alter_ini_entry((char *)pKey, keyLen, + { +#if PHP_MAJOR_VERSION >= 7 + psKey = STR_INIT( pKey, keyLen, 1 ); + zend_alter_ini_entry(psKey, (char *)pValue, valLen, type, PHP_INI_STAGE_ACTIVATE); + STR_RELEASE( psKey ); +#else + zend_alter_ini_entry((char *)pKey, keyLen, + (char *)pValue, valLen, + type, PHP_INI_STAGE_ACTIVATE); +#endif + } } return 1; } @@ -749,6 +785,9 @@ static int cli_main( int argc, char * argv[] ) char ** argend= &argv[argc]; int ret = -1; int c; +#if PHP_MAJOR_VERSION >= 7 + zend_string * psKey; +#endif lsapi_mode = 0; /* enter CLI mode */ #ifdef PHP_WIN32 @@ -763,12 +802,21 @@ static int cli_main( int argc, char * argv[] ) zend_uv.html_errors = 0; /* tell the engine we're in non-html mode */ CG(in_compilation) = 0; /* not initialized but needed for several options */ +#if PHP_MAJOR_VERSION < 7 EG(uninitialized_zval_ptr) = NULL; - +#endif for( ini = ini_defaults; *ini; ini+=2 ) { +#if PHP_MAJOR_VERSION >= 7 + psKey = STR_INIT( *ini, strlen( *ini ), 1 ); + zend_alter_ini_entry( psKey, + (char *)*(ini+1), strlen( *(ini+1) ), + PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE); + STR_RELEASE( psKey ); +#else zend_alter_ini_entry( (char *)*ini, strlen( *ini )+1, (char *)*(ini+1), strlen( *(ini+1) ), PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE); +#endif } while (( p < argend )&&(**p == '-' )) { @@ -1148,7 +1196,11 @@ zend_module_entry litespeed_module_entry = { static int add_associate_array( const char * pKey, int keyLen, const char * pValue, int valLen, void * arg ) { - add_assoc_string_ex( (zval *)arg, (char *)pKey, keyLen+1, (char *)pValue, 1 ); + add_assoc_string_ex( (zval *)arg, (char *)pKey, keyLen+1, (char *)pValue +#if PHP_MAJOR_VERSION < 7 + , 1 +#endif + ); return 1; } @@ -1202,7 +1254,11 @@ PHP_FUNCTION(litespeed_response_headers) headerBuf[len] = 0; if ( len ) { while( isspace(*++p)); - add_assoc_string_ex(return_value, headerBuf, len+1, p, 1 ); + add_assoc_string_ex(return_value, headerBuf, len+1, p +#if PHP_MAJOR_VERSION < 7 + , 1 +#endif + ); } } } @@ -1217,15 +1273,25 @@ PHP_FUNCTION(litespeed_response_headers) Fetch all loaded module names */ PHP_FUNCTION(apache_get_modules) { + static const char * mod_names[] = + { + "mod_rewrite", "mod_mime", "mod_headers", "mod_expires", NULL + }; + const char **name = mod_names; /* TODO: */ if (ZEND_NUM_ARGS() > 0) { WRONG_PARAM_COUNT; } array_init(return_value); - add_next_index_string(return_value, "mod_rewrite", 1); - add_next_index_string(return_value, "mod_mime", 1); - add_next_index_string(return_value, "mod_headers", 1); - add_next_index_string(return_value, "mod_expires", 1); + while( *name ) + { + add_next_index_string(return_value, *name +#if PHP_MAJOR_VERSION < 7 + , 1 +#endif + ); + ++name; + } } /* }}} */ From bd3bc097b0cba4cb1c0778935d6557edd090ddb6 Mon Sep 17 00:00:00 2001 From: George Wang Date: Thu, 20 Nov 2014 16:49:01 -0500 Subject: [PATCH 025/102] made lsapi_main.c compatible with PHP7/phpng . --- sapi/litespeed/lsapi_main.c | 118 ++++++++++++++++++++++++++++-------- 1 file changed, 92 insertions(+), 26 deletions(-) diff --git a/sapi/litespeed/lsapi_main.c b/sapi/litespeed/lsapi_main.c index 6bdf9b7d0c0..bcc0390235d 100644 --- a/sapi/litespeed/lsapi_main.c +++ b/sapi/litespeed/lsapi_main.c @@ -155,7 +155,7 @@ static int sapi_lsapi_ub_write(const char *str, uint str_length TSRMLS_DC) /* {{{ sapi_lsapi_flush */ -static void sapi_lsapi_flush( void * server_context ) +static void sapi_lsapi_flush( void * server_context TSRMLS_DC ) { if ( lsapi_mode ) { if ( LSAPI_Flush() == -1) { @@ -200,7 +200,12 @@ static char *sapi_lsapi_getenv( char * name, size_t name_len TSRMLS_DC ) static int add_variable( const char * pKey, int keyLen, const char * pValue, int valLen, void * arg ) { - int filter_arg = (arg == PG(http_globals)[TRACK_VARS_ENV])?PARSE_ENV:PARSE_SERVER; +#if PHP_MAJOR_VERSION >= 7 + int filter_arg = (Z_ARR_P((zval *)arg) == Z_ARR(PG(http_globals)[TRACK_VARS_ENV])) + ? PARSE_ENV : PARSE_SERVER; +#else + int filter_arg = (arg == PG(http_globals)[TRACK_VARS_ENV])?PARSE_ENV:PARSE_SERVER; +#endif char * new_val = (char *) pValue; unsigned int new_val_len; @@ -238,27 +243,45 @@ static void litespeed_php_import_environment_variables(zval *array_ptr TSRMLS_DC size_t alloc_size = sizeof(buf); unsigned long nlen; /* ptrdiff_t is not portable */ - if (PG(http_globals)[TRACK_VARS_ENV] && - array_ptr != PG(http_globals)[TRACK_VARS_ENV] && - Z_TYPE_P(PG(http_globals)[TRACK_VARS_ENV]) == IS_ARRAY && - zend_hash_num_elements(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_ENV])) > 0 +#if PHP_MAJOR_VERSION >= 7 + if (Z_TYPE(PG(http_globals)[TRACK_VARS_ENV]) == IS_ARRAY && + Z_ARR_P(array_ptr) != Z_ARR(PG(http_globals)[TRACK_VARS_ENV]) && + zend_hash_num_elements(Z_ARRVAL(PG(http_globals)[TRACK_VARS_ENV])) > 0 ) { - zval_dtor(array_ptr); - *array_ptr = *PG(http_globals)[TRACK_VARS_ENV]; - INIT_PZVAL(array_ptr); - zval_copy_ctor(array_ptr); + zval_dtor(array_ptr); + ZVAL_DUP(array_ptr, &PG(http_globals)[TRACK_VARS_ENV]); return; - } else if (PG(http_globals)[TRACK_VARS_SERVER] && - array_ptr != PG(http_globals)[TRACK_VARS_SERVER] && - Z_TYPE_P(PG(http_globals)[TRACK_VARS_SERVER]) == IS_ARRAY && - zend_hash_num_elements(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER])) > 0 + } else if (Z_TYPE(PG(http_globals)[TRACK_VARS_SERVER]) == IS_ARRAY && + Z_ARR_P(array_ptr) != Z_ARR(PG(http_globals)[TRACK_VARS_SERVER]) && + zend_hash_num_elements(Z_ARRVAL(PG(http_globals)[TRACK_VARS_SERVER])) > 0 ) { - zval_dtor(array_ptr); - *array_ptr = *PG(http_globals)[TRACK_VARS_SERVER]; - INIT_PZVAL(array_ptr); - zval_copy_ctor(array_ptr); + zval_dtor(array_ptr); + ZVAL_DUP(array_ptr, &PG(http_globals)[TRACK_VARS_SERVER]); return; } +#else + if (PG(http_globals)[TRACK_VARS_ENV] && + array_ptr != PG(http_globals)[TRACK_VARS_ENV] && + Z_TYPE_P(PG(http_globals)[TRACK_VARS_ENV]) == IS_ARRAY && + zend_hash_num_elements(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_ENV])) > 0 + ) { + zval_dtor(array_ptr); + *array_ptr = *PG(http_globals)[TRACK_VARS_ENV]; + INIT_PZVAL(array_ptr); + zval_copy_ctor(array_ptr); + return; + } else if (PG(http_globals)[TRACK_VARS_SERVER] && + array_ptr != PG(http_globals)[TRACK_VARS_SERVER] && + Z_TYPE_P(PG(http_globals)[TRACK_VARS_SERVER]) == IS_ARRAY && + zend_hash_num_elements(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER])) > 0 + ) { + zval_dtor(array_ptr); + *array_ptr = *PG(http_globals)[TRACK_VARS_SERVER]; + INIT_PZVAL(array_ptr); + zval_copy_ctor(array_ptr); + return; + } +#endif for (env = environ; env != NULL && *env != NULL; env++) { p = strchr(*env, '='); @@ -592,6 +615,9 @@ static int lsapi_module_main(int show_source TSRMLS_DC) static int alter_ini( const char * pKey, int keyLen, const char * pValue, int valLen, void * arg ) { +#if PHP_MAJOR_VERSION >= 7 + zend_string * psKey; +#endif int type = ZEND_INI_PERDIR; if ( '\001' == *pKey ) { ++pKey; @@ -606,9 +632,19 @@ static int alter_ini( const char * pKey, int keyLen, const char * pValue, int va engine = 0; } else - zend_alter_ini_entry((char *)pKey, keyLen, + { +#if PHP_MAJOR_VERSION >= 7 + psKey = STR_INIT( pKey, keyLen, 1 ); + zend_alter_ini_entry(psKey, (char *)pValue, valLen, type, PHP_INI_STAGE_ACTIVATE); + STR_RELEASE( psKey ); +#else + zend_alter_ini_entry((char *)pKey, keyLen, + (char *)pValue, valLen, + type, PHP_INI_STAGE_ACTIVATE); +#endif + } } return 1; } @@ -749,6 +785,9 @@ static int cli_main( int argc, char * argv[] ) char ** argend= &argv[argc]; int ret = -1; int c; +#if PHP_MAJOR_VERSION >= 7 + zend_string * psKey; +#endif lsapi_mode = 0; /* enter CLI mode */ #ifdef PHP_WIN32 @@ -763,12 +802,21 @@ static int cli_main( int argc, char * argv[] ) zend_uv.html_errors = 0; /* tell the engine we're in non-html mode */ CG(in_compilation) = 0; /* not initialized but needed for several options */ +#if PHP_MAJOR_VERSION < 7 EG(uninitialized_zval_ptr) = NULL; - +#endif for( ini = ini_defaults; *ini; ini+=2 ) { +#if PHP_MAJOR_VERSION >= 7 + psKey = STR_INIT( *ini, strlen( *ini ), 1 ); + zend_alter_ini_entry( psKey, + (char *)*(ini+1), strlen( *(ini+1) ), + PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE); + STR_RELEASE( psKey ); +#else zend_alter_ini_entry( (char *)*ini, strlen( *ini )+1, (char *)*(ini+1), strlen( *(ini+1) ), PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE); +#endif } while (( p < argend )&&(**p == '-' )) { @@ -1148,7 +1196,11 @@ zend_module_entry litespeed_module_entry = { static int add_associate_array( const char * pKey, int keyLen, const char * pValue, int valLen, void * arg ) { - add_assoc_string_ex( (zval *)arg, (char *)pKey, keyLen+1, (char *)pValue, 1 ); + add_assoc_string_ex( (zval *)arg, (char *)pKey, keyLen+1, (char *)pValue +#if PHP_MAJOR_VERSION < 7 + , 1 +#endif + ); return 1; } @@ -1202,7 +1254,11 @@ PHP_FUNCTION(litespeed_response_headers) headerBuf[len] = 0; if ( len ) { while( isspace(*++p)); - add_assoc_string_ex(return_value, headerBuf, len+1, p, 1 ); + add_assoc_string_ex(return_value, headerBuf, len+1, p +#if PHP_MAJOR_VERSION < 7 + , 1 +#endif + ); } } } @@ -1217,15 +1273,25 @@ PHP_FUNCTION(litespeed_response_headers) Fetch all loaded module names */ PHP_FUNCTION(apache_get_modules) { + static const char * mod_names[] = + { + "mod_rewrite", "mod_mime", "mod_headers", "mod_expires", NULL + }; + const char **name = mod_names; /* TODO: */ if (ZEND_NUM_ARGS() > 0) { WRONG_PARAM_COUNT; } array_init(return_value); - add_next_index_string(return_value, "mod_rewrite", 1); - add_next_index_string(return_value, "mod_mime", 1); - add_next_index_string(return_value, "mod_headers", 1); - add_next_index_string(return_value, "mod_expires", 1); + while( *name ) + { + add_next_index_string(return_value, *name +#if PHP_MAJOR_VERSION < 7 + , 1 +#endif + ); + ++name; + } } /* }}} */ From 620db04e914c14152c979b781e15f1021b6035c0 Mon Sep 17 00:00:00 2001 From: George Wang Date: Thu, 20 Nov 2014 16:49:01 -0500 Subject: [PATCH 026/102] made lsapi_main.c compatible with PHP7/phpng . --- sapi/litespeed/lsapi_main.c | 118 ++++++++++++++++++++++++++++-------- 1 file changed, 92 insertions(+), 26 deletions(-) diff --git a/sapi/litespeed/lsapi_main.c b/sapi/litespeed/lsapi_main.c index 6bdf9b7d0c0..bcc0390235d 100644 --- a/sapi/litespeed/lsapi_main.c +++ b/sapi/litespeed/lsapi_main.c @@ -155,7 +155,7 @@ static int sapi_lsapi_ub_write(const char *str, uint str_length TSRMLS_DC) /* {{{ sapi_lsapi_flush */ -static void sapi_lsapi_flush( void * server_context ) +static void sapi_lsapi_flush( void * server_context TSRMLS_DC ) { if ( lsapi_mode ) { if ( LSAPI_Flush() == -1) { @@ -200,7 +200,12 @@ static char *sapi_lsapi_getenv( char * name, size_t name_len TSRMLS_DC ) static int add_variable( const char * pKey, int keyLen, const char * pValue, int valLen, void * arg ) { - int filter_arg = (arg == PG(http_globals)[TRACK_VARS_ENV])?PARSE_ENV:PARSE_SERVER; +#if PHP_MAJOR_VERSION >= 7 + int filter_arg = (Z_ARR_P((zval *)arg) == Z_ARR(PG(http_globals)[TRACK_VARS_ENV])) + ? PARSE_ENV : PARSE_SERVER; +#else + int filter_arg = (arg == PG(http_globals)[TRACK_VARS_ENV])?PARSE_ENV:PARSE_SERVER; +#endif char * new_val = (char *) pValue; unsigned int new_val_len; @@ -238,27 +243,45 @@ static void litespeed_php_import_environment_variables(zval *array_ptr TSRMLS_DC size_t alloc_size = sizeof(buf); unsigned long nlen; /* ptrdiff_t is not portable */ - if (PG(http_globals)[TRACK_VARS_ENV] && - array_ptr != PG(http_globals)[TRACK_VARS_ENV] && - Z_TYPE_P(PG(http_globals)[TRACK_VARS_ENV]) == IS_ARRAY && - zend_hash_num_elements(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_ENV])) > 0 +#if PHP_MAJOR_VERSION >= 7 + if (Z_TYPE(PG(http_globals)[TRACK_VARS_ENV]) == IS_ARRAY && + Z_ARR_P(array_ptr) != Z_ARR(PG(http_globals)[TRACK_VARS_ENV]) && + zend_hash_num_elements(Z_ARRVAL(PG(http_globals)[TRACK_VARS_ENV])) > 0 ) { - zval_dtor(array_ptr); - *array_ptr = *PG(http_globals)[TRACK_VARS_ENV]; - INIT_PZVAL(array_ptr); - zval_copy_ctor(array_ptr); + zval_dtor(array_ptr); + ZVAL_DUP(array_ptr, &PG(http_globals)[TRACK_VARS_ENV]); return; - } else if (PG(http_globals)[TRACK_VARS_SERVER] && - array_ptr != PG(http_globals)[TRACK_VARS_SERVER] && - Z_TYPE_P(PG(http_globals)[TRACK_VARS_SERVER]) == IS_ARRAY && - zend_hash_num_elements(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER])) > 0 + } else if (Z_TYPE(PG(http_globals)[TRACK_VARS_SERVER]) == IS_ARRAY && + Z_ARR_P(array_ptr) != Z_ARR(PG(http_globals)[TRACK_VARS_SERVER]) && + zend_hash_num_elements(Z_ARRVAL(PG(http_globals)[TRACK_VARS_SERVER])) > 0 ) { - zval_dtor(array_ptr); - *array_ptr = *PG(http_globals)[TRACK_VARS_SERVER]; - INIT_PZVAL(array_ptr); - zval_copy_ctor(array_ptr); + zval_dtor(array_ptr); + ZVAL_DUP(array_ptr, &PG(http_globals)[TRACK_VARS_SERVER]); return; } +#else + if (PG(http_globals)[TRACK_VARS_ENV] && + array_ptr != PG(http_globals)[TRACK_VARS_ENV] && + Z_TYPE_P(PG(http_globals)[TRACK_VARS_ENV]) == IS_ARRAY && + zend_hash_num_elements(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_ENV])) > 0 + ) { + zval_dtor(array_ptr); + *array_ptr = *PG(http_globals)[TRACK_VARS_ENV]; + INIT_PZVAL(array_ptr); + zval_copy_ctor(array_ptr); + return; + } else if (PG(http_globals)[TRACK_VARS_SERVER] && + array_ptr != PG(http_globals)[TRACK_VARS_SERVER] && + Z_TYPE_P(PG(http_globals)[TRACK_VARS_SERVER]) == IS_ARRAY && + zend_hash_num_elements(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER])) > 0 + ) { + zval_dtor(array_ptr); + *array_ptr = *PG(http_globals)[TRACK_VARS_SERVER]; + INIT_PZVAL(array_ptr); + zval_copy_ctor(array_ptr); + return; + } +#endif for (env = environ; env != NULL && *env != NULL; env++) { p = strchr(*env, '='); @@ -592,6 +615,9 @@ static int lsapi_module_main(int show_source TSRMLS_DC) static int alter_ini( const char * pKey, int keyLen, const char * pValue, int valLen, void * arg ) { +#if PHP_MAJOR_VERSION >= 7 + zend_string * psKey; +#endif int type = ZEND_INI_PERDIR; if ( '\001' == *pKey ) { ++pKey; @@ -606,9 +632,19 @@ static int alter_ini( const char * pKey, int keyLen, const char * pValue, int va engine = 0; } else - zend_alter_ini_entry((char *)pKey, keyLen, + { +#if PHP_MAJOR_VERSION >= 7 + psKey = STR_INIT( pKey, keyLen, 1 ); + zend_alter_ini_entry(psKey, (char *)pValue, valLen, type, PHP_INI_STAGE_ACTIVATE); + STR_RELEASE( psKey ); +#else + zend_alter_ini_entry((char *)pKey, keyLen, + (char *)pValue, valLen, + type, PHP_INI_STAGE_ACTIVATE); +#endif + } } return 1; } @@ -749,6 +785,9 @@ static int cli_main( int argc, char * argv[] ) char ** argend= &argv[argc]; int ret = -1; int c; +#if PHP_MAJOR_VERSION >= 7 + zend_string * psKey; +#endif lsapi_mode = 0; /* enter CLI mode */ #ifdef PHP_WIN32 @@ -763,12 +802,21 @@ static int cli_main( int argc, char * argv[] ) zend_uv.html_errors = 0; /* tell the engine we're in non-html mode */ CG(in_compilation) = 0; /* not initialized but needed for several options */ +#if PHP_MAJOR_VERSION < 7 EG(uninitialized_zval_ptr) = NULL; - +#endif for( ini = ini_defaults; *ini; ini+=2 ) { +#if PHP_MAJOR_VERSION >= 7 + psKey = STR_INIT( *ini, strlen( *ini ), 1 ); + zend_alter_ini_entry( psKey, + (char *)*(ini+1), strlen( *(ini+1) ), + PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE); + STR_RELEASE( psKey ); +#else zend_alter_ini_entry( (char *)*ini, strlen( *ini )+1, (char *)*(ini+1), strlen( *(ini+1) ), PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE); +#endif } while (( p < argend )&&(**p == '-' )) { @@ -1148,7 +1196,11 @@ zend_module_entry litespeed_module_entry = { static int add_associate_array( const char * pKey, int keyLen, const char * pValue, int valLen, void * arg ) { - add_assoc_string_ex( (zval *)arg, (char *)pKey, keyLen+1, (char *)pValue, 1 ); + add_assoc_string_ex( (zval *)arg, (char *)pKey, keyLen+1, (char *)pValue +#if PHP_MAJOR_VERSION < 7 + , 1 +#endif + ); return 1; } @@ -1202,7 +1254,11 @@ PHP_FUNCTION(litespeed_response_headers) headerBuf[len] = 0; if ( len ) { while( isspace(*++p)); - add_assoc_string_ex(return_value, headerBuf, len+1, p, 1 ); + add_assoc_string_ex(return_value, headerBuf, len+1, p +#if PHP_MAJOR_VERSION < 7 + , 1 +#endif + ); } } } @@ -1217,15 +1273,25 @@ PHP_FUNCTION(litespeed_response_headers) Fetch all loaded module names */ PHP_FUNCTION(apache_get_modules) { + static const char * mod_names[] = + { + "mod_rewrite", "mod_mime", "mod_headers", "mod_expires", NULL + }; + const char **name = mod_names; /* TODO: */ if (ZEND_NUM_ARGS() > 0) { WRONG_PARAM_COUNT; } array_init(return_value); - add_next_index_string(return_value, "mod_rewrite", 1); - add_next_index_string(return_value, "mod_mime", 1); - add_next_index_string(return_value, "mod_headers", 1); - add_next_index_string(return_value, "mod_expires", 1); + while( *name ) + { + add_next_index_string(return_value, *name +#if PHP_MAJOR_VERSION < 7 + , 1 +#endif + ); + ++name; + } } /* }}} */ From dce692dfa051ee98dc398e12e83377ce6519a7d6 Mon Sep 17 00:00:00 2001 From: George Wang Date: Thu, 20 Nov 2014 16:49:01 -0500 Subject: [PATCH 027/102] made lsapi_main.c compatible with PHP7/phpng . Conflicts: sapi/litespeed/lsapi_main.c --- sapi/litespeed/lsapi_main.c | 116 ++++++++++++++++++++++++++++-------- 1 file changed, 91 insertions(+), 25 deletions(-) diff --git a/sapi/litespeed/lsapi_main.c b/sapi/litespeed/lsapi_main.c index a9f27fcea1d..54b7ef9166b 100644 --- a/sapi/litespeed/lsapi_main.c +++ b/sapi/litespeed/lsapi_main.c @@ -200,7 +200,12 @@ static char *sapi_lsapi_getenv( char * name, size_t name_len TSRMLS_DC ) static int add_variable( const char * pKey, int keyLen, const char * pValue, int valLen, void * arg ) { - int filter_arg = (arg == PG(http_globals)[TRACK_VARS_ENV])?PARSE_ENV:PARSE_SERVER; +#if PHP_MAJOR_VERSION >= 7 + int filter_arg = (Z_ARR_P((zval *)arg) == Z_ARR(PG(http_globals)[TRACK_VARS_ENV])) + ? PARSE_ENV : PARSE_SERVER; +#else + int filter_arg = (arg == PG(http_globals)[TRACK_VARS_ENV])?PARSE_ENV:PARSE_SERVER; +#endif char * new_val = (char *) pValue; unsigned int new_val_len; @@ -238,27 +243,45 @@ static void litespeed_php_import_environment_variables(zval *array_ptr TSRMLS_DC size_t alloc_size = sizeof(buf); unsigned long nlen; /* ptrdiff_t is not portable */ - if (PG(http_globals)[TRACK_VARS_ENV] && - array_ptr != PG(http_globals)[TRACK_VARS_ENV] && - Z_TYPE_P(PG(http_globals)[TRACK_VARS_ENV]) == IS_ARRAY && - zend_hash_num_elements(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_ENV])) > 0 +#if PHP_MAJOR_VERSION >= 7 + if (Z_TYPE(PG(http_globals)[TRACK_VARS_ENV]) == IS_ARRAY && + Z_ARR_P(array_ptr) != Z_ARR(PG(http_globals)[TRACK_VARS_ENV]) && + zend_hash_num_elements(Z_ARRVAL(PG(http_globals)[TRACK_VARS_ENV])) > 0 ) { - zval_dtor(array_ptr); - *array_ptr = *PG(http_globals)[TRACK_VARS_ENV]; - INIT_PZVAL(array_ptr); - zval_copy_ctor(array_ptr); + zval_dtor(array_ptr); + ZVAL_DUP(array_ptr, &PG(http_globals)[TRACK_VARS_ENV]); return; - } else if (PG(http_globals)[TRACK_VARS_SERVER] && - array_ptr != PG(http_globals)[TRACK_VARS_SERVER] && - Z_TYPE_P(PG(http_globals)[TRACK_VARS_SERVER]) == IS_ARRAY && - zend_hash_num_elements(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER])) > 0 + } else if (Z_TYPE(PG(http_globals)[TRACK_VARS_SERVER]) == IS_ARRAY && + Z_ARR_P(array_ptr) != Z_ARR(PG(http_globals)[TRACK_VARS_SERVER]) && + zend_hash_num_elements(Z_ARRVAL(PG(http_globals)[TRACK_VARS_SERVER])) > 0 ) { - zval_dtor(array_ptr); - *array_ptr = *PG(http_globals)[TRACK_VARS_SERVER]; - INIT_PZVAL(array_ptr); - zval_copy_ctor(array_ptr); + zval_dtor(array_ptr); + ZVAL_DUP(array_ptr, &PG(http_globals)[TRACK_VARS_SERVER]); return; } +#else + if (PG(http_globals)[TRACK_VARS_ENV] && + array_ptr != PG(http_globals)[TRACK_VARS_ENV] && + Z_TYPE_P(PG(http_globals)[TRACK_VARS_ENV]) == IS_ARRAY && + zend_hash_num_elements(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_ENV])) > 0 + ) { + zval_dtor(array_ptr); + *array_ptr = *PG(http_globals)[TRACK_VARS_ENV]; + INIT_PZVAL(array_ptr); + zval_copy_ctor(array_ptr); + return; + } else if (PG(http_globals)[TRACK_VARS_SERVER] && + array_ptr != PG(http_globals)[TRACK_VARS_SERVER] && + Z_TYPE_P(PG(http_globals)[TRACK_VARS_SERVER]) == IS_ARRAY && + zend_hash_num_elements(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER])) > 0 + ) { + zval_dtor(array_ptr); + *array_ptr = *PG(http_globals)[TRACK_VARS_SERVER]; + INIT_PZVAL(array_ptr); + zval_copy_ctor(array_ptr); + return; + } +#endif for (env = environ; env != NULL && *env != NULL; env++) { p = strchr(*env, '='); @@ -592,6 +615,9 @@ static int lsapi_module_main(int show_source TSRMLS_DC) static int alter_ini( const char * pKey, int keyLen, const char * pValue, int valLen, void * arg ) { +#if PHP_MAJOR_VERSION >= 7 + zend_string * psKey; +#endif int type = ZEND_INI_PERDIR; if ( '\001' == *pKey ) { ++pKey; @@ -606,9 +632,19 @@ static int alter_ini( const char * pKey, int keyLen, const char * pValue, int va engine = 0; } else - zend_alter_ini_entry((char *)pKey, keyLen, + { +#if PHP_MAJOR_VERSION >= 7 + psKey = STR_INIT( pKey, keyLen, 1 ); + zend_alter_ini_entry(psKey, (char *)pValue, valLen, type, PHP_INI_STAGE_ACTIVATE); + STR_RELEASE( psKey ); +#else + zend_alter_ini_entry((char *)pKey, keyLen, + (char *)pValue, valLen, + type, PHP_INI_STAGE_ACTIVATE); +#endif + } } return 1; } @@ -749,6 +785,9 @@ static int cli_main( int argc, char * argv[] ) char ** argend= &argv[argc]; int ret = -1; int c; +#if PHP_MAJOR_VERSION >= 7 + zend_string * psKey; +#endif lsapi_mode = 0; /* enter CLI mode */ #ifdef PHP_WIN32 @@ -763,12 +802,21 @@ static int cli_main( int argc, char * argv[] ) zend_uv.html_errors = 0; /* tell the engine we're in non-html mode */ CG(in_compilation) = 0; /* not initialized but needed for several options */ +#if PHP_MAJOR_VERSION < 7 EG(uninitialized_zval_ptr) = NULL; - +#endif for( ini = ini_defaults; *ini; ini+=2 ) { +#if PHP_MAJOR_VERSION >= 7 + psKey = STR_INIT( *ini, strlen( *ini ), 1 ); + zend_alter_ini_entry( psKey, + (char *)*(ini+1), strlen( *(ini+1) ), + PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE); + STR_RELEASE( psKey ); +#else zend_alter_ini_entry( (char *)*ini, strlen( *ini )+1, (char *)*(ini+1), strlen( *(ini+1) ), PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE); +#endif } while (( p < argend )&&(**p == '-' )) { @@ -1148,7 +1196,11 @@ zend_module_entry litespeed_module_entry = { static int add_associate_array( const char * pKey, int keyLen, const char * pValue, int valLen, void * arg ) { - add_assoc_string_ex( (zval *)arg, (char *)pKey, keyLen+1, (char *)pValue); + add_assoc_string_ex( (zval *)arg, (char *)pKey, keyLen+1, (char *)pValue +#if PHP_MAJOR_VERSION < 7 + , 1 +#endif + ); return 1; } @@ -1202,7 +1254,11 @@ PHP_FUNCTION(litespeed_response_headers) headerBuf[len] = 0; if ( len ) { while( isspace(*++p)); - add_assoc_string_ex(return_value, headerBuf, len+1, p); + add_assoc_string_ex(return_value, headerBuf, len+1, p +#if PHP_MAJOR_VERSION < 7 + , 1 +#endif + ); } } } @@ -1217,15 +1273,25 @@ PHP_FUNCTION(litespeed_response_headers) Fetch all loaded module names */ PHP_FUNCTION(apache_get_modules) { + static const char * mod_names[] = + { + "mod_rewrite", "mod_mime", "mod_headers", "mod_expires", NULL + }; + const char **name = mod_names; /* TODO: */ if (ZEND_NUM_ARGS() > 0) { WRONG_PARAM_COUNT; } array_init(return_value); - add_next_index_string(return_value, "mod_rewrite"); - add_next_index_string(return_value, "mod_mime"); - add_next_index_string(return_value, "mod_headers"); - add_next_index_string(return_value, "mod_expires"); + while( *name ) + { + add_next_index_string(return_value, *name +#if PHP_MAJOR_VERSION < 7 + , 1 +#endif + ); + ++name; + } } /* }}} */ From 29d2c13809247dfd21b1f20d1d3771e10590694e Mon Sep 17 00:00:00 2001 From: Florian MARGAINE Date: Thu, 20 Nov 2014 18:50:34 +0100 Subject: [PATCH 028/102] Fixed bug #68391 Returns the pool config files in order Fixes https://bugs.php.net/bug.php?id=68391 --- sapi/fpm/fpm/fpm_conf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sapi/fpm/fpm/fpm_conf.c b/sapi/fpm/fpm/fpm_conf.c index 103a830389c..65a51f11c69 100644 --- a/sapi/fpm/fpm/fpm_conf.c +++ b/sapi/fpm/fpm/fpm_conf.c @@ -1250,7 +1250,7 @@ static void fpm_conf_ini_parser_include(char *inc, void *arg TSRMLS_DC) /* {{{ * #ifdef HAVE_GLOB { g.gl_offs = 0; - if ((i = glob(inc, GLOB_ERR | GLOB_MARK | GLOB_NOSORT, NULL, &g)) != 0) { + if ((i = glob(inc, GLOB_ERR | GLOB_MARK, NULL, &g)) != 0) { #ifdef GLOB_NOMATCH if (i == GLOB_NOMATCH) { zlog(ZLOG_WARNING, "Nothing matches the include pattern '%s' from %s at line %d.", inc, filename, ini_lineno); From cf3a90228644455f93ff96eddf2e27e9e5a8c812 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 21 Nov 2014 07:34:40 +0100 Subject: [PATCH 029/102] NEWS --- NEWS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS b/NEWS index cae7d0b268f..f314475d274 100644 --- a/NEWS +++ b/NEWS @@ -14,6 +14,8 @@ PHP NEWS . Fixed bug #68381 (fpm_unix_init_main ignores log_level). (David Zuelke, Remi) . Fixed bug #68452 (php-fpm man page is oudated). (Remi) + . Fixed request #68391 (php-fpm conf files loading order). + (Florian Margaine, Remi) - PDO_pgsql: . Fixed bug #66584 (Segmentation fault on statement deallocation) (Matteo) From 4ab05e8f690c055427a2a8216606be8462ff7206 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 21 Nov 2014 07:35:49 +0100 Subject: [PATCH 030/102] NEWS --- NEWS | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 790b13a56d0..c71be569a77 100644 --- a/NEWS +++ b/NEWS @@ -20,8 +20,10 @@ PHP NEWS . Fixed bug #68452 (php-fpm man page is oudated). (Remi) . Fixed request #68458 (Change pm.start_servers default warning to notice). (David Zuelke, Remi) - . Fixed request #68463 (listen.allowed_clients can silently result + . Fixed bug #68463 (listen.allowed_clients can silently result in no allowed access). (Remi) + . Fixed request #68391 (php-fpm conf files loading order). + (Florian Margaine, Remi) GMP: . Fixed bug #68419 (build error with gmp 4.1). (Remi) From 5234c2941f6fef488eea2bb625c0d5c88c2e6093 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 21 Nov 2014 07:36:34 +0100 Subject: [PATCH 031/102] add test for #68391 --- sapi/fpm/tests/016.phpt | 87 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 sapi/fpm/tests/016.phpt diff --git a/sapi/fpm/tests/016.phpt b/sapi/fpm/tests/016.phpt new file mode 100644 index 00000000000..1a9e8e7577e --- /dev/null +++ b/sapi/fpm/tests/016.phpt @@ -0,0 +1,87 @@ +--TEST-- +FPM: Test splited configuration and load order #68391 +--SKIPIF-- + +--FILE-- + +Done +--EXPECTF-- +[%s] NOTICE: [pool aaaa] 'user' directive is ignored when FPM is not running as root +[%s] NOTICE: [pool bbbb] 'user' directive is ignored when FPM is not running as root +[%s] NOTICE: [pool cccc] 'user' directive is ignored when FPM is not running as root +[%s] NOTICE: [pool dddd] 'user' directive is ignored when FPM is not running as root +[%s] NOTICE: [pool eeee] 'user' directive is ignored when FPM is not running as root +[%s] NOTICE: fpm is running, pid %d +[%s] NOTICE: ready to handle connections +OK cccc +OK aaaa +OK eeee +OK dddd +OK bbbb +[%s] NOTICE: Terminating ... +[%s] NOTICE: exiting, bye-bye! +Done +--CLEAN-- + \ No newline at end of file From 8beb1534601db46ead7b6c399de6a9131c744994 Mon Sep 17 00:00:00 2001 From: David Zuelke Date: Sat, 8 Nov 2014 20:18:58 -0500 Subject: [PATCH 032/102] Change pm.start_servers default warning to notice Unlike other settings, this has a perfectly reasonable default, calculated using a dynamic formula. If the default was hardcoded to "2" or something, then it would make sense to have a warning, since that could potentially be bad, but for a dynamically calculated value based on other mandatory settings, a notice ought to be enough. --- sapi/fpm/fpm/fpm_conf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sapi/fpm/fpm/fpm_conf.c b/sapi/fpm/fpm/fpm_conf.c index 65a51f11c69..6e255354fc9 100644 --- a/sapi/fpm/fpm/fpm_conf.c +++ b/sapi/fpm/fpm/fpm_conf.c @@ -813,7 +813,7 @@ static int fpm_conf_process_all_pools() /* {{{ */ if (config->pm_start_servers <= 0) { config->pm_start_servers = config->pm_min_spare_servers + ((config->pm_max_spare_servers - config->pm_min_spare_servers) / 2); - zlog(ZLOG_WARNING, "[pool %s] pm.start_servers is not set. It's been set to %d.", wp->config->name, config->pm_start_servers); + zlog(ZLOG_NOTICE, "[pool %s] pm.start_servers is not set. It's been set to %d.", wp->config->name, config->pm_start_servers); } else if (config->pm_start_servers < config->pm_min_spare_servers || config->pm_start_servers > config->pm_max_spare_servers) { zlog(ZLOG_ALERT, "[pool %s] pm.start_servers(%d) must not be less than pm.min_spare_servers(%d) and not greater than pm.max_spare_servers(%d)", wp->config->name, config->pm_start_servers, config->pm_min_spare_servers, config->pm_max_spare_servers); From 9e8d4a1b064e1d9da0b52fe808890299f74e52bb Mon Sep 17 00:00:00 2001 From: David Zuelke Date: Wed, 19 Nov 2014 23:39:00 +0100 Subject: [PATCH 033/102] move zlog_set_level() again from fpm_unix_init_main() to fpm_conf_post_process() this time (see #894), because otherwise nothing in fpm_conf_init_main() obeys log levels --- sapi/fpm/fpm/fpm_conf.c | 1 + sapi/fpm/fpm/fpm_unix.c | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/sapi/fpm/fpm/fpm_conf.c b/sapi/fpm/fpm/fpm_conf.c index 6e255354fc9..908c7884a62 100644 --- a/sapi/fpm/fpm/fpm_conf.c +++ b/sapi/fpm/fpm/fpm_conf.c @@ -1153,6 +1153,7 @@ static int fpm_conf_post_process(int force_daemon TSRMLS_DC) /* {{{ */ } fpm_globals.log_level = fpm_global_config.log_level; + zlog_set_level(fpm_globals.log_level); if (fpm_global_config.process_max < 0) { zlog(ZLOG_ERROR, "process_max can't be negative"); diff --git a/sapi/fpm/fpm/fpm_unix.c b/sapi/fpm/fpm/fpm_unix.c index 5dfdb4ab38c..7ce2bcc6e67 100644 --- a/sapi/fpm/fpm/fpm_unix.c +++ b/sapi/fpm/fpm/fpm_unix.c @@ -231,8 +231,6 @@ int fpm_unix_init_main() /* {{{ */ struct fpm_worker_pool_s *wp; int is_root = !geteuid(); - zlog_set_level(fpm_globals.log_level); - if (fpm_global_config.rlimit_files) { struct rlimit r; From 1f4972e348bc08b0eb09c8300b58578169614e28 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 21 Nov 2014 07:49:53 +0100 Subject: [PATCH 034/102] NEWS --- NEWS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS b/NEWS index f314475d274..cfc97562d12 100644 --- a/NEWS +++ b/NEWS @@ -14,6 +14,8 @@ PHP NEWS . Fixed bug #68381 (fpm_unix_init_main ignores log_level). (David Zuelke, Remi) . Fixed bug #68452 (php-fpm man page is oudated). (Remi) + . Fixed request #68458 (Change pm.start_servers default warning to + notice). (David Zuelke, Remi) . Fixed request #68391 (php-fpm conf files loading order). (Florian Margaine, Remi) From c4ca220467a94ff361c6dbdec281b861c9d749be Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Thu, 20 Nov 2014 10:15:15 +0100 Subject: [PATCH 035/102] Raise a warning when listen = hostname used and is resolved as multiple addresses Using getaddrinfo is perhaps not a good idea... if we are not able to listen on multiple addresses... At least this message should help to diagnose problem, ex ... Found address for localhost, socket opened on ::1 ... Found multiple addresses for localhost, 127.0.0.1 ignored --- sapi/fpm/fpm/fpm_sockets.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/sapi/fpm/fpm/fpm_sockets.c b/sapi/fpm/fpm/fpm_sockets.c index 9d9def35c7c..0286f0eee8d 100644 --- a/sapi/fpm/fpm/fpm_sockets.c +++ b/sapi/fpm/fpm/fpm_sockets.c @@ -255,6 +255,7 @@ static int fpm_socket_af_inet_listening_socket(struct fpm_worker_pool_s *wp) /* char *dup_address = strdup(wp->config->listen_address); char *port_str = strrchr(dup_address, ':'); char *addr = NULL; + char tmpbuf[INET6_ADDRSTRLEN]; int addr_len; int port = 0; int sock = -1; @@ -302,14 +303,18 @@ static int fpm_socket_af_inet_listening_socket(struct fpm_worker_pool_s *wp) /* return -1; } - free(dup_address); - for (p = servinfo; p != NULL; p = p->ai_next) { - if ((sock = fpm_sockets_get_listening_socket(wp, p->ai_addr, p->ai_addrlen)) != -1) { - break; + inet_ntop(p->ai_family, fpm_get_in_addr(p->ai_addr), tmpbuf, INET6_ADDRSTRLEN); + if (sock < 0) { + if ((sock = fpm_sockets_get_listening_socket(wp, p->ai_addr, p->ai_addrlen)) != -1) { + zlog(ZLOG_DEBUG, "Found address for %s, socket opened on %s", dup_address, tmpbuf); + } + } else { + zlog(ZLOG_WARNING, "Found multiple addresses for %s, %s ignored", dup_address, tmpbuf); } } + free(dup_address); freeaddrinfo(servinfo); return sock; From 5be75da2027ca9fe1726536ff68a5a8b3c31fa96 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Thu, 20 Nov 2014 15:14:34 +0100 Subject: [PATCH 036/102] Fix bug #68463 listen.allowed_clients can silently result in no allowed access Add a "There are no allowed addresses for this pool" --- sapi/fpm/fpm/fastcgi.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sapi/fpm/fpm/fastcgi.c b/sapi/fpm/fpm/fastcgi.c index 36e37b79d39..d2764a59b72 100644 --- a/sapi/fpm/fpm/fastcgi.c +++ b/sapi/fpm/fpm/fastcgi.c @@ -280,6 +280,10 @@ void fcgi_set_allowed_clients(char *ip) } allowed_clients[n].sa.sa_family = 0; free(ip); + if (!n) { + zlog(ZLOG_ERROR, "There are no allowed addresses for this pool"); + /* don't clear allowed_clients as it will create an "open for all" security issue */ + } } } From 8be510ae63d3606de0f9907bbec6625fbe6fc4a3 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 21 Nov 2014 07:56:39 +0100 Subject: [PATCH 037/102] NEWS --- NEWS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS b/NEWS index cfc97562d12..53e26927b52 100644 --- a/NEWS +++ b/NEWS @@ -16,6 +16,8 @@ PHP NEWS . Fixed bug #68452 (php-fpm man page is oudated). (Remi) . Fixed request #68458 (Change pm.start_servers default warning to notice). (David Zuelke, Remi) + . Fixed bug #68463 (listen.allowed_clients can silently result + in no allowed access). (Remi) . Fixed request #68391 (php-fpm conf files loading order). (Florian Margaine, Remi) From 502ce90873d1d7ffc0c359b58d7d49691080804e Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Thu, 20 Nov 2014 18:29:14 +0100 Subject: [PATCH 038/102] forked bug67052.phpt for Windows --- ext/intl/tests/bug67052-win32.phpt | 30 ++++++++++++++++++++++++++++++ ext/intl/tests/bug67052.phpt | 5 +++++ 2 files changed, 35 insertions(+) create mode 100644 ext/intl/tests/bug67052-win32.phpt diff --git a/ext/intl/tests/bug67052-win32.phpt b/ext/intl/tests/bug67052-win32.phpt new file mode 100644 index 00000000000..5bc6497bea4 --- /dev/null +++ b/ext/intl/tests/bug67052-win32.phpt @@ -0,0 +1,30 @@ +--TEST-- +Bug #67052 - NumberFormatter::parse() resets LC_NUMERIC setting +--SKIPIF-- + + +--FILE-- +parse($num)."\n"; + $res_str .= setlocale(LC_NUMERIC, 0); + return $res_str; +} + +include_once( 'ut_common.inc' ); +ut_run(); + +?> +--EXPECT-- +1234567,891 +de-de + diff --git a/ext/intl/tests/bug67052.phpt b/ext/intl/tests/bug67052.phpt index c8363b9c7ac..8edd65de71d 100644 --- a/ext/intl/tests/bug67052.phpt +++ b/ext/intl/tests/bug67052.phpt @@ -2,6 +2,11 @@ Bug #67052 - NumberFormatter::parse() resets LC_NUMERIC setting --SKIPIF-- + --FILE-- Date: Fri, 21 Nov 2014 09:57:12 +0100 Subject: [PATCH 039/102] partially fixed bug #66265 NTS mode should additionally use _putenv to satisfy libs like gettext relying on _getenv. As _putenv isn't thread safe, it wouldn't bring much for the TS mode as it would change locale across all the threads and require locking to avoid random fails with concurrent _getenv calls. --- ext/standard/basic_functions.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index ace6540a04e..cadbb7f2e59 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -4138,13 +4138,17 @@ PHP_FUNCTION(putenv) if (putenv(pe.putenv_string) == 0) { /* success */ # else error_code = SetEnvironmentVariable(pe.key, value); -# if _MSC_VER < 1500 - /* Yet another VC6 bug, unset may return env not found */ - if (error_code != 0 || - (error_code == 0 && GetLastError() == ERROR_ENVVAR_NOT_FOUND)) { -# else - if (error_code != 0) { /* success */ -# endif + + if (error_code != 0 +# ifndef ZTS + /* We need both SetEnvironmentVariable and _putenv here as some + dependency lib could use either way to read the environment. + Obviously the CRT version will be useful more often. But + generally, doing both brings us on the safe track at least + in NTS build. */ + && _putenv(pe.putenv_string) == 0 +# endif + ) { /* success */ # endif #endif zend_hash_add(&BG(putenv_ht), pe.key, pe.key_len + 1, (void **) &pe, sizeof(putenv_entry), NULL); From f2e33dc725ebc56a4871ae38e3a36ec96dba21ea Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Fri, 21 Nov 2014 10:22:47 +0100 Subject: [PATCH 040/102] added test for things done so far for bug #66265 --- .../tests/66265/de_DE/LC_MESSAGES/domain.mo | Bin 0 -> 458 bytes .../tests/66265/de_DE/LC_MESSAGES/domain.po | 17 +++++++ .../tests/66265/en_US/LC_MESSAGES/domain.mo | Bin 0 -> 445 bytes .../tests/66265/en_US/LC_MESSAGES/domain.po | 17 +++++++ .../tests/66265/fr_FR/LC_MESSAGES/domain.mo | Bin 0 -> 458 bytes .../tests/66265/fr_FR/LC_MESSAGES/domain.po | 17 +++++++ ext/gettext/tests/bug66267.phpt | 47 ++++++++++++++++++ 7 files changed, 98 insertions(+) create mode 100644 ext/gettext/tests/66265/de_DE/LC_MESSAGES/domain.mo create mode 100644 ext/gettext/tests/66265/de_DE/LC_MESSAGES/domain.po create mode 100644 ext/gettext/tests/66265/en_US/LC_MESSAGES/domain.mo create mode 100644 ext/gettext/tests/66265/en_US/LC_MESSAGES/domain.po create mode 100644 ext/gettext/tests/66265/fr_FR/LC_MESSAGES/domain.mo create mode 100644 ext/gettext/tests/66265/fr_FR/LC_MESSAGES/domain.po create mode 100644 ext/gettext/tests/bug66267.phpt diff --git a/ext/gettext/tests/66265/de_DE/LC_MESSAGES/domain.mo b/ext/gettext/tests/66265/de_DE/LC_MESSAGES/domain.mo new file mode 100644 index 0000000000000000000000000000000000000000..1aaba7b27badf4f3cfd2e301d508536f7543893d GIT binary patch literal 458 zcmZvYO-{ow5QPJRO_r=#m>me5+G&X@w?T;hph~R>DE#b@+YCvNYe%+=;2_+Hb8r@% zrfN4l`IF|!&*QOwj}E>)r+vq<uZc1%^UGJD5@&5=0}`Zl4oM zhzsHe_$cc}|K>WR$xXSjIMrMl!L8B^p+28qZ!W#^r(EVMo&!#SFB$S@li6rDAPtB= zP||{QJ-#Y8jD=6zsst}(4=oC=4cPcG9pmmUSKsvp8js{cWu?p+>ds5+zu;Stpqn8Q z1zBkk4WfV&x7B!j!wpp277PV`B37CUJXU&X7?Rc6nmFvCri@P|I*AcI>un#wPzJBV Kk?$3}{_;OyS$cl} literal 0 HcmV?d00001 diff --git a/ext/gettext/tests/66265/de_DE/LC_MESSAGES/domain.po b/ext/gettext/tests/66265/de_DE/LC_MESSAGES/domain.po new file mode 100644 index 00000000000..d2496d78fc8 --- /dev/null +++ b/ext/gettext/tests/66265/de_DE/LC_MESSAGES/domain.po @@ -0,0 +1,17 @@ +msgid "" +msgstr "" +"Project-Id-Version: bugs.php.net/66265\n" +"POT-Creation-Date: 2014-11-20 16:33+0100\n" +"PO-Revision-Date: 2014-11-20 16:40+0100\n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 1.6.10\n" +"X-Poedit-Basepath: .\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: de_DE\n" + +msgid "hello" +msgstr "hallo" diff --git a/ext/gettext/tests/66265/en_US/LC_MESSAGES/domain.mo b/ext/gettext/tests/66265/en_US/LC_MESSAGES/domain.mo new file mode 100644 index 0000000000000000000000000000000000000000..79d02c173277df033bc4ebf48e389f8a5c77c99a GIT binary patch literal 445 zcmZvYO-{ow5QPJRO_r=#m>me5+G&X@mux64s?>@ADX^>Dc1VI!JF;B_2jMK-hO;nf zP`lyDpEOT?GyeHGI{5NX`^YhJfgB=NNUa2^{XH_<^StLj|BW@Sjq2X5awtpfB}Tu& z!qL%^K7p}?R)WmenGLGE3KY0j6ot{HpWLOiZ$LT>&>QJMkdW~X<(!6$@JO`V=ZrIk zLHYpiMLp=>T!%Hev9yk+Mk-rMr;Q-~SgLF-GoUHR75d3>7aT2h8tls+Q^a)wOLs~RJE}-4tu02<5NXWV#3dQ+eZijYBqiJz2=vH0Rz!? AH~;_u literal 0 HcmV?d00001 diff --git a/ext/gettext/tests/66265/en_US/LC_MESSAGES/domain.po b/ext/gettext/tests/66265/en_US/LC_MESSAGES/domain.po new file mode 100644 index 00000000000..670d7ddadf8 --- /dev/null +++ b/ext/gettext/tests/66265/en_US/LC_MESSAGES/domain.po @@ -0,0 +1,17 @@ +msgid "" +msgstr "" +"Project-Id-Version: bugs.php.net/66265\n" +"POT-Creation-Date: 2014-11-20 16:33+0100\n" +"PO-Revision-Date: 2014-11-20 16:40+0100\n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 1.6.10\n" +"X-Poedit-Basepath: .\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: en_US\n" + +msgid "hello" +msgstr "hello" diff --git a/ext/gettext/tests/66265/fr_FR/LC_MESSAGES/domain.mo b/ext/gettext/tests/66265/fr_FR/LC_MESSAGES/domain.mo new file mode 100644 index 0000000000000000000000000000000000000000..c2f3cdd6b701685d7f72b8eb968a69e83f8ba6cf GIT binary patch literal 458 zcmZvXO-{ow5QPJRO_r=#m>me5#wm@8+aN?~P^DIcD*Wt_+fI`p*N$ul!9lnY=in?j zP1SCA@+ZxcpJ&FuM+e`I)xPD}a$z~N^ewd#OYI*me9v)SHvY%f_N-OE-6{vprIRT6 z4s(M?3;Ya97gA6(t1|7CdFcr-tuPG2j+;EBc%Xn88^CwW07ZdME-@iE@DT}VyM68x z-?u?Lg^!|c^lz?n)#S!Z8=NX8G-pOCicp`;ZZ<=&-7ync#WKJtuoXq_WHcG>79^hU z4x}(3Y>%(fE@R-+v`Wqj(L?i`DGeriN@LvJ\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 1.6.10\n" +"X-Poedit-Basepath: .\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Language: fr_FR\n" + +msgid "hello" +msgstr "salut" diff --git a/ext/gettext/tests/bug66267.phpt b/ext/gettext/tests/bug66267.phpt new file mode 100644 index 00000000000..c3aa42379e5 --- /dev/null +++ b/ext/gettext/tests/bug66267.phpt @@ -0,0 +1,47 @@ +--TEST-- +#66265: gettext doesn't switch locales within the same script +--SKIPIF-- + +--FILE-- + +==DONE== +--EXPECTF-- +LC_ALL=de_DE +hello=hallo + +LC_ALL=fr_FR +hello=salut + +LC_ALL=en_US +hello=hello + +==DONE== + From 1e14f805f9d5798bcf71334ee61eb5f85916599e Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 21 Nov 2014 11:28:20 +0100 Subject: [PATCH 041/102] add test for fastcgi_finish_request() --- sapi/fpm/tests/017.phpt | 67 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 sapi/fpm/tests/017.phpt diff --git a/sapi/fpm/tests/017.phpt b/sapi/fpm/tests/017.phpt new file mode 100644 index 00000000000..ea0738a1c73 --- /dev/null +++ b/sapi/fpm/tests/017.phpt @@ -0,0 +1,67 @@ +--TEST-- +FPM: Test fastcgi_finish_request function +--SKIPIF-- + +--FILE-- + +Done +--EXPECTF-- +[%s] NOTICE: fpm is running, pid %d +[%s] NOTICE: ready to handle connections +Test Start + +Request ok +[%s] NOTICE: Terminating ... +[%s] NOTICE: exiting, bye-bye! +Done +--CLEAN-- + \ No newline at end of file From 59a9e7af215fb2411035f8d75386acbb38cd8e83 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Fri, 21 Nov 2014 13:56:49 +0100 Subject: [PATCH 042/102] fixed test on Linux gettext requires a locale to be installed on the system --- ext/gettext/tests/bug66267.phpt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ext/gettext/tests/bug66267.phpt b/ext/gettext/tests/bug66267.phpt index c3aa42379e5..26963acb7e6 100644 --- a/ext/gettext/tests/bug66267.phpt +++ b/ext/gettext/tests/bug66267.phpt @@ -10,6 +10,14 @@ if (PHP_ZTS) { should be even XFAIL till it's fixed there */ die("skip NTS only"); } +if (substr(PHP_OS, 0, 3) != 'WIN') { + $loc = ["de_DE", "fr_FR", "en_US"]; + foreach($loc as $l) { + if (!setlocale(LC_ALL, $l)) { + die("SKIP '$l' locale not supported."); + } + } +} ?> --FILE-- Date: Wed, 29 Oct 2014 14:39:48 +0100 Subject: [PATCH 043/102] Fix #68185 - Inconsistent insteadof definition --- Zend/zend_compile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index bd3e1dd8131..6e1912803e6 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -4116,7 +4116,7 @@ static void zend_traits_init_trait_structures(zend_class_entry *ce TSRMLS_DC) /* /* make sure that the trait method is not from a class mentioned in exclude_from_classes, for consistency */ - if (cur_precedence->trait_method->ce == cur_precedence->exclude_from_classes[i]) { + if (cur_precedence->trait_method->ce == cur_precedence->exclude_from_classes[j]) { zend_error(E_COMPILE_ERROR, "Inconsistent insteadof definition. " "The method %s is to be used from %s, but %s is also on the exclude list", From af3a42022b34cd595d3231a845a7d8562f4a3523 Mon Sep 17 00:00:00 2001 From: Julien Pauli Date: Fri, 21 Nov 2014 16:05:31 +0100 Subject: [PATCH 044/102] Fix #68185 - Inconsistent insteadof definition --- Zend/zend_inheritance.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c index d577ba524c0..43ef22074fa 100644 --- a/Zend/zend_inheritance.c +++ b/Zend/zend_inheritance.c @@ -1238,7 +1238,7 @@ static void zend_traits_init_trait_structures(zend_class_entry *ce TSRMLS_DC) /* /* make sure that the trait method is not from a class mentioned in exclude_from_classes, for consistency */ - if (cur_precedence->trait_method->ce == cur_precedence->exclude_from_classes[i].ce) { + if (cur_precedence->trait_method->ce == cur_precedence->exclude_from_classes[j].ce) { zend_error_noreturn(E_COMPILE_ERROR, "Inconsistent insteadof definition. " "The method %s is to be used from %s, but %s is also on the exclude list", From 99fa36cc5852b7e7ee45708175dd22cd357f2fdd Mon Sep 17 00:00:00 2001 From: Julien Pauli Date: Fri, 21 Nov 2014 16:16:54 +0100 Subject: [PATCH 045/102] Updated NEWS --- NEWS | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS b/NEWS index 53e26927b52..8a77db635f0 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,7 @@ PHP NEWS - Core: . Fixed bug #68370 ("unset($this)" can make the program crash). (Laruence) + . Fixed bug #68185 ("Inconsistent insteadof definition."- incorrectly triggered). (Julien) - FPM: . Fixed bug #68420 (listen=9000 listens to ipv6 localhost instead of all From 9a06628c8025d14ef4caaf0bac3a659289dea7df Mon Sep 17 00:00:00 2001 From: Julien Pauli Date: Fri, 21 Nov 2014 16:17:49 +0100 Subject: [PATCH 046/102] Updated NEWS --- NEWS | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS b/NEWS index c71be569a77..c0b8f37495b 100644 --- a/NEWS +++ b/NEWS @@ -8,6 +8,7 @@ PHP NEWS (Laruence) . Fixed bug #68355 (Inconsistency in example php.ini comments). (Chris McCafferty) + . Fixed bug #68185 ("Inconsistent insteadof definition."- incorrectly triggered). (Julien) - FPM: . Fixed bug #68420 (listen=9000 listens to ipv6 localhost instead of all From d2aeef63abc1135ee6a36f8d24e3ca16d8e61f00 Mon Sep 17 00:00:00 2001 From: Julien Pauli Date: Fri, 21 Nov 2014 16:18:51 +0100 Subject: [PATCH 047/102] Updated NEWS --- NEWS | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS b/NEWS index 319623c922e..af42147e734 100644 --- a/NEWS +++ b/NEWS @@ -18,6 +18,7 @@ PHP NEWS . Fixed #67959 (Segfault when calling phpversion('spl')). (Florian) . Implemented the RFC `Catchable "Call to a member function bar() on a non-object"` (Timm) + . Fixed bug #68185 ("Inconsistent insteadof definition."- incorrectly triggered). (Julien) - DBA: . Fixed bug #62490 (dba_delete returns true on missing item (inifile)). (Mike) From 96cde1841adcb2c1f48ad875e1061ce8e4442753 Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Sat, 22 Nov 2014 00:38:04 -0800 Subject: [PATCH 048/102] Revert "made lsapi_main.c compatible with PHP7/phpng ." This reverts commit 9fb816f45ad9baa46b91514e70f755eb88539e85. Not a security-related fix. --- sapi/litespeed/lsapi_main.c | 118 ++++++++---------------------------- 1 file changed, 26 insertions(+), 92 deletions(-) diff --git a/sapi/litespeed/lsapi_main.c b/sapi/litespeed/lsapi_main.c index bcc0390235d..6bdf9b7d0c0 100644 --- a/sapi/litespeed/lsapi_main.c +++ b/sapi/litespeed/lsapi_main.c @@ -155,7 +155,7 @@ static int sapi_lsapi_ub_write(const char *str, uint str_length TSRMLS_DC) /* {{{ sapi_lsapi_flush */ -static void sapi_lsapi_flush( void * server_context TSRMLS_DC ) +static void sapi_lsapi_flush( void * server_context ) { if ( lsapi_mode ) { if ( LSAPI_Flush() == -1) { @@ -200,12 +200,7 @@ static char *sapi_lsapi_getenv( char * name, size_t name_len TSRMLS_DC ) static int add_variable( const char * pKey, int keyLen, const char * pValue, int valLen, void * arg ) { -#if PHP_MAJOR_VERSION >= 7 - int filter_arg = (Z_ARR_P((zval *)arg) == Z_ARR(PG(http_globals)[TRACK_VARS_ENV])) - ? PARSE_ENV : PARSE_SERVER; -#else - int filter_arg = (arg == PG(http_globals)[TRACK_VARS_ENV])?PARSE_ENV:PARSE_SERVER; -#endif + int filter_arg = (arg == PG(http_globals)[TRACK_VARS_ENV])?PARSE_ENV:PARSE_SERVER; char * new_val = (char *) pValue; unsigned int new_val_len; @@ -243,45 +238,27 @@ static void litespeed_php_import_environment_variables(zval *array_ptr TSRMLS_DC size_t alloc_size = sizeof(buf); unsigned long nlen; /* ptrdiff_t is not portable */ -#if PHP_MAJOR_VERSION >= 7 - if (Z_TYPE(PG(http_globals)[TRACK_VARS_ENV]) == IS_ARRAY && - Z_ARR_P(array_ptr) != Z_ARR(PG(http_globals)[TRACK_VARS_ENV]) && - zend_hash_num_elements(Z_ARRVAL(PG(http_globals)[TRACK_VARS_ENV])) > 0 + if (PG(http_globals)[TRACK_VARS_ENV] && + array_ptr != PG(http_globals)[TRACK_VARS_ENV] && + Z_TYPE_P(PG(http_globals)[TRACK_VARS_ENV]) == IS_ARRAY && + zend_hash_num_elements(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_ENV])) > 0 ) { - zval_dtor(array_ptr); - ZVAL_DUP(array_ptr, &PG(http_globals)[TRACK_VARS_ENV]); + zval_dtor(array_ptr); + *array_ptr = *PG(http_globals)[TRACK_VARS_ENV]; + INIT_PZVAL(array_ptr); + zval_copy_ctor(array_ptr); return; - } else if (Z_TYPE(PG(http_globals)[TRACK_VARS_SERVER]) == IS_ARRAY && - Z_ARR_P(array_ptr) != Z_ARR(PG(http_globals)[TRACK_VARS_SERVER]) && - zend_hash_num_elements(Z_ARRVAL(PG(http_globals)[TRACK_VARS_SERVER])) > 0 + } else if (PG(http_globals)[TRACK_VARS_SERVER] && + array_ptr != PG(http_globals)[TRACK_VARS_SERVER] && + Z_TYPE_P(PG(http_globals)[TRACK_VARS_SERVER]) == IS_ARRAY && + zend_hash_num_elements(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER])) > 0 ) { - zval_dtor(array_ptr); - ZVAL_DUP(array_ptr, &PG(http_globals)[TRACK_VARS_SERVER]); + zval_dtor(array_ptr); + *array_ptr = *PG(http_globals)[TRACK_VARS_SERVER]; + INIT_PZVAL(array_ptr); + zval_copy_ctor(array_ptr); return; } -#else - if (PG(http_globals)[TRACK_VARS_ENV] && - array_ptr != PG(http_globals)[TRACK_VARS_ENV] && - Z_TYPE_P(PG(http_globals)[TRACK_VARS_ENV]) == IS_ARRAY && - zend_hash_num_elements(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_ENV])) > 0 - ) { - zval_dtor(array_ptr); - *array_ptr = *PG(http_globals)[TRACK_VARS_ENV]; - INIT_PZVAL(array_ptr); - zval_copy_ctor(array_ptr); - return; - } else if (PG(http_globals)[TRACK_VARS_SERVER] && - array_ptr != PG(http_globals)[TRACK_VARS_SERVER] && - Z_TYPE_P(PG(http_globals)[TRACK_VARS_SERVER]) == IS_ARRAY && - zend_hash_num_elements(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER])) > 0 - ) { - zval_dtor(array_ptr); - *array_ptr = *PG(http_globals)[TRACK_VARS_SERVER]; - INIT_PZVAL(array_ptr); - zval_copy_ctor(array_ptr); - return; - } -#endif for (env = environ; env != NULL && *env != NULL; env++) { p = strchr(*env, '='); @@ -615,9 +592,6 @@ static int lsapi_module_main(int show_source TSRMLS_DC) static int alter_ini( const char * pKey, int keyLen, const char * pValue, int valLen, void * arg ) { -#if PHP_MAJOR_VERSION >= 7 - zend_string * psKey; -#endif int type = ZEND_INI_PERDIR; if ( '\001' == *pKey ) { ++pKey; @@ -632,19 +606,9 @@ static int alter_ini( const char * pKey, int keyLen, const char * pValue, int va engine = 0; } else - { -#if PHP_MAJOR_VERSION >= 7 - psKey = STR_INIT( pKey, keyLen, 1 ); - zend_alter_ini_entry(psKey, - (char *)pValue, valLen, - type, PHP_INI_STAGE_ACTIVATE); - STR_RELEASE( psKey ); -#else zend_alter_ini_entry((char *)pKey, keyLen, (char *)pValue, valLen, - type, PHP_INI_STAGE_ACTIVATE); -#endif - } + type, PHP_INI_STAGE_ACTIVATE); } return 1; } @@ -785,9 +749,6 @@ static int cli_main( int argc, char * argv[] ) char ** argend= &argv[argc]; int ret = -1; int c; -#if PHP_MAJOR_VERSION >= 7 - zend_string * psKey; -#endif lsapi_mode = 0; /* enter CLI mode */ #ifdef PHP_WIN32 @@ -802,21 +763,12 @@ static int cli_main( int argc, char * argv[] ) zend_uv.html_errors = 0; /* tell the engine we're in non-html mode */ CG(in_compilation) = 0; /* not initialized but needed for several options */ -#if PHP_MAJOR_VERSION < 7 EG(uninitialized_zval_ptr) = NULL; -#endif + for( ini = ini_defaults; *ini; ini+=2 ) { -#if PHP_MAJOR_VERSION >= 7 - psKey = STR_INIT( *ini, strlen( *ini ), 1 ); - zend_alter_ini_entry( psKey, - (char *)*(ini+1), strlen( *(ini+1) ), - PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE); - STR_RELEASE( psKey ); -#else zend_alter_ini_entry( (char *)*ini, strlen( *ini )+1, (char *)*(ini+1), strlen( *(ini+1) ), PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE); -#endif } while (( p < argend )&&(**p == '-' )) { @@ -1196,11 +1148,7 @@ zend_module_entry litespeed_module_entry = { static int add_associate_array( const char * pKey, int keyLen, const char * pValue, int valLen, void * arg ) { - add_assoc_string_ex( (zval *)arg, (char *)pKey, keyLen+1, (char *)pValue -#if PHP_MAJOR_VERSION < 7 - , 1 -#endif - ); + add_assoc_string_ex( (zval *)arg, (char *)pKey, keyLen+1, (char *)pValue, 1 ); return 1; } @@ -1254,11 +1202,7 @@ PHP_FUNCTION(litespeed_response_headers) headerBuf[len] = 0; if ( len ) { while( isspace(*++p)); - add_assoc_string_ex(return_value, headerBuf, len+1, p -#if PHP_MAJOR_VERSION < 7 - , 1 -#endif - ); + add_assoc_string_ex(return_value, headerBuf, len+1, p, 1 ); } } } @@ -1273,25 +1217,15 @@ PHP_FUNCTION(litespeed_response_headers) Fetch all loaded module names */ PHP_FUNCTION(apache_get_modules) { - static const char * mod_names[] = - { - "mod_rewrite", "mod_mime", "mod_headers", "mod_expires", NULL - }; - const char **name = mod_names; /* TODO: */ if (ZEND_NUM_ARGS() > 0) { WRONG_PARAM_COUNT; } array_init(return_value); - while( *name ) - { - add_next_index_string(return_value, *name -#if PHP_MAJOR_VERSION < 7 - , 1 -#endif - ); - ++name; - } + add_next_index_string(return_value, "mod_rewrite", 1); + add_next_index_string(return_value, "mod_mime", 1); + add_next_index_string(return_value, "mod_headers", 1); + add_next_index_string(return_value, "mod_expires", 1); } /* }}} */ From b924af8db99e97ef328a9833c8d7073b6193dec8 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Sat, 22 Nov 2014 10:25:53 +0100 Subject: [PATCH 049/102] Fixed Bug #68478 acess_log don't use prefix Calling fpm_conf_process_all_pools before fpm_log_open allow to use fpm_evaluate_full_path and so to honor global prefix or pool prefix for access.log --- sapi/fpm/fpm/fpm_conf.c | 8 ++++---- sapi/fpm/fpm/fpm_log.c | 2 ++ sapi/fpm/php-fpm.conf.in | 1 + 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/sapi/fpm/fpm/fpm_conf.c b/sapi/fpm/fpm/fpm_conf.c index dab4c8bf6b1..1f73bc915c9 100644 --- a/sapi/fpm/fpm/fpm_conf.c +++ b/sapi/fpm/fpm/fpm_conf.c @@ -1200,10 +1200,6 @@ static int fpm_conf_post_process(int force_daemon TSRMLS_DC) /* {{{ */ return -1; } - if (0 > fpm_log_open(0)) { - return -1; - } - if (0 > fpm_event_pre_init(fpm_global_config.events_mechanism)) { return -1; } @@ -1212,6 +1208,10 @@ static int fpm_conf_post_process(int force_daemon TSRMLS_DC) /* {{{ */ return -1; } + if (0 > fpm_log_open(0)) { + return -1; + } + for (wp = fpm_worker_all_pools; wp; wp = wp->next) { if (!wp->config->access_log || !*wp->config->access_log) { continue; diff --git a/sapi/fpm/fpm/fpm_log.c b/sapi/fpm/fpm/fpm_log.c index c71281b0b97..b0bf32ac165 100644 --- a/sapi/fpm/fpm/fpm_log.c +++ b/sapi/fpm/fpm/fpm_log.c @@ -46,6 +46,8 @@ int fpm_log_open(int reopen) /* {{{ */ if (0 > fd) { zlog(ZLOG_SYSERROR, "failed to open access log (%s)", wp->config->access_log); return -1; + } else { + zlog(ZLOG_DEBUG, "open access log (%s)", wp->config->access_log); } if (reopen) { diff --git a/sapi/fpm/php-fpm.conf.in b/sapi/fpm/php-fpm.conf.in index 2b1566047f5..833a4f4f8c1 100644 --- a/sapi/fpm/php-fpm.conf.in +++ b/sapi/fpm/php-fpm.conf.in @@ -131,6 +131,7 @@ ; Per pool prefix ; It only applies on the following directives: +; - 'access.log' ; - 'slowlog' ; - 'listen' (unixsocket) ; - 'chroot' From fd5c421a0009cf74df028621d37dd91d8fb9db4b Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Sat, 22 Nov 2014 10:29:05 +0100 Subject: [PATCH 050/102] add test for global / pool prefix and bug #68478 --- sapi/fpm/tests/019.phpt | 80 +++++++++++++++++++++++++++++++++++++++++ sapi/fpm/tests/020.phpt | 76 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 156 insertions(+) create mode 100644 sapi/fpm/tests/019.phpt create mode 100644 sapi/fpm/tests/020.phpt diff --git a/sapi/fpm/tests/019.phpt b/sapi/fpm/tests/019.phpt new file mode 100644 index 00000000000..cdf81262441 --- /dev/null +++ b/sapi/fpm/tests/019.phpt @@ -0,0 +1,80 @@ +--TEST-- +FPM: Test global prefix +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +[%s] NOTICE: fpm is running, pid %d +[%s] NOTICE: ready to handle connections +Ping ok +File php-fpm.log.tmp exists +File php-fpm.acc.tmp exists +File php-fpm.slw.tmp exists +File php-fpm.pid.tmp exists +[%s] NOTICE: Terminating ... +[%s] NOTICE: exiting, bye-bye! +File php-fpm.pid.tmp removed +127.0.0.1 - %s "GET /ping" 200 +--CLEAN-- + diff --git a/sapi/fpm/tests/020.phpt b/sapi/fpm/tests/020.phpt new file mode 100644 index 00000000000..d45eeccff86 --- /dev/null +++ b/sapi/fpm/tests/020.phpt @@ -0,0 +1,76 @@ +--TEST-- +FPM: Test pool prefix +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +[%s] NOTICE: fpm is running, pid %d +[%s] NOTICE: ready to handle connections +Ping ok +File php-fpm.acc.tmp exists +File php-fpm.slw.tmp exists +[%s] NOTICE: Terminating ... +[%s] NOTICE: exiting, bye-bye! +127.0.0.1 - %s "GET /ping" 200 +--CLEAN-- + From 3a3f67f79b7e103b4a24acdd966ad15be48dd0d6 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Sat, 22 Nov 2014 10:29:51 +0100 Subject: [PATCH 051/102] minor typo in test --- sapi/fpm/tests/017.phpt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sapi/fpm/tests/017.phpt b/sapi/fpm/tests/017.phpt index ea0738a1c73..b3de089a702 100644 --- a/sapi/fpm/tests/017.phpt +++ b/sapi/fpm/tests/017.phpt @@ -61,7 +61,7 @@ Done --CLEAN-- \ No newline at end of file From 6b974874abe55622ed0d7610386467e6f348dc40 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Sat, 22 Nov 2014 10:30:42 +0100 Subject: [PATCH 052/102] NEWS --- NEWS | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index c0b8f37495b..7632dcdc300 100644 --- a/NEWS +++ b/NEWS @@ -25,8 +25,9 @@ PHP NEWS in no allowed access). (Remi) . Fixed request #68391 (php-fpm conf files loading order). (Florian Margaine, Remi) + . Fixed bug #68478 (acess_log don't use prefix). (Remi) -GMP: +- GMP: . Fixed bug #68419 (build error with gmp 4.1). (Remi) - PDO_pgsql: From c50ee655ea0c1ba4a1f6f7a6e37989100509d87c Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Sat, 22 Nov 2014 10:25:53 +0100 Subject: [PATCH 053/102] Fixed Bug #68478 acess_log don't use prefix Calling fpm_conf_process_all_pools before fpm_log_open allow to use fpm_evaluate_full_path and so to honor global prefix or pool prefix for access.log --- sapi/fpm/fpm/fpm_conf.c | 8 ++++---- sapi/fpm/fpm/fpm_log.c | 2 ++ sapi/fpm/php-fpm.conf.in | 1 + 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/sapi/fpm/fpm/fpm_conf.c b/sapi/fpm/fpm/fpm_conf.c index 908c7884a62..ceee2dd7900 100644 --- a/sapi/fpm/fpm/fpm_conf.c +++ b/sapi/fpm/fpm/fpm_conf.c @@ -1194,10 +1194,6 @@ static int fpm_conf_post_process(int force_daemon TSRMLS_DC) /* {{{ */ return -1; } - if (0 > fpm_log_open(0)) { - return -1; - } - if (0 > fpm_event_pre_init(fpm_global_config.events_mechanism)) { return -1; } @@ -1206,6 +1202,10 @@ static int fpm_conf_post_process(int force_daemon TSRMLS_DC) /* {{{ */ return -1; } + if (0 > fpm_log_open(0)) { + return -1; + } + for (wp = fpm_worker_all_pools; wp; wp = wp->next) { if (!wp->config->access_log || !*wp->config->access_log) { continue; diff --git a/sapi/fpm/fpm/fpm_log.c b/sapi/fpm/fpm/fpm_log.c index c71281b0b97..b0bf32ac165 100644 --- a/sapi/fpm/fpm/fpm_log.c +++ b/sapi/fpm/fpm/fpm_log.c @@ -46,6 +46,8 @@ int fpm_log_open(int reopen) /* {{{ */ if (0 > fd) { zlog(ZLOG_SYSERROR, "failed to open access log (%s)", wp->config->access_log); return -1; + } else { + zlog(ZLOG_DEBUG, "open access log (%s)", wp->config->access_log); } if (reopen) { diff --git a/sapi/fpm/php-fpm.conf.in b/sapi/fpm/php-fpm.conf.in index 2b1566047f5..833a4f4f8c1 100644 --- a/sapi/fpm/php-fpm.conf.in +++ b/sapi/fpm/php-fpm.conf.in @@ -131,6 +131,7 @@ ; Per pool prefix ; It only applies on the following directives: +; - 'access.log' ; - 'slowlog' ; - 'listen' (unixsocket) ; - 'chroot' From 9664312e30005adbd0533c7081d52e7c822eb821 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Sat, 22 Nov 2014 10:36:45 +0100 Subject: [PATCH 054/102] NEWS --- NEWS | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS b/NEWS index 8a77db635f0..8f8fff0b912 100644 --- a/NEWS +++ b/NEWS @@ -21,6 +21,7 @@ PHP NEWS in no allowed access). (Remi) . Fixed request #68391 (php-fpm conf files loading order). (Florian Margaine, Remi) + . Fixed bug #68478 (access.log don't use prefix). (Remi) - PDO_pgsql: . Fixed bug #66584 (Segmentation fault on statement deallocation) (Matteo) From c8dd41554387e100a09811cad7f7032a291a79c2 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Sat, 22 Nov 2014 10:37:22 +0100 Subject: [PATCH 055/102] typo --- NEWS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 7632dcdc300..3a04ddb7290 100644 --- a/NEWS +++ b/NEWS @@ -25,7 +25,7 @@ PHP NEWS in no allowed access). (Remi) . Fixed request #68391 (php-fpm conf files loading order). (Florian Margaine, Remi) - . Fixed bug #68478 (acess_log don't use prefix). (Remi) + . Fixed bug #68478 (access.log don't use prefix). (Remi) - GMP: . Fixed bug #68419 (build error with gmp 4.1). (Remi) From 9d7c5dbed941c4d4c18d7d5ed308a07897b7596d Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Fri, 29 Mar 2013 21:52:48 -0700 Subject: [PATCH 056/102] secured unserialize - update for BC-compatible unserialize - add tests --- ext/standard/php_var.h | 1 + .../serialize/serialization_error_001.phpt | 6 +- .../tests/serialize/unserialize_classes.phpt | 88 ++++++++++++++ ext/standard/var.c | 36 +++++- ext/standard/var_unserializer.c | 111 ++++++++++++------ ext/standard/var_unserializer.re | 44 ++++++- 6 files changed, 237 insertions(+), 49 deletions(-) create mode 100644 ext/standard/tests/serialize/unserialize_classes.phpt diff --git a/ext/standard/php_var.h b/ext/standard/php_var.h index 23225cdc42a..a4df8f51f9b 100644 --- a/ext/standard/php_var.h +++ b/ext/standard/php_var.h @@ -57,6 +57,7 @@ PHPAPI void php_var_serialize(smart_str *buf, zval *struc, php_serialize_data_t PHPAPI int php_var_unserialize(zval *rval, const unsigned char **p, const unsigned char *max, php_unserialize_data_t *var_hash TSRMLS_DC); PHPAPI int php_var_unserialize_ref(zval *rval, const unsigned char **p, const unsigned char *max, php_unserialize_data_t *var_hash TSRMLS_DC); PHPAPI int php_var_unserialize_intern(zval *rval, const unsigned char **p, const unsigned char *max, php_unserialize_data_t *var_hash TSRMLS_DC); +PHPAPI int php_var_unserialize_ex(zval *rval, const unsigned char **p, const unsigned char *max, php_unserialize_data_t *var_hash, HashTable *classes TSRMLS_DC); #define PHP_VAR_SERIALIZE_INIT(d) \ do { \ diff --git a/ext/standard/tests/serialize/serialization_error_001.phpt b/ext/standard/tests/serialize/serialization_error_001.phpt index da6f50cc02b..014128b19f5 100644 --- a/ext/standard/tests/serialize/serialization_error_001.phpt +++ b/ext/standard/tests/serialize/serialization_error_001.phpt @@ -21,7 +21,7 @@ var_dump( unserialize() ); //Test serialize with one more than the expected number of arguments var_dump( serialize(1,2) ); -var_dump( unserialize(1,2) ); +var_dump( unserialize(1,2,3) ); echo "Done"; ?> @@ -31,12 +31,12 @@ echo "Done"; Warning: serialize() expects exactly 1 parameter, 0 given in %s on line 16 NULL -Warning: unserialize() expects exactly 1 parameter, 0 given in %s on line 17 +Warning: unserialize() expects at least 1 parameter, 0 given in %s on line 17 bool(false) Warning: serialize() expects exactly 1 parameter, 2 given in %s on line 20 NULL -Warning: unserialize() expects exactly 1 parameter, 2 given in %s on line 21 +Warning: unserialize() expects at most 2 parameters, 3 given in %s on line 21 bool(false) Done diff --git a/ext/standard/tests/serialize/unserialize_classes.phpt b/ext/standard/tests/serialize/unserialize_classes.phpt new file mode 100644 index 00000000000..2a9d8a743c9 --- /dev/null +++ b/ext/standard/tests/serialize/unserialize_classes.phpt @@ -0,0 +1,88 @@ +--TEST-- +Test unserialize() with second parameter +--FILE-- + false])); +var_dump(unserialize($s, ["allowed_classes" => true])); +var_dump(unserialize($s, ["allowed_classes" => ["bar"]])); +var_dump(unserialize($s, ["allowed_classes" => ["FOO"]])); +var_dump(unserialize($s, ["allowed_classes" => ["bar", "foO"]])); + +--EXPECTF-- +array(3) { + [0]=> + object(foo)#%d (1) { + ["x"]=> + string(3) "bar" + } + [1]=> + int(2) + [2]=> + string(1) "3" +} +array(3) { + [0]=> + object(__PHP_Incomplete_Class)#%d (2) { + ["__PHP_Incomplete_Class_Name"]=> + string(3) "foo" + ["x"]=> + string(3) "bar" + } + [1]=> + int(2) + [2]=> + string(1) "3" +} +array(3) { + [0]=> + object(foo)#%d (1) { + ["x"]=> + string(3) "bar" + } + [1]=> + int(2) + [2]=> + string(1) "3" +} +array(3) { + [0]=> + object(__PHP_Incomplete_Class)#%d (2) { + ["__PHP_Incomplete_Class_Name"]=> + string(3) "foo" + ["x"]=> + string(3) "bar" + } + [1]=> + int(2) + [2]=> + string(1) "3" +} +array(3) { + [0]=> + object(foo)#%d (1) { + ["x"]=> + string(3) "bar" + } + [1]=> + int(2) + [2]=> + string(1) "3" +} +array(3) { + [0]=> + object(foo)#%d (1) { + ["x"]=> + string(3) "bar" + } + [1]=> + int(2) + [2]=> + string(1) "3" +} diff --git a/ext/standard/var.c b/ext/standard/var.c index 4f0bd24bdc9..24bdd385a5c 100644 --- a/ext/standard/var.c +++ b/ext/standard/var.c @@ -990,7 +990,7 @@ PHP_FUNCTION(serialize) } /* }}} */ -/* {{{ proto mixed unserialize(string variable_representation) +/* {{{ proto mixed unserialize(string variable_representation[, bool|array allowed_classes]) Takes a string representation of variable and recreates it */ PHP_FUNCTION(unserialize) { @@ -998,8 +998,10 @@ PHP_FUNCTION(unserialize) size_t buf_len; const unsigned char *p; php_unserialize_data_t var_hash; + zval *options = NULL, *classes = NULL; + HashTable *class_hash = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &buf, &buf_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|a", &buf, &buf_len, &options) == FAILURE) { RETURN_FALSE; } @@ -1009,8 +1011,32 @@ PHP_FUNCTION(unserialize) p = (const unsigned char*) buf; PHP_VAR_UNSERIALIZE_INIT(var_hash); - if (!php_var_unserialize(return_value, &p, p + buf_len, &var_hash TSRMLS_CC)) { + if(options != NULL) { + classes = zend_hash_str_find(Z_ARRVAL_P(options), "allowed_classes", sizeof("allowed_classes")-1); + if(classes && (Z_TYPE_P(classes) == IS_ARRAY || !zend_is_true(classes TSRMLS_CC))) { + ALLOC_HASHTABLE(class_hash); + zend_hash_init(class_hash, (Z_TYPE_P(classes) == IS_ARRAY)?zend_hash_num_elements(Z_ARRVAL_P(classes)):0, NULL, NULL, 0); + } + if(class_hash && Z_TYPE_P(classes) == IS_ARRAY) { + zval *entry; + zend_string *lcname; + + ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(classes), entry) { + convert_to_string_ex(entry); + lcname = zend_string_alloc(Z_STRLEN_P(entry), 0); + zend_str_tolower_copy(lcname->val, Z_STRVAL_P(entry), Z_STRLEN_P(entry)); + zend_hash_add_empty_element(class_hash, lcname); + zend_string_release(lcname); + } ZEND_HASH_FOREACH_END(); + } + } + + if (!php_var_unserialize_ex(return_value, &p, p + buf_len, &var_hash, class_hash TSRMLS_CC)) { PHP_VAR_UNSERIALIZE_DESTROY(var_hash); + if(class_hash) { + zend_hash_destroy(class_hash); + FREE_HASHTABLE(class_hash); + } zval_dtor(return_value); if (!EG(exception)) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Error at offset " ZEND_LONG_FMT " of %d bytes", (zend_long)((char*)p - buf), buf_len); @@ -1018,6 +1044,10 @@ PHP_FUNCTION(unserialize) RETURN_FALSE; } PHP_VAR_UNSERIALIZE_DESTROY(var_hash); + if(class_hash) { + zend_hash_destroy(class_hash); + FREE_HASHTABLE(class_hash); + } } /* }}} */ diff --git a/ext/standard/var_unserializer.c b/ext/standard/var_unserializer.c index c7641b1334c..d8b94e75cc6 100644 --- a/ext/standard/var_unserializer.c +++ b/ext/standard/var_unserializer.c @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.5 */ +/* Generated by re2c 0.13.7.5 */ #line 1 "ext/standard/var_unserializer.re" /* +----------------------------------------------------------------------+ @@ -226,6 +226,26 @@ static zend_string *unserialize_str(const unsigned char **p, size_t len, size_t return str; } +static inline int unserialize_allowed_class(zend_string *class_name, HashTable *classes) +{ + zend_string *lcname; + int res; + ALLOCA_FLAG(use_heap) + + if(classes == NULL) { + return 1; + } + if(!zend_hash_num_elements(classes)) { + return 0; + } + + STR_ALLOCA_ALLOC(lcname, class_name->len, use_heap); + zend_str_tolower_copy(lcname->val, class_name->val, class_name->len); + res = zend_hash_exists(classes, lcname); + STR_ALLOCA_FREE(lcname, use_heap); + return res; +} + #define YYFILL(n) do { } while (0) #define YYCTYPE unsigned char #define YYCURSOR cursor @@ -233,7 +253,7 @@ static zend_string *unserialize_str(const unsigned char **p, size_t len, size_t #define YYMARKER marker -#line 241 "ext/standard/var_unserializer.re" +#line 261 "ext/standard/var_unserializer.re" @@ -293,8 +313,8 @@ static inline size_t parse_uiv(const unsigned char *p) return result; } -#define UNSERIALIZE_PARAMETER zval *rval, const unsigned char **p, const unsigned char *max, php_unserialize_data_t *var_hash TSRMLS_DC -#define UNSERIALIZE_PASSTHRU rval, p, max, var_hash TSRMLS_CC +#define UNSERIALIZE_PARAMETER zval *rval, const unsigned char **p, const unsigned char *max, php_unserialize_data_t *var_hash, HashTable *classes TSRMLS_DC +#define UNSERIALIZE_PASSTHRU rval, p, max, var_hash, classes TSRMLS_CC static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, zend_long elements, int objprops) { @@ -302,7 +322,8 @@ static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, zend zval key, *data, d, *old_data; ZVAL_UNDEF(&key); - if (!php_var_unserialize(&key, p, max, NULL TSRMLS_CC)) { + + if (!php_var_unserialize_ex(&key, p, max, NULL, classes TSRMLS_CC)) { zval_dtor(&key); return 0; } @@ -354,7 +375,7 @@ static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, zend zval_dtor(&key); - if (!php_var_unserialize(data, p, max, var_hash TSRMLS_CC)) { + if (!php_var_unserialize_ex(data, p, max, var_hash, classes TSRMLS_CC)) { return 0; } @@ -462,7 +483,14 @@ static inline int object_common2(UNSERIALIZE_PARAMETER, zend_long elements) # pragma optimize("", on) #endif -PHPAPI int php_var_unserialize(UNSERIALIZE_PARAMETER) +PHPAPI int php_var_unserialize(zval *rval, const unsigned char **p, const unsigned char *max, php_unserialize_data_t *var_hash TSRMLS_DC) +{ + HashTable *classes = NULL; + return php_var_unserialize_ex(UNSERIALIZE_PASSTHRU); +} + + +PHPAPI int php_var_unserialize_ex(UNSERIALIZE_PARAMETER) { const unsigned char *cursor, *limit, *marker, *start; zval *rval_ref; @@ -481,7 +509,7 @@ PHPAPI int php_var_unserialize(UNSERIALIZE_PARAMETER) start = cursor; -#line 485 "ext/standard/var_unserializer.c" +#line 513 "ext/standard/var_unserializer.c" { YYCTYPE yych; static const unsigned char yybm[] = { @@ -541,9 +569,9 @@ yy2: yych = *(YYMARKER = ++YYCURSOR); if (yych == ':') goto yy95; yy3: -#line 826 "ext/standard/var_unserializer.re" +#line 860 "ext/standard/var_unserializer.re" { return 0; } -#line 547 "ext/standard/var_unserializer.c" +#line 575 "ext/standard/var_unserializer.c" yy4: yych = *(YYMARKER = ++YYCURSOR); if (yych == ':') goto yy89; @@ -586,13 +614,13 @@ yy13: goto yy3; yy14: ++YYCURSOR; -#line 820 "ext/standard/var_unserializer.re" +#line 854 "ext/standard/var_unserializer.re" { /* this is the case where we have less data than planned */ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Unexpected end of serialized data"); return 0; /* not sure if it should be 0 or 1 here? */ } -#line 596 "ext/standard/var_unserializer.c" +#line 624 "ext/standard/var_unserializer.c" yy16: yych = *++YYCURSOR; goto yy3; @@ -618,11 +646,12 @@ yy20: if (yybm[0+yych] & 128) { goto yy20; } - if (yych != ':') goto yy18; + if (yych <= '/') goto yy18; + if (yych >= ';') goto yy18; yych = *++YYCURSOR; if (yych != '"') goto yy18; ++YYCURSOR; -#line 681 "ext/standard/var_unserializer.re" +#line 709 "ext/standard/var_unserializer.re" { size_t len, len2, len3, maxlen; zend_long elements; @@ -672,6 +701,12 @@ yy20: class_name = zend_string_init(str, len, 0); do { + if(!unserialize_allowed_class(class_name, classes)) { + incomplete_class = 1; + ce = PHP_IC_ENTRY; + break; + } + /* Try to find class directly */ BG(serialize_lock)++; ce = zend_lookup_class(class_name TSRMLS_CC); @@ -761,7 +796,7 @@ yy20: return object_common2(UNSERIALIZE_PASSTHRU, elements); } -#line 765 "ext/standard/var_unserializer.c" +#line 800 "ext/standard/var_unserializer.c" yy25: yych = *++YYCURSOR; if (yych <= ',') { @@ -786,7 +821,7 @@ yy27: yych = *++YYCURSOR; if (yych != '"') goto yy18; ++YYCURSOR; -#line 673 "ext/standard/var_unserializer.re" +#line 701 "ext/standard/var_unserializer.re" { //??? INIT_PZVAL(rval); @@ -794,7 +829,7 @@ yy27: return object_common2(UNSERIALIZE_PASSTHRU, object_common1(UNSERIALIZE_PASSTHRU, ZEND_STANDARD_CLASS_DEF_PTR)); } -#line 798 "ext/standard/var_unserializer.c" +#line 833 "ext/standard/var_unserializer.c" yy32: yych = *++YYCURSOR; if (yych == '+') goto yy33; @@ -815,7 +850,7 @@ yy34: yych = *++YYCURSOR; if (yych != '{') goto yy18; ++YYCURSOR; -#line 652 "ext/standard/var_unserializer.re" +#line 680 "ext/standard/var_unserializer.re" { zend_long elements = parse_iv(start + 2); /* use iv() not uiv() in order to check data range */ @@ -836,7 +871,7 @@ yy34: return finish_nested_data(UNSERIALIZE_PASSTHRU); } -#line 840 "ext/standard/var_unserializer.c" +#line 875 "ext/standard/var_unserializer.c" yy39: yych = *++YYCURSOR; if (yych == '+') goto yy40; @@ -857,7 +892,7 @@ yy41: yych = *++YYCURSOR; if (yych != '"') goto yy18; ++YYCURSOR; -#line 624 "ext/standard/var_unserializer.re" +#line 652 "ext/standard/var_unserializer.re" { size_t len, maxlen; zend_string *str; @@ -885,7 +920,7 @@ yy41: ZVAL_STR(rval, str); return 1; } -#line 889 "ext/standard/var_unserializer.c" +#line 924 "ext/standard/var_unserializer.c" yy46: yych = *++YYCURSOR; if (yych == '+') goto yy47; @@ -906,7 +941,7 @@ yy48: yych = *++YYCURSOR; if (yych != '"') goto yy18; ++YYCURSOR; -#line 597 "ext/standard/var_unserializer.re" +#line 625 "ext/standard/var_unserializer.re" { size_t len, maxlen; char *str; @@ -933,7 +968,7 @@ yy48: ZVAL_STRINGL(rval, str, len); return 1; } -#line 937 "ext/standard/var_unserializer.c" +#line 972 "ext/standard/var_unserializer.c" yy53: yych = *++YYCURSOR; if (yych <= '/') { @@ -1021,7 +1056,7 @@ yy61: } yy63: ++YYCURSOR; -#line 588 "ext/standard/var_unserializer.re" +#line 616 "ext/standard/var_unserializer.re" { #if SIZEOF_ZEND_LONG == 4 use_double: @@ -1030,7 +1065,7 @@ use_double: ZVAL_DOUBLE(rval, zend_strtod((const char *)start + 2, NULL)); return 1; } -#line 1034 "ext/standard/var_unserializer.c" +#line 1069 "ext/standard/var_unserializer.c" yy65: yych = *++YYCURSOR; if (yych <= ',') { @@ -1089,7 +1124,7 @@ yy73: yych = *++YYCURSOR; if (yych != ';') goto yy18; ++YYCURSOR; -#line 572 "ext/standard/var_unserializer.re" +#line 600 "ext/standard/var_unserializer.re" { *p = YYCURSOR; @@ -1105,7 +1140,7 @@ yy73: return 1; } -#line 1109 "ext/standard/var_unserializer.c" +#line 1144 "ext/standard/var_unserializer.c" yy76: yych = *++YYCURSOR; if (yych == 'N') goto yy73; @@ -1132,7 +1167,7 @@ yy79: if (yych <= '9') goto yy79; if (yych != ';') goto yy18; ++YYCURSOR; -#line 546 "ext/standard/var_unserializer.re" +#line 574 "ext/standard/var_unserializer.re" { #if SIZEOF_ZEND_LONG == 4 int digits = YYCURSOR - start - 3; @@ -1158,7 +1193,7 @@ yy79: ZVAL_LONG(rval, parse_iv(start + 2)); return 1; } -#line 1162 "ext/standard/var_unserializer.c" +#line 1197 "ext/standard/var_unserializer.c" yy83: yych = *++YYCURSOR; if (yych <= '/') goto yy18; @@ -1166,22 +1201,22 @@ yy83: yych = *++YYCURSOR; if (yych != ';') goto yy18; ++YYCURSOR; -#line 540 "ext/standard/var_unserializer.re" +#line 568 "ext/standard/var_unserializer.re" { *p = YYCURSOR; ZVAL_BOOL(rval, parse_iv(start + 2)); return 1; } -#line 1176 "ext/standard/var_unserializer.c" +#line 1211 "ext/standard/var_unserializer.c" yy87: ++YYCURSOR; -#line 534 "ext/standard/var_unserializer.re" +#line 562 "ext/standard/var_unserializer.re" { *p = YYCURSOR; ZVAL_NULL(rval); return 1; } -#line 1185 "ext/standard/var_unserializer.c" +#line 1220 "ext/standard/var_unserializer.c" yy89: yych = *++YYCURSOR; if (yych <= ',') { @@ -1204,7 +1239,7 @@ yy91: if (yych <= '9') goto yy91; if (yych != ';') goto yy18; ++YYCURSOR; -#line 511 "ext/standard/var_unserializer.re" +#line 539 "ext/standard/var_unserializer.re" { zend_long id; @@ -1227,7 +1262,7 @@ yy91: return 1; } -#line 1231 "ext/standard/var_unserializer.c" +#line 1266 "ext/standard/var_unserializer.c" yy95: yych = *++YYCURSOR; if (yych <= ',') { @@ -1250,7 +1285,7 @@ yy97: if (yych <= '9') goto yy97; if (yych != ';') goto yy18; ++YYCURSOR; -#line 489 "ext/standard/var_unserializer.re" +#line 517 "ext/standard/var_unserializer.re" { zend_long id; @@ -1272,9 +1307,9 @@ yy97: return 1; } -#line 1276 "ext/standard/var_unserializer.c" +#line 1311 "ext/standard/var_unserializer.c" } -#line 828 "ext/standard/var_unserializer.re" +#line 862 "ext/standard/var_unserializer.re" return 0; diff --git a/ext/standard/var_unserializer.re b/ext/standard/var_unserializer.re index b8c65b7c4bd..7e0dc314d6f 100644 --- a/ext/standard/var_unserializer.re +++ b/ext/standard/var_unserializer.re @@ -224,6 +224,26 @@ static zend_string *unserialize_str(const unsigned char **p, size_t len, size_t return str; } +static inline int unserialize_allowed_class(zend_string *class_name, HashTable *classes) +{ + zend_string *lcname; + int res; + ALLOCA_FLAG(use_heap) + + if(classes == NULL) { + return 1; + } + if(!zend_hash_num_elements(classes)) { + return 0; + } + + STR_ALLOCA_ALLOC(lcname, class_name->len, use_heap); + zend_str_tolower_copy(lcname->val, class_name->val, class_name->len); + res = zend_hash_exists(classes, lcname); + STR_ALLOCA_FREE(lcname, use_heap); + return res; +} + #define YYFILL(n) do { } while (0) #define YYCTYPE unsigned char #define YYCURSOR cursor @@ -297,8 +317,8 @@ static inline size_t parse_uiv(const unsigned char *p) return result; } -#define UNSERIALIZE_PARAMETER zval *rval, const unsigned char **p, const unsigned char *max, php_unserialize_data_t *var_hash TSRMLS_DC -#define UNSERIALIZE_PASSTHRU rval, p, max, var_hash TSRMLS_CC +#define UNSERIALIZE_PARAMETER zval *rval, const unsigned char **p, const unsigned char *max, php_unserialize_data_t *var_hash, HashTable *classes TSRMLS_DC +#define UNSERIALIZE_PASSTHRU rval, p, max, var_hash, classes TSRMLS_CC static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, zend_long elements, int objprops) { @@ -306,7 +326,8 @@ static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, zend zval key, *data, d, *old_data; ZVAL_UNDEF(&key); - if (!php_var_unserialize(&key, p, max, NULL TSRMLS_CC)) { + + if (!php_var_unserialize_ex(&key, p, max, NULL, classes TSRMLS_CC)) { zval_dtor(&key); return 0; } @@ -358,7 +379,7 @@ static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, zend zval_dtor(&key); - if (!php_var_unserialize(data, p, max, var_hash TSRMLS_CC)) { + if (!php_var_unserialize_ex(data, p, max, var_hash, classes TSRMLS_CC)) { return 0; } @@ -466,7 +487,14 @@ static inline int object_common2(UNSERIALIZE_PARAMETER, zend_long elements) # pragma optimize("", on) #endif -PHPAPI int php_var_unserialize(UNSERIALIZE_PARAMETER) +PHPAPI int php_var_unserialize(zval *rval, const unsigned char **p, const unsigned char *max, php_unserialize_data_t *var_hash TSRMLS_DC) +{ + HashTable *classes = NULL; + return php_var_unserialize_ex(UNSERIALIZE_PASSTHRU); +} + + +PHPAPI int php_var_unserialize_ex(UNSERIALIZE_PARAMETER) { const unsigned char *cursor, *limit, *marker, *start; zval *rval_ref; @@ -727,6 +755,12 @@ object ":" uiv ":" ["] { class_name = zend_string_init(str, len, 0); do { + if(!unserialize_allowed_class(class_name, classes)) { + incomplete_class = 1; + ce = PHP_IC_ENTRY; + break; + } + /* Try to find class directly */ BG(serialize_lock)++; ce = zend_lookup_class(class_name TSRMLS_CC); From 77f172725a37c8ddee750bf6970529a1570fbc86 Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Sat, 22 Nov 2014 22:23:55 -0800 Subject: [PATCH 057/102] Add NEWS & UPGRADING --- NEWS | 4 +++- UPGRADING | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index af42147e734..50fe518b9b7 100644 --- a/NEWS +++ b/NEWS @@ -17,7 +17,9 @@ PHP NEWS . Implemented FR #38409 (parse_ini_file() looses the type of booleans). (Tjerk) . Fixed #67959 (Segfault when calling phpversion('spl')). (Florian) . Implemented the RFC `Catchable "Call to a member function bar() on a - non-object"` (Timm) + non-object"`. (Timm) + . Added options parameter for unserialize allowing to specify acceptable + classes (https://wiki.php.net/rfc/secure_unserialize). (Stas) . Fixed bug #68185 ("Inconsistent insteadof definition."- incorrectly triggered). (Julien) - DBA: diff --git a/UPGRADING b/UPGRADING index 61a512505bf..fe282138d10 100644 --- a/UPGRADING +++ b/UPGRADING @@ -76,6 +76,11 @@ PHP X.Y UPGRADE NOTES - parse_ini_file(): - parse_ini_string(): Added scanner mode INI_SCANNER_TYPED to yield typed .ini values. +- unserialize(): + Added second parameter for unserialize function + (RFC: https://wiki.php.net/rfc/secure_unserialize) allowing to specify + acceptable classes: + unserialize($foo, ["allowed_classes" => ["MyClass", "MyClass2"]); ======================================== From 5ef138b0c7c4e9532e205f45c18a72aa1d279c24 Mon Sep 17 00:00:00 2001 From: Bob Weinand Date: Sun, 23 Nov 2014 21:09:31 +0100 Subject: [PATCH 058/102] Fix bug #68446 (bug with constant defaults and type hints) --- Zend/tests/class_constants_002.phpt | 1 - Zend/zend_compile.c | 8 ++--- Zend/zend_execute.c | 18 ++++++++--- Zend/zend_vm_def.h | 50 ++++++++++++++++++----------- Zend/zend_vm_execute.h | 50 ++++++++++++++++++----------- 5 files changed, 80 insertions(+), 47 deletions(-) diff --git a/Zend/tests/class_constants_002.phpt b/Zend/tests/class_constants_002.phpt index 9aad8088da8..75d1032e545 100644 --- a/Zend/tests/class_constants_002.phpt +++ b/Zend/tests/class_constants_002.phpt @@ -26,6 +26,5 @@ echo "Done\n"; --EXPECTF-- int(1) int(5) -int(10) Fatal error: Class 'NoSuchClass' not found in %s on line %d diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 8e416ea0a59..e023b24a8eb 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -1931,8 +1931,8 @@ void zend_do_receive_param(zend_uchar op, znode *varname, const znode *initializ if (class_type->u.constant.type == IS_ARRAY) { cur_arg_info->type_hint = IS_ARRAY; if (op == ZEND_RECV_INIT) { - if (Z_TYPE(initialization->u.constant) == IS_NULL || (Z_TYPE(initialization->u.constant) == IS_CONSTANT && !strcasecmp(Z_STRVAL(initialization->u.constant), "NULL")) || Z_TYPE(initialization->u.constant) == IS_CONSTANT_AST) { - cur_arg_info->allow_null = 1; + if (Z_TYPE(initialization->u.constant) == IS_NULL || (Z_TYPE(initialization->u.constant) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT || (Z_TYPE(initialization->u.constant) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT_AST) { + cur_arg_info->allow_null = (Z_TYPE(initialization->u.constant) != IS_NULL) + 1; } else if (Z_TYPE(initialization->u.constant) != IS_ARRAY) { zend_error_noreturn(E_COMPILE_ERROR, "Default value for parameters with array type hint can only be an array or NULL"); } @@ -1940,8 +1940,8 @@ void zend_do_receive_param(zend_uchar op, znode *varname, const znode *initializ } else if (class_type->u.constant.type == IS_CALLABLE) { cur_arg_info->type_hint = IS_CALLABLE; if (op == ZEND_RECV_INIT) { - if (Z_TYPE(initialization->u.constant) == IS_NULL || (Z_TYPE(initialization->u.constant) == IS_CONSTANT && !strcasecmp(Z_STRVAL(initialization->u.constant), "NULL")) || Z_TYPE(initialization->u.constant) == IS_CONSTANT_AST) { - cur_arg_info->allow_null = 1; + if (Z_TYPE(initialization->u.constant) == IS_NULL || (Z_TYPE(initialization->u.constant) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT || (Z_TYPE(initialization->u.constant) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT_AST) { + cur_arg_info->allow_null = (Z_TYPE(initialization->u.constant) != IS_NULL) + 1; } else { zend_error_noreturn(E_COMPILE_ERROR, "Default value for parameters with callable type hint can only be NULL"); } diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 6ada04e1cb5..081af81d507 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -608,7 +608,17 @@ ZEND_API int zend_verify_arg_error(int error_type, const zend_function *zf, zend return 0; } -static inline int zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zval *arg, ulong fetch_type TSRMLS_DC) +static inline int zend_arg_allows_null(zend_bool allow_null, zval *default_value TSRMLS_DC) +{ + if (allow_null < 2 || !default_value) { + return allow_null; + } + + /* assuming update_constant_ex done before */ + return Z_TYPE_P(default_value) == IS_NULL; +} + +static inline int zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zval *arg, zval *defaultval, ulong fetch_type TSRMLS_DC) { zend_arg_info *cur_arg_info; char *need_msg; @@ -638,7 +648,7 @@ static inline int zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zva if (!ce || !instanceof_function(Z_OBJCE_P(arg), ce TSRMLS_CC)) { return zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, need_msg, class_name, "instance of ", Z_OBJCE_P(arg)->name TSRMLS_CC); } - } else if (Z_TYPE_P(arg) != IS_NULL || !cur_arg_info->allow_null) { + } else if (Z_TYPE_P(arg) != IS_NULL || !zend_arg_allows_null(cur_arg_info->allow_null, defaultval TSRMLS_CC)) { need_msg = zend_verify_arg_class_kind(cur_arg_info, fetch_type, &class_name, &ce TSRMLS_CC); return zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, need_msg, class_name, zend_zval_type_name(arg), "" TSRMLS_CC); } @@ -649,7 +659,7 @@ static inline int zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zva return zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be of the type array", "", "none", "" TSRMLS_CC); } - if (Z_TYPE_P(arg) != IS_ARRAY && (Z_TYPE_P(arg) != IS_NULL || !cur_arg_info->allow_null)) { + if (Z_TYPE_P(arg) != IS_ARRAY && (Z_TYPE_P(arg) != IS_NULL || !zend_arg_allows_null(cur_arg_info->allow_null, defaultval TSRMLS_CC))) { return zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be of the type array", "", zend_zval_type_name(arg), "" TSRMLS_CC); } break; @@ -658,7 +668,7 @@ static inline int zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zva if (!arg) { return zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be callable", "", "none", "" TSRMLS_CC); } - if (!zend_is_callable(arg, IS_CALLABLE_CHECK_SILENT, NULL TSRMLS_CC) && (Z_TYPE_P(arg) != IS_NULL || !cur_arg_info->allow_null)) { + if (!zend_is_callable(arg, IS_CALLABLE_CHECK_SILENT, NULL TSRMLS_CC) && (Z_TYPE_P(arg) != IS_NULL || !zend_arg_allows_null(cur_arg_info->allow_null, defaultval TSRMLS_CC))) { return zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be callable", "", zend_zval_type_name(arg), "" TSRMLS_CC); } break; diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 705e46e7d33..65981f6f6f2 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -1961,7 +1961,7 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY) void **p = EX(function_state).arguments - num_args; for (i = 0; i < num_args; ++i, ++p) { - zend_verify_arg_type(fbc, i + 1, (zval *) *p, 0 TSRMLS_CC); + zend_verify_arg_type(fbc, i + 1, (zval *) *p, NULL, 0 TSRMLS_CC); } } @@ -3374,7 +3374,7 @@ ZEND_VM_HANDLER(63, ZEND_RECV, ANY, ANY) SAVE_OPLINE(); if (UNEXPECTED(param == NULL)) { - if (zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, NULL, opline->extended_value TSRMLS_CC)) { + if (zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, NULL, NULL, opline->extended_value TSRMLS_CC)) { const char *space; const char *class_name; zend_execute_data *ptr; @@ -3396,7 +3396,7 @@ ZEND_VM_HANDLER(63, ZEND_RECV, ANY, ANY) } else { zval **var_ptr; - zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, *param, opline->extended_value TSRMLS_CC); + zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, *param, NULL, opline->extended_value TSRMLS_CC); var_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->result.var TSRMLS_CC); Z_DELREF_PP(var_ptr); *var_ptr = *param; @@ -3410,27 +3410,34 @@ ZEND_VM_HANDLER(63, ZEND_RECV, ANY, ANY) ZEND_VM_HANDLER(64, ZEND_RECV_INIT, ANY, CONST) { USE_OPLINE - zval *assignment_value; + zval *assignment_value, *default_val = NULL; zend_uint arg_num = opline->op1.num; zval **param = zend_vm_stack_get_arg(arg_num TSRMLS_CC); zval **var_ptr; SAVE_OPLINE(); + if (IS_CONSTANT_TYPE(Z_TYPE_P(opline->op2.zv))) { + ALLOC_ZVAL(default_val); + *default_val = *opline->op2.zv; + Z_SET_REFCOUNT_P(default_val, 1); + zval_update_constant(&default_val, 0 TSRMLS_CC); + } if (param == NULL) { - ALLOC_ZVAL(assignment_value); - *assignment_value = *opline->op2.zv; - if (IS_CONSTANT_TYPE(Z_TYPE_P(assignment_value))) { - Z_SET_REFCOUNT_P(assignment_value, 1); - zval_update_constant(&assignment_value, 0 TSRMLS_CC); - } else if (Z_TYPE_P(assignment_value) == IS_ARRAY) { - HashTable *ht; - - ALLOC_HASHTABLE(ht); - zend_hash_init(ht, zend_hash_num_elements(Z_ARRVAL_P(assignment_value)), NULL, ZVAL_PTR_DTOR, 0); - zend_hash_copy(ht, Z_ARRVAL_P(assignment_value), (copy_ctor_func_t) zval_deep_copy, NULL, sizeof(zval *)); - Z_ARRVAL_P(assignment_value) = ht; + if (default_val) { + assignment_value = default_val; } else { - zval_copy_ctor(assignment_value); + ALLOC_ZVAL(assignment_value); + *assignment_value = *opline->op2.zv; + if (Z_TYPE_P(assignment_value) == IS_ARRAY) { + HashTable *ht; + + ALLOC_HASHTABLE(ht); + zend_hash_init(ht, zend_hash_num_elements(Z_ARRVAL_P(assignment_value)), NULL, ZVAL_PTR_DTOR, 0); + zend_hash_copy(ht, Z_ARRVAL_P(assignment_value), (copy_ctor_func_t) zval_deep_copy, NULL, sizeof(zval *)); + Z_ARRVAL_P(assignment_value) = ht; + } else { + zval_copy_ctor(assignment_value); + } } INIT_PZVAL(assignment_value); } else { @@ -3438,11 +3445,16 @@ ZEND_VM_HANDLER(64, ZEND_RECV_INIT, ANY, CONST) Z_ADDREF_P(assignment_value); } - zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, assignment_value, opline->extended_value TSRMLS_CC); + zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, assignment_value, default_val, opline->extended_value TSRMLS_CC); var_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->result.var TSRMLS_CC); zval_ptr_dtor(var_ptr); *var_ptr = assignment_value; + if (default_val && assignment_value != default_val) { + zval_dtor(default_val); + efree(default_val); + } + CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -3469,7 +3481,7 @@ ZEND_VM_HANDLER(164, ZEND_RECV_VARIADIC, ANY, ANY) for (; arg_num <= arg_count; ++arg_num) { zval **param = zend_vm_stack_get_arg(arg_num TSRMLS_CC); - zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, *param, opline->extended_value TSRMLS_CC); + zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, *param, NULL, opline->extended_value TSRMLS_CC); zend_hash_next_index_insert(Z_ARRVAL_P(params), param, sizeof(zval *), NULL); Z_ADDREF_PP(param); } diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 993aaee7474..318f903f776 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -541,7 +541,7 @@ static int ZEND_FASTCALL zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_AR void **p = EX(function_state).arguments - num_args; for (i = 0; i < num_args; ++i, ++p) { - zend_verify_arg_type(fbc, i + 1, (zval *) *p, 0 TSRMLS_CC); + zend_verify_arg_type(fbc, i + 1, (zval *) *p, NULL, 0 TSRMLS_CC); } } @@ -861,7 +861,7 @@ static int ZEND_FASTCALL ZEND_RECV_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) SAVE_OPLINE(); if (UNEXPECTED(param == NULL)) { - if (zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, NULL, opline->extended_value TSRMLS_CC)) { + if (zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, NULL, NULL, opline->extended_value TSRMLS_CC)) { const char *space; const char *class_name; zend_execute_data *ptr; @@ -883,7 +883,7 @@ static int ZEND_FASTCALL ZEND_RECV_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } else { zval **var_ptr; - zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, *param, opline->extended_value TSRMLS_CC); + zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, *param, NULL, opline->extended_value TSRMLS_CC); var_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->result.var TSRMLS_CC); Z_DELREF_PP(var_ptr); *var_ptr = *param; @@ -916,7 +916,7 @@ static int ZEND_FASTCALL ZEND_RECV_VARIADIC_SPEC_HANDLER(ZEND_OPCODE_HANDLER_AR for (; arg_num <= arg_count; ++arg_num) { zval **param = zend_vm_stack_get_arg(arg_num TSRMLS_CC); - zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, *param, opline->extended_value TSRMLS_CC); + zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, *param, NULL, opline->extended_value TSRMLS_CC); zend_hash_next_index_insert(Z_ARRVAL_P(params), param, sizeof(zval *), NULL); Z_ADDREF_PP(param); } @@ -1615,27 +1615,34 @@ static int ZEND_FASTCALL ZEND_INIT_NS_FCALL_BY_NAME_SPEC_CONST_HANDLER(ZEND_OPC static int ZEND_FASTCALL ZEND_RECV_INIT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE - zval *assignment_value; + zval *assignment_value, *default_val = NULL; zend_uint arg_num = opline->op1.num; zval **param = zend_vm_stack_get_arg(arg_num TSRMLS_CC); zval **var_ptr; SAVE_OPLINE(); + if (IS_CONSTANT_TYPE(Z_TYPE_P(opline->op2.zv))) { + ALLOC_ZVAL(default_val); + *default_val = *opline->op2.zv; + Z_SET_REFCOUNT_P(default_val, 1); + zval_update_constant(&default_val, 0 TSRMLS_CC); + } if (param == NULL) { - ALLOC_ZVAL(assignment_value); - *assignment_value = *opline->op2.zv; - if (IS_CONSTANT_TYPE(Z_TYPE_P(assignment_value))) { - Z_SET_REFCOUNT_P(assignment_value, 1); - zval_update_constant(&assignment_value, 0 TSRMLS_CC); - } else if (Z_TYPE_P(assignment_value) == IS_ARRAY) { - HashTable *ht; - - ALLOC_HASHTABLE(ht); - zend_hash_init(ht, zend_hash_num_elements(Z_ARRVAL_P(assignment_value)), NULL, ZVAL_PTR_DTOR, 0); - zend_hash_copy(ht, Z_ARRVAL_P(assignment_value), (copy_ctor_func_t) zval_deep_copy, NULL, sizeof(zval *)); - Z_ARRVAL_P(assignment_value) = ht; + if (default_val) { + assignment_value = default_val; } else { - zval_copy_ctor(assignment_value); + ALLOC_ZVAL(assignment_value); + *assignment_value = *opline->op2.zv; + if (Z_TYPE_P(assignment_value) == IS_ARRAY) { + HashTable *ht; + + ALLOC_HASHTABLE(ht); + zend_hash_init(ht, zend_hash_num_elements(Z_ARRVAL_P(assignment_value)), NULL, ZVAL_PTR_DTOR, 0); + zend_hash_copy(ht, Z_ARRVAL_P(assignment_value), (copy_ctor_func_t) zval_deep_copy, NULL, sizeof(zval *)); + Z_ARRVAL_P(assignment_value) = ht; + } else { + zval_copy_ctor(assignment_value); + } } INIT_PZVAL(assignment_value); } else { @@ -1643,11 +1650,16 @@ static int ZEND_FASTCALL ZEND_RECV_INIT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ Z_ADDREF_P(assignment_value); } - zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, assignment_value, opline->extended_value TSRMLS_CC); + zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, assignment_value, default_val, opline->extended_value TSRMLS_CC); var_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->result.var TSRMLS_CC); zval_ptr_dtor(var_ptr); *var_ptr = assignment_value; + if (default_val && assignment_value != default_val) { + zval_dtor(default_val); + efree(default_val); + } + CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } From 4dc994571d2def413a83a607885f3e809b60019d Mon Sep 17 00:00:00 2001 From: Veres Lajos Date: Thu, 20 Nov 2014 20:00:07 +0000 Subject: [PATCH 059/102] typo fixes - https://github.com/vlajos/misspell_fixer Conflicts: ext/ftp/ftp.h ext/pcre/pcrelib/pcre_printint.c ext/pcre/pcrelib/sljit/sljitLir.c ext/pcre/pcrelib/sljit/sljitLir.h ext/pcre/pcrelib/sljit/sljitNativeARM_32.c ext/pcre/pcrelib/sljit/sljitNativeTILEGX_64.c ext/pgsql/pgsql.c ext/phar/func_interceptors.c ext/soap/soap.c ext/standard/image.c --- INSTALL | 2 +- README.TESTING2 | 6 +- ext/calendar/julian.c | 2 +- ext/calendar/tests/unixtojd.phpt | 4 +- ext/date/lib/parse_tz.c | 6 +- ext/date/tests/002.phpt | 2 +- ext/date/tests/bug13142.phpt | 2 +- ext/date/tests/bug26317.phpt | 2 +- ext/date/tests/bug26320.phpt | 2 +- ext/fileinfo/fileinfo.php | 2 +- ext/fileinfo/libmagic/patchlevel.h | 2 +- ext/fileinfo/tests/magic | 14 +- ext/ftp/ftp.h | 4 +- ext/gd/libgd/gd.h | 2 +- ext/gd/libgd/gd_arc_f_buggy.c | 2 +- ext/gd/libgd/gdft.c | 2 +- ext/gd/libgd/webpimg.c | 4 +- ext/gd/libgd/webpimg.h | 2 +- ext/interbase/tests/005.phpt | 2 +- ext/libxml/libxml.c | 2 +- ext/mbstring/README_PHP3-i18n-ja | 4 +- ext/mbstring/libmbfl/filters/unicode_prop.h | 2 +- ext/mbstring/libmbfl/mbfl/mbfl_consts.h | 2 +- .../tests/mb_strtolower_variation3.phpt | 2 +- .../tests/mb_strtoupper_variation3.phpt | 2 +- ext/mcrypt/tests/mcrypt_ecb_3des_decrypt.phpt | 2 +- ext/mcrypt/tests/mcrypt_ecb_3des_encrypt.phpt | 2 +- ext/mcrypt/tests/mcrypt_encrypt_3des_cbc.phpt | 4 +- ext/mcrypt/tests/mcrypt_encrypt_3des_ecb.phpt | 2 +- .../tests/mcrypt_rijndael128_128BitKey.phpt | 2 +- ext/mysqli/tests/mysqli_ps_select_union.phpt | 4 +- .../tests/mysqli_result_references.phpt | 8 +- .../mysqli_result_references_mysqlnd.phpt | 4 +- ...stmt_bind_param_check_param_no_change.phpt | 4 +- ext/pcntl/README | 2 +- ext/pcre/pcrelib/ChangeLog | 4 +- ext/pcre/pcrelib/HACKING | 2 +- ext/pcre/pcrelib/README | 2 +- ext/pcre/pcrelib/doc/pcre.txt | 2 +- ext/pcre/pcrelib/pcre_exec.c | 2 +- ext/pcre/pcrelib/pcre_study.c | 2 +- ext/pcre/pcrelib/pcredemo.c | 4 +- ext/pdo/pdo_dbh.c | 2 +- ext/pdo/pdo_stmt.c | 2 +- ext/pdo/tests/bug_39656.phpt | 2 +- ext/pdo_mysql/tests/pdo_mysql_stmt_blobs.phpt | 4 +- ext/pgsql/README | 2 +- ext/pgsql/pgsql.c | 6 +- ext/phar/func_interceptors.c | 2 +- ext/shmop/README | 2 +- ext/snmp/snmp.c | 8 +- ext/soap/TODO.old | 2 +- ext/soap/interop/client_round2_interop.php | 18 +-- ext/soap/package.xml | 2 +- ext/soap/php_sdl.h | 2 +- ext/soap/soap.c | 2 +- ext/soap/tests/bugs/bug27742.wsdl | 4 +- ext/soap/tests/bugs/bug50698_2.phpt | 2 +- ext/spl/internal/recursivecachingiterator.inc | 2 +- ext/spl/spl.php | 2 +- ...FixedArray_fromarray_param_multiarray.phpt | 2 +- ext/spl/tests/bug53071.phpt | 2 +- ext/sqlite3/libsqlite/sqlite3.c | 126 +++++++++--------- ext/standard/dir.c | 2 +- ext/standard/html_tables/ents_html401.txt | 2 +- ext/standard/image.c | 4 +- ext/standard/scanf.h | 2 +- .../tests/strings/sprintf_variation34.phpt | 4 +- .../strings/sprintf_variation40_64bit.phpt | 4 +- ext/xmlrpc/libxmlrpc/xml_to_soap.c | 2 +- ext/zip/php_zip.c | 2 +- ext/zlib/zlib_filter.c | 2 +- ext/zlib/zlib_win32_howto.txt | 2 +- sapi/cgi/cgi_main.c | 2 +- sapi/cli/php_http_parser.c | 2 +- sapi/fpm/fpm/fpm_env.c | 2 +- sapi/litespeed/lsapilib.c | 2 +- sapi/nsapi/nsapi-readme.txt | 2 +- sapi/phpdbg/phpdbg.c | 2 +- sapi/phpdbg/xml.md | 6 +- sapi/thttpd/thttpd_patch | 2 +- server-tests.php | 2 +- 82 files changed, 187 insertions(+), 187 deletions(-) diff --git a/INSTALL b/INSTALL index 141e4f8312f..3c0d8dbf2a0 100644 --- a/INSTALL +++ b/INSTALL @@ -155,7 +155,7 @@ Table of Contents a list of all available options along with short explanations running ./configure --help. Our manual documents the different options separately. You will find the core options in the appendix, while the - different extension specific options are descibed on the reference + different extension specific options are described on the reference pages. When PHP is configured, you are ready to build the module and/or diff --git a/README.TESTING2 b/README.TESTING2 index 3c4f1beb29e..34f7e833279 100644 --- a/README.TESTING2 +++ b/README.TESTING2 @@ -8,7 +8,7 @@ the original run-tests.php script. server-tests is *not* used by 'make test'. server-tests was developed to provide support for testing PHP under it's primary environment, HTTP, and can run the PHP tests under any of the SAPI modules that are direct executables, -or are accessable via HTTP. +or are accessible via HTTP. [New features] ---------------- @@ -95,7 +95,7 @@ include: $filename full native path to file, will become PATH_TRANSLATED $filepath =dirname($filename) $scriptname this is what will become SCRIPT_NAME unless you override it - $docroot the equivelant of DOCUMENT_ROOT under Apache + $docroot the equivalent of DOCUMENT_ROOT under Apache $cwd the directory that the test is being initiated from $this->conf all server-tests configuration vars $this->env all environment variables that will get passed to the test @@ -105,7 +105,7 @@ include: This section is also eval'd, and is similar in nature to --ENV--. However, this section is used to build the url used in an HTTP request. Valid values to set in this section would include: - SCRIPT_NAME The inital part of the request url + SCRIPT_NAME The initial part of the request url PATH_INFO The pathinfo part of a request url FRAGMENT The fragment section of a url (after #) QUERY_STRING The query part of a url (after ?) diff --git a/ext/calendar/julian.c b/ext/calendar/julian.c index 17e7bcb5974..cbaebc0573f 100644 --- a/ext/calendar/julian.c +++ b/ext/calendar/julian.c @@ -47,7 +47,7 @@ * * CALENDAR OVERVIEW * - * Julias Ceasar created the calendar in 46 B.C. as a modified form of + * Julius Caesar created the calendar in 46 B.C. as a modified form of * the old Roman republican calendar which was based on lunar cycles. * The new Julian calendar set fixed lengths for the months, abandoning * the lunar cycle. It also specified that there would be exactly 12 diff --git a/ext/calendar/tests/unixtojd.phpt b/ext/calendar/tests/unixtojd.phpt index 4eeb1ca93e3..6183cae9eef 100644 --- a/ext/calendar/tests/unixtojd.phpt +++ b/ext/calendar/tests/unixtojd.phpt @@ -21,10 +21,10 @@ putenv('TZ=UTC'); // -uses --INI-- section with date.timezone=UTC // -uses putenv('TZ=UTC') // date.timezone=UTC -// -if ommitted from easter_date.phpt, outputs DATE_TZ_ERRMSG warning +// -if omitted from easter_date.phpt, outputs DATE_TZ_ERRMSG warning // -easter_date() calls mktime() and localtime() // -whereas unixtojd(1000000000) calls localtime(1000000000) -// -if ommitted from unixtojd.phpt, does NOT output DATE_TZ_ERRMSG +// -if omitted from unixtojd.phpt, does NOT output DATE_TZ_ERRMSG // // unixtojd() calls php_localtime_r() which for Pacific timezone systems, returns a time -8 hours // -this incorrect localtime is passed to the julian date conversion (GregorianToSDN) function which works (probably correctly) diff --git a/ext/date/lib/parse_tz.c b/ext/date/lib/parse_tz.c index 5d2aec9c93e..5e6250b8b88 100644 --- a/ext/date/lib/parse_tz.c +++ b/ext/date/lib/parse_tz.c @@ -336,7 +336,7 @@ static ttinfo* fetch_timezone_offset(timelib_tzinfo *tz, timelib_sll ts, timelib { uint32_t i; - /* If there is no transistion time, we pick the first one, if that doesn't + /* If there is no transition time, we pick the first one, if that doesn't * exist we return NULL */ if (!tz->timecnt || !tz->trans) { *transition_time = 0; @@ -346,8 +346,8 @@ static ttinfo* fetch_timezone_offset(timelib_tzinfo *tz, timelib_sll ts, timelib return NULL; } - /* If the TS is lower than the first transistion time, then we scan over - * all the transistion times to find the first non-DST one, or the first + /* If the TS is lower than the first transition time, then we scan over + * all the transition times to find the first non-DST one, or the first * one in case there are only DST entries. Not sure which smartass came up * with this idea in the first though :) */ if (ts < tz->trans[0]) { diff --git a/ext/date/tests/002.phpt b/ext/date/tests/002.phpt index 92d0d5f105c..adbea5e2316 100644 --- a/ext/date/tests/002.phpt +++ b/ext/date/tests/002.phpt @@ -3,7 +3,7 @@ strtotime() function --SKIPIF-- --FILE-- diff --git a/ext/date/tests/bug13142.phpt b/ext/date/tests/bug13142.phpt index 5254142baac..5849a94427a 100644 --- a/ext/date/tests/bug13142.phpt +++ b/ext/date/tests/bug13142.phpt @@ -8,7 +8,7 @@ if (defined('PHP_WINDOWS_VERSION_MAJOR')) { die("skip. set TZ env is not supported at runtime."); } if (!@putenv("TZ=US/Eastern") || getenv("TZ") != 'US/Eastern') { - die("skip unable to change TZ enviroment variable\n"); + die("skip unable to change TZ environment variable\n"); } ?> --FILE-- diff --git a/ext/date/tests/bug26317.phpt b/ext/date/tests/bug26317.phpt index 5b79bec525c..27d6ff12500 100644 --- a/ext/date/tests/bug26317.phpt +++ b/ext/date/tests/bug26317.phpt @@ -4,7 +4,7 @@ Bug #26317 (military timezone offset signedness) date.timezone=GMT0 --SKIPIF-- if (!@putenv("TZ=GMT0") || getenv("TZ") != 'GMT0') { - die("skip unable to change TZ enviroment variable\n"); + die("skip unable to change TZ environment variable\n"); } --FILE-- 7 string x version %.2s # We skip the path here, because it is often long (so file will # truncate it) and mostly redundant. -# The inverted index functionality was added some time betwen +# The inverted index functionality was added some time between # versions 11 and 15, so look for -q if version is above 14: >7 string >14 >>10 search/100 \ -q\ with inverted index @@ -3972,7 +3972,7 @@ # .cwk 0 string \002\000\210\003\102\117\102\117\000\001\206 Claris works document # .plt -0 string \020\341\000\000\010\010 Claris Works pallete files .plt +0 string \020\341\000\000\010\010 Claris Works palette files .plt # .msp a dictionary file I am not sure about this I have only one .msp file 0 string \002\271\262\000\040\002\000\164 Claris works dictionary @@ -4443,9 +4443,9 @@ >6 byte&0x04 =0x8 \b, [4-Scr] #------------------------------------------------------------------------------ -# gameboy: file(1) magic for the Nintendo (Color) Gameboy raw ROM format +# game boy: file(1) magic for the Nintendo (Color) Game Boy raw ROM format # -0x104 belong 0xCEED6666 Gameboy ROM: +0x104 belong 0xCEED6666 Game Boy ROM: >0x134 string >\0 "%.16s" >0x146 byte 0x03 \b,[SGB] >0x147 byte 0x00 \b, [ROM ONLY] @@ -4605,8 +4605,8 @@ 0 string \x01ZZZZZ\x01 3DO "Opera" file system # From Gurkan Sengun , www.linuks.mine.nu -0 string GBS Nintendo Gameboy Music/Audio Data -12 string GameBoy\ Music\ Module Nintendo Gameboy Music Module +0 string GBS Nintendo Game Boy Music/Audio Data +12 string GameBoy\ Music\ Module Nintendo Game Boy Music Module # Playstations Patch Files from: From: Thomas Klausner 0 string PPF30 Playstation Patch File version 3.0 @@ -15279,7 +15279,7 @@ # $File: oasis,v 1.1 2011/03/15 02:09:38 christos Exp $ # OASIS # Summary: OASIS stream file -# Long descripton: Open Artwork System Interchange Standard +# Long description: Open Artwork System Interchange Standard # File extension: .oas # Full name: Ben Cowley (bcowley@broadcom.com) # Philip Dixon (pdixon@broadcom.com) diff --git a/ext/ftp/ftp.h b/ext/ftp/ftp.h index 2759ce2af5f..acf3917bde3 100644 --- a/ext/ftp/ftp.h +++ b/ext/ftp/ftp.h @@ -69,8 +69,8 @@ typedef struct ftpbuf ftptype_t type; /* current transfer type */ int pasv; /* 0=off; 1=pasv; 2=ready */ php_sockaddr_storage pasvaddr; /* passive mode address */ - long timeout_sec; /* User configureable timeout (seconds) */ - int autoseek; /* User configureable autoseek flag */ + long timeout_sec; /* User configurable timeout (seconds) */ + int autoseek; /* User configurable autoseek flag */ int nb; /* "nonblocking" transfer in progress */ databuf_t *data; /* Data connection for "nonblocking" transfers */ diff --git a/ext/gd/libgd/gd.h b/ext/gd/libgd/gd.h index b61d972e80d..0ace31ba034 100644 --- a/ext/gd/libgd/gd.h +++ b/ext/gd/libgd/gd.h @@ -782,7 +782,7 @@ int gdImageBrightness(gdImagePtr src, int brightness); /* Set the contrast level for the image */ int gdImageContrast(gdImagePtr src, double contrast); -/* Simply adds or substracts respectively red, green or blue to a pixel */ +/* Simply adds or subtracts respectively red, green or blue to a pixel */ int gdImageColor(gdImagePtr src, const int red, const int green, const int blue, const int alpha); /* Image convolution by a 3x3 custom matrix */ diff --git a/ext/gd/libgd/gd_arc_f_buggy.c b/ext/gd/libgd/gd_arc_f_buggy.c index c26e42171a7..ffab5512306 100644 --- a/ext/gd/libgd/gd_arc_f_buggy.c +++ b/ext/gd/libgd/gd_arc_f_buggy.c @@ -1,6 +1,6 @@ /* This is potentially great stuff, but fails against the test program at the end. This would probably be much more - efficent than the implementation currently in gd.c if the + efficient than the implementation currently in gd.c if the errors in the output were corrected. TBB */ #if 0 diff --git a/ext/gd/libgd/gdft.c b/ext/gd/libgd/gdft.c index 3d7b46c417a..ba905dc0a86 100644 --- a/ext/gd/libgd/gdft.c +++ b/ext/gd/libgd/gdft.c @@ -464,7 +464,7 @@ static void *fontFetch (char **error, void *key) return NULL; } - /* FIXME - This mapping stuff is imcomplete - where is the spec? */ + /* FIXME - This mapping stuff is incomplete - where is the spec? */ /* EAM - It's worse than that. It's pointless to match character encodings here. * As currently written, the stored a->face->charmap only matches one of * the actual charmaps and we cannot know at this stage if it is the right diff --git a/ext/gd/libgd/webpimg.c b/ext/gd/libgd/webpimg.c index 01bef93c48c..95a8081e058 100644 --- a/ext/gd/libgd/webpimg.c +++ b/ext/gd/libgd/webpimg.c @@ -169,7 +169,7 @@ static inline uint32 get_le32(const uint8* const data) { * Y2/U2/V2: The Y/U/V data of the second image * * Returns the PSNR (http://en.wikipedia.org/wiki/Peak_signal-to-noise_ratio) - * value computed bewteen the two images + * value computed between the two images */ double GetPSNRYuv(const uint8* Y1, const uint8* U1, @@ -210,7 +210,7 @@ double GetPSNRYuv(const uint8* Y1, * imgdata: data buffer containing webp image * imgdata_size: size of the imgdata buffer * - * Returns the PSNR value computed bewteen the two images + * Returns the PSNR value computed between the two images */ double WebPGetPSNR(const uint8* Y1, const uint8* U1, diff --git a/ext/gd/libgd/webpimg.h b/ext/gd/libgd/webpimg.h index db23de5bb24..bc0f9722bd2 100644 --- a/ext/gd/libgd/webpimg.h +++ b/ext/gd/libgd/webpimg.h @@ -57,7 +57,7 @@ typedef enum WebPResultType { * 3. p_Y/p_U/p_V : pointer to the Y/U/V data buffer (this routine will * allocate memory for the buffer, fill the buffer with * appropriate data and transfer owner ship of the buffer - * to caller. Caller is reponsible for freeing the memory). + * to caller. Caller is responsible for freeing the memory). * Note that the memory for Y, U, V buffers is alloacted * in one chunk, hence one should call free(*p_Y) only. * Do not try to free the U and V buffers. diff --git a/ext/interbase/tests/005.phpt b/ext/interbase/tests/005.phpt index c5167c132e4..08b8e53ef30 100644 --- a/ext/interbase/tests/005.phpt +++ b/ext/interbase/tests/005.phpt @@ -63,7 +63,7 @@ simple default transaction test without ibase_trans() /* default transaction on default link First open transaction on link will be default. -$tr_def_l1 may be ommited. All queryes without link and trans +$tr_def_l1 may be omitted. All queryes without link and trans parameters run in this context */ diff --git a/ext/libxml/libxml.c b/ext/libxml/libxml.c index 3114b251999..3c9f21edb51 100644 --- a/ext/libxml/libxml.c +++ b/ext/libxml/libxml.c @@ -1138,7 +1138,7 @@ int php_libxml_register_export(zend_class_entry *ce, php_libxml_export_node expo { php_libxml_func_handler export_hnd; - /* Initialize in case this module hasnt been loaded yet */ + /* Initialize in case this module hasn't been loaded yet */ php_libxml_initialize(); export_hnd.export_func = export_function; diff --git a/ext/mbstring/README_PHP3-i18n-ja b/ext/mbstring/README_PHP3-i18n-ja index 869fe3e4958..eabe9e90f25 100644 --- a/ext/mbstring/README_PHP3-i18n-ja +++ b/ext/mbstring/README_PHP3-i18n-ja @@ -371,7 +371,7 @@ o i18n.internal_encoding - internal encoding encodings, following conditions have to be satisfied in order to use them: - per byte encoding - - single byte charactor in range of 00h-7fh which is compatible + - single byte character in range of 00h-7fh which is compatible with ASCII - multibyte without 00h-7fh In case of Japanese, EUC-JP and UTF-8 are the only encoding that @@ -408,7 +408,7 @@ o i18n.script_encoding - script encoding entering the script parser. Be aware that auto detection may fail under some conditions. - For best auto detection, add multibyte charactor at beginning of + For best auto detection, add multibyte character at beginning of script. diff --git a/ext/mbstring/libmbfl/filters/unicode_prop.h b/ext/mbstring/libmbfl/filters/unicode_prop.h index d21ec61dfb1..4feb5756e35 100644 --- a/ext/mbstring/libmbfl/filters/unicode_prop.h +++ b/ext/mbstring/libmbfl/filters/unicode_prop.h @@ -22,7 +22,7 @@ * */ -/* charactor property table */ +/* character property table */ #define MBFL_CHP_CTL 0x01 #define MBFL_CHP_DIGIT 0x02 #define MBFL_CHP_UALPHA 0x04 diff --git a/ext/mbstring/libmbfl/mbfl/mbfl_consts.h b/ext/mbstring/libmbfl/mbfl/mbfl_consts.h index 6a630c8fcd8..b11119a80bc 100644 --- a/ext/mbstring/libmbfl/mbfl/mbfl_consts.h +++ b/ext/mbstring/libmbfl/mbfl/mbfl_consts.h @@ -45,7 +45,7 @@ #define MBFL_ENCTYPE_ENC_STRM 0x00002000 #define MBFL_ENCTYPE_GL_UNSAFE 0x00004000 -/* wchar plane, special charactor */ +/* wchar plane, special character */ #define MBFL_WCSPLANE_MASK 0xffff #define MBFL_WCSPLANE_UCS2MAX 0x00010000 #define MBFL_WCSPLANE_UTF32MAX 0x00110000 diff --git a/ext/mbstring/tests/mb_strtolower_variation3.phpt b/ext/mbstring/tests/mb_strtolower_variation3.phpt index 08b3467853e..99256e1ec48 100644 --- a/ext/mbstring/tests/mb_strtolower_variation3.phpt +++ b/ext/mbstring/tests/mb_strtolower_variation3.phpt @@ -14,7 +14,7 @@ function_exists('mb_strtolower') or die("skip mb_strtolower() is not available i /* * Pass a Japanese string and a mixed Japanese and ASCII string to mb_strtolower - * to check correct conversion is occuring (Japanese characters should not be converted). + * to check correct conversion is occurring (Japanese characters should not be converted). */ echo "*** Testing mb_strtolower() : usage variations ***\n"; diff --git a/ext/mbstring/tests/mb_strtoupper_variation3.phpt b/ext/mbstring/tests/mb_strtoupper_variation3.phpt index a4bf3b128fd..f0cb0fa47c8 100644 --- a/ext/mbstring/tests/mb_strtoupper_variation3.phpt +++ b/ext/mbstring/tests/mb_strtoupper_variation3.phpt @@ -14,7 +14,7 @@ function_exists('mb_strtoupper') or die("skip mb_strtoupper() is not available i /* * Pass a Japanese string and a mixed Japanese and ASCII string to mb_strtolower - * to check correct conversion is occuring (Japanese characters should not be converted). + * to check correct conversion is occurring (Japanese characters should not be converted). */ echo "*** Testing mb_strtoupper() : usage variations ***\n"; diff --git a/ext/mcrypt/tests/mcrypt_ecb_3des_decrypt.phpt b/ext/mcrypt/tests/mcrypt_ecb_3des_decrypt.phpt index e718107b9be..ace9f829d89 100644 --- a/ext/mcrypt/tests/mcrypt_ecb_3des_decrypt.phpt +++ b/ext/mcrypt/tests/mcrypt_ecb_3des_decrypt.phpt @@ -23,7 +23,7 @@ $cipher = MCRYPT_TRIPLEDES; $data = b"This is the secret message which must be encrypted"; $mode = MCRYPT_DECRYPT; -// tripledes uses keys upto 192 bits (24 bytes) +// tripledes uses keys up to 192 bits (24 bytes) $keys = array( b'12345678', b'12345678901234567890', diff --git a/ext/mcrypt/tests/mcrypt_ecb_3des_encrypt.phpt b/ext/mcrypt/tests/mcrypt_ecb_3des_encrypt.phpt index 7e295797793..65ef3ad8e2c 100644 --- a/ext/mcrypt/tests/mcrypt_ecb_3des_encrypt.phpt +++ b/ext/mcrypt/tests/mcrypt_ecb_3des_encrypt.phpt @@ -23,7 +23,7 @@ $cipher = MCRYPT_TRIPLEDES; $data = b"This is the secret message which must be encrypted"; $mode = MCRYPT_ENCRYPT; -// tripledes uses keys upto 192 bits (24 bytes) +// tripledes uses keys up to 192 bits (24 bytes) $keys = array( b'12345678', b'12345678901234567890', diff --git a/ext/mcrypt/tests/mcrypt_encrypt_3des_cbc.phpt b/ext/mcrypt/tests/mcrypt_encrypt_3des_cbc.phpt index 51a64943b29..8b3cbd83665 100644 --- a/ext/mcrypt/tests/mcrypt_encrypt_3des_cbc.phpt +++ b/ext/mcrypt/tests/mcrypt_encrypt_3des_cbc.phpt @@ -21,13 +21,13 @@ echo "*** Testing mcrypt_encrypt() : TripleDES functionality ***\n"; //test tripledes, aes //test different lengths of key, iv //test no iv being passed on CBC, ECB -//test upto 32 bytes with unlimited strength +//test up to 32 bytes with unlimited strength $cipher = MCRYPT_TRIPLEDES; $mode = MCRYPT_MODE_CBC; $data = b'This is the secret message which must be encrypted'; -// tripledes uses keys upto 192 bits (24 bytes) +// tripledes uses keys up to 192 bits (24 bytes) $keys = array( b'12345678', b'12345678901234567890', diff --git a/ext/mcrypt/tests/mcrypt_encrypt_3des_ecb.phpt b/ext/mcrypt/tests/mcrypt_encrypt_3des_ecb.phpt index 941eb7935f5..ea6b2c21603 100644 --- a/ext/mcrypt/tests/mcrypt_encrypt_3des_ecb.phpt +++ b/ext/mcrypt/tests/mcrypt_encrypt_3des_ecb.phpt @@ -20,7 +20,7 @@ $cipher = MCRYPT_TRIPLEDES; $mode = MCRYPT_MODE_ECB; $data = b'This is the secret message which must be encrypted'; -// tripledes uses keys upto 192 bits (24 bytes) +// tripledes uses keys up to 192 bits (24 bytes) $keys = array( b'12345678', b'12345678901234567890', diff --git a/ext/mcrypt/tests/mcrypt_rijndael128_128BitKey.phpt b/ext/mcrypt/tests/mcrypt_rijndael128_128BitKey.phpt index 621f7b1dbd4..5f5a4bea56c 100644 --- a/ext/mcrypt/tests/mcrypt_rijndael128_128BitKey.phpt +++ b/ext/mcrypt/tests/mcrypt_rijndael128_128BitKey.phpt @@ -30,7 +30,7 @@ $cipher = MCRYPT_RIJNDAEL_128; $mode = MCRYPT_MODE_CBC; $data = b'This is the secret message which must be encrypted'; -// keys upto 128 bits (16 bytes) +// keys up to 128 bits (16 bytes) $keys = array( null, '', diff --git a/ext/mysqli/tests/mysqli_ps_select_union.phpt b/ext/mysqli/tests/mysqli_ps_select_union.phpt index fed81b309dd..a4659c42672 100644 --- a/ext/mysqli/tests/mysqli_ps_select_union.phpt +++ b/ext/mysqli/tests/mysqli_ps_select_union.phpt @@ -44,8 +44,8 @@ require_once('skipifconnectfailure.inc'); if ($IS_MYSQLND) { /* Advantage mysqlnd - - The metadata mysqlnd has availabe after prepare is better than - the one made availabe by the MySQL Client Library (libmysql). + The metadata mysqlnd has available after prepare is better than + the one made available by the MySQL Client Library (libmysql). "libmysql" will give wrong results and that is OK - http://bugs.mysql.com/bug.php?id=47483 */ diff --git a/ext/mysqli/tests/mysqli_result_references.phpt b/ext/mysqli/tests/mysqli_result_references.phpt index b6bce0d9819..1cf0ffe09af 100644 --- a/ext/mysqli/tests/mysqli_result_references.phpt +++ b/ext/mysqli/tests/mysqli_result_references.phpt @@ -19,7 +19,7 @@ require_once('skipifconnectfailure.inc'); $idx = 0; while ($row = mysqli_fetch_assoc($res)) { - /* mysqlnd: force seperation - create copies */ + /* mysqlnd: force separation - create copies */ $references[$idx] = array( 'id' => &$row['id'], 'label' => $row['label'] . ''); @@ -30,7 +30,7 @@ require_once('skipifconnectfailure.inc'); mysqli_data_seek($res, 0); while ($row = mysqli_fetch_assoc($res)) { - /* mysqlnd: force seperation - create copies */ + /* mysqlnd: force separation - create copies */ $references[$idx] = array( 'id' => &$row['id'], 'label' => $row['label'] . ''); @@ -48,7 +48,7 @@ require_once('skipifconnectfailure.inc'); printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); while ($row = mysqli_fetch_assoc($res)) { - /* mysqlnd: force seperation - create copies*/ + /* mysqlnd: force separation - create copies*/ $references[$idx] = array( 'id' => &$row['id'], 'label' => $row['label'] . ''); @@ -151,4 +151,4 @@ array(1) refcount(2){ %unicode|string%(1) "a" refcount(1) } } -done! \ No newline at end of file +done! diff --git a/ext/mysqli/tests/mysqli_result_references_mysqlnd.phpt b/ext/mysqli/tests/mysqli_result_references_mysqlnd.phpt index 384f85fbbd6..c100c4a29ac 100644 --- a/ext/mysqli/tests/mysqli_result_references_mysqlnd.phpt +++ b/ext/mysqli/tests/mysqli_result_references_mysqlnd.phpt @@ -48,7 +48,7 @@ if ((version_compare(PHP_VERSION, '5.9.9', '>') == 1)) $references[$idx]['row_copy'] = $rows[$i]; $references[$idx]['id_ref'] = &$rows[$i]['id']; $references[$idx]['id_copy'] = $rows[$i]['id']; - /* enforce seperation */ + /* enforce separation */ $references[$idx]['id_copy_mod']= $rows[$i]['id'] + 0; } mysqli_free_result($res); @@ -116,4 +116,4 @@ array(2) refcount(2){ long(2) refcount(1) } } -done! \ No newline at end of file +done! diff --git a/ext/mysqli/tests/mysqli_stmt_bind_param_check_param_no_change.phpt b/ext/mysqli/tests/mysqli_stmt_bind_param_check_param_no_change.phpt index 03d15902af5..e7bce112af5 100644 --- a/ext/mysqli/tests/mysqli_stmt_bind_param_check_param_no_change.phpt +++ b/ext/mysqli/tests/mysqli_stmt_bind_param_check_param_no_change.phpt @@ -21,9 +21,9 @@ require_once('skipifconnectfailure.inc'); echo "Test 1:\n"; $stmt = $link->prepare("SELECT ? FOO"); - var_dump($foo); // here you can see the bar member var beeing a string + var_dump($foo); // here you can see the bar member var being a string $stmt->bind_param("s", $foo->bar); - var_dump($foo); // this will show $foo->bar beeing a reference string + var_dump($foo); // this will show $foo->bar being a reference string $stmt->bind_result($one); $stmt->execute(); $stmt->fetch(); diff --git a/ext/pcntl/README b/ext/pcntl/README index cadd11121c8..7b80924e491 100644 --- a/ext/pcntl/README +++ b/ext/pcntl/README @@ -1,7 +1,7 @@ Process Control Module for PHP (pcntl) This module will attempt to implement all features related to process spawning and -control (fork(), waitpid(), signal(), WIF's, etc). This is extremly experimental, +control (fork(), waitpid(), signal(), WIF's, etc). This is extremely experimental, with hope to become stable on most UNIX's. I greatly apreciate any feedback, fixes, and or suggestions on how to improve/better implement this functionality. diff --git a/ext/pcre/pcrelib/ChangeLog b/ext/pcre/pcrelib/ChangeLog index 1e5fd3274a3..93e4cdfcc26 100644 --- a/ext/pcre/pcrelib/ChangeLog +++ b/ext/pcre/pcrelib/ChangeLog @@ -1424,7 +1424,7 @@ Version 8.10 25-Jun-2010 7. Minor change to pcretest.c to avoid a compiler warning. -8. Added four artifical Unicode properties to help with an option to make +8. Added four artificial Unicode properties to help with an option to make \s etc use properties (see next item). The new properties are: Xan (alphanumeric), Xsp (Perl space), Xps (POSIX space), and Xwd (word). @@ -4049,7 +4049,7 @@ Version 4.3 21-May-03 (i) The utf8_table... variables are now declared "const". (ii) The code for \cx, which used the "case flipping" table to upper case - lower case letters, now just substracts 32. This is ASCII-specific, + lower case letters, now just subtracts 32. This is ASCII-specific, but the whole concept of \cx is ASCII-specific, so it seems reasonable. diff --git a/ext/pcre/pcrelib/HACKING b/ext/pcre/pcrelib/HACKING index 691b7a14e50..83955042125 100644 --- a/ext/pcre/pcrelib/HACKING +++ b/ext/pcre/pcrelib/HACKING @@ -360,7 +360,7 @@ reference number if the reference is to a unique capturing group (either by number or by name). When named groups are used, there may be more than one group with the same name. In this case, a reference by name generates OP_DNREF or OP_DNREFI. These are followed by two counts: the index (not the byte offset) -in the group name table of the first entry for the requred name, followed by +in the group name table of the first entry for the required name, followed by the number of groups with the same name. diff --git a/ext/pcre/pcrelib/README b/ext/pcre/pcrelib/README index 51197df7213..fb7f034f636 100644 --- a/ext/pcre/pcrelib/README +++ b/ext/pcre/pcrelib/README @@ -391,7 +391,7 @@ library. They are also documented in the pcrebuild man page. avoided by linking with libedit (which has a BSD licence) instead. Enabling libreadline causes the -lreadline option to be added to the pcretest - build. In many operating environments with a sytem-installed readline + build. In many operating environments with a system-installed readline library this is sufficient. However, in some environments (e.g. if an unmodified distribution version of readline is in use), it may be necessary to specify something like LIBS="-lncurses" as well. This is because, to quote diff --git a/ext/pcre/pcrelib/doc/pcre.txt b/ext/pcre/pcrelib/doc/pcre.txt index 9d69515c3b8..fa1aba013ce 100644 --- a/ext/pcre/pcrelib/doc/pcre.txt +++ b/ext/pcre/pcrelib/doc/pcre.txt @@ -1240,7 +1240,7 @@ PCRETEST OPTION FOR LIBREADLINE SUPPORT pcretest linked in this way, there may be licensing issues. Setting this option causes the -lreadline option to be added to the - pcretest build. In many operating environments with a sytem-installed + pcretest build. In many operating environments with a system-installed libreadline this is sufficient. However, in some environments (e.g. if an unmodified distribution version of readline is in use), some extra configuration may be necessary. The INSTALL file for libreadline says diff --git a/ext/pcre/pcrelib/pcre_exec.c b/ext/pcre/pcrelib/pcre_exec.c index a3f0c1923f2..2d0230f4f3b 100644 --- a/ext/pcre/pcrelib/pcre_exec.c +++ b/ext/pcre/pcrelib/pcre_exec.c @@ -1040,7 +1040,7 @@ for (;;) the result of a recursive call to match() whatever happened so it was possible to reduce stack usage by turning this into a tail recursion, except in the case of a possibly empty group. However, now that there is - the possiblity of (*THEN) occurring in the final alternative, this + the possibility of (*THEN) occurring in the final alternative, this optimization is no longer always possible. We can optimize if we know there are no (*THEN)s in the pattern; at present diff --git a/ext/pcre/pcrelib/pcre_study.c b/ext/pcre/pcrelib/pcre_study.c index c2aff517a5d..5884c1ec489 100644 --- a/ext/pcre/pcrelib/pcre_study.c +++ b/ext/pcre/pcrelib/pcre_study.c @@ -993,7 +993,7 @@ do tcode = set_table_bit(start_bits, tcode + 1, TRUE, cd, utf); break; - /* Single-char upto sets the bit and tries the next */ + /* Single-char up to sets the bit and tries the next */ case OP_UPTO: case OP_MINUPTO: diff --git a/ext/pcre/pcrelib/pcredemo.c b/ext/pcre/pcrelib/pcredemo.c index 946aba45cdc..1ca77f1537a 100644 --- a/ext/pcre/pcrelib/pcredemo.c +++ b/ext/pcre/pcrelib/pcredemo.c @@ -144,7 +144,7 @@ if (rc < 0) return 1; } -/* Match succeded */ +/* Match succeeded */ printf("\nMatch succeeded at offset %d\n", ovector[0]); @@ -362,7 +362,7 @@ for (;;) return 1; } - /* Match succeded */ + /* Match succeeded */ printf("\nMatch succeeded again at offset %d\n", ovector[0]); diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c index 32e6e1bdd01..dc4babf0dfd 100644 --- a/ext/pdo/pdo_dbh.c +++ b/ext/pdo/pdo_dbh.c @@ -494,7 +494,7 @@ static void pdo_stmt_construct(pdo_stmt_t *stmt, zval *object, zend_class_entry } /* }}} */ -/* {{{ proto object PDO::prepare(string statment [, array options]) +/* {{{ proto object PDO::prepare(string statement [, array options]) Prepares a statement for execution and returns a statement object */ static PHP_METHOD(PDO, prepare) { diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c index 2593d02e96a..7579a7ad626 100644 --- a/ext/pdo/pdo_stmt.c +++ b/ext/pdo/pdo_stmt.c @@ -2049,7 +2049,7 @@ static PHP_METHOD(PDOStatement, setFetchMode) /* }}} */ /* {{{ proto bool PDOStatement::nextRowset() - Advances to the next rowset in a multi-rowset statement handle. Returns true if it succeded, false otherwise */ + Advances to the next rowset in a multi-rowset statement handle. Returns true if it succeeded, false otherwise */ static int pdo_stmt_do_next_rowset(pdo_stmt_t *stmt TSRMLS_DC) { diff --git a/ext/pdo/tests/bug_39656.phpt b/ext/pdo/tests/bug_39656.phpt index 7d113ef4aab..9ee54916bb2 100644 --- a/ext/pdo/tests/bug_39656.phpt +++ b/ext/pdo/tests/bug_39656.phpt @@ -1,5 +1,5 @@ --TEST-- -PDO Common: Bug #39656 (Crash when calling fetch() on a PDO statment object after closeCursor()) +PDO Common: Bug #39656 (Crash when calling fetch() on a PDO statement object after closeCursor()) --SKIPIF-- fetch(PDO::FETCH_ASSOC); if ($ret['label'] !== $value) { - printf("[%03d + 3] Returned value seems to be wrong (%d vs. %d charachters). Check manually\n", + printf("[%03d + 3] Returned value seems to be wrong (%d vs. %d characters). Check manually\n", $offset, strlen($ret['label']), strlen($value)); return false; } diff --git a/ext/pgsql/README b/ext/pgsql/README index 785b4f034b3..86df804fbde 100644 --- a/ext/pgsql/README +++ b/ext/pgsql/README @@ -43,7 +43,7 @@ module with specific version. You need to install PostgreSQL somewhere in your system to build PHP with PostgreSQL support. ==== Note For PostgreSQL 7.2 ==== -I've tested upto 7.2.2. +I've tested up to 7.2.2. ==== TODO List === Make pg_convert() smater. diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index 6a433af0f33..c0558e50278 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -1370,7 +1370,7 @@ static void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) /* ensure that the link did not die */ if (PGG(auto_reset_persistent) & 1) { /* need to send & get something from backend to - make sure we catch CONNECTION_BAD everytime */ + make sure we catch CONNECTION_BAD every time */ PGresult *pg_result; pg_result = PQexec(le->ptr, "select 1"); PQclear(pg_result); @@ -1478,7 +1478,7 @@ static void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) } PGG(num_links)++; } - /* set notice processer */ + /* set notice processor */ if (! PGG(ignore_notices) && Z_TYPE_P(return_value) == IS_RESOURCE) { PQsetNoticeProcessor(pgsql, _php_pgsql_notice_handler, (void*)Z_RESVAL_P(return_value)); } @@ -4358,7 +4358,7 @@ PHP_FUNCTION(pg_escape_bytea) #endif to = (char *)PQescapeBytea((unsigned char*)from, from_len, &to_len); - RETVAL_STRINGL(to, to_len-1, 1); /* to_len includes addtional '\0' */ + RETVAL_STRINGL(to, to_len-1, 1); /* to_len includes additional '\0' */ PQfreemem(to); } /* }}} */ diff --git a/ext/phar/func_interceptors.c b/ext/phar/func_interceptors.c index 87411fc98d5..0d6cc43879a 100644 --- a/ext/phar/func_interceptors.c +++ b/ext/phar/func_interceptors.c @@ -570,7 +570,7 @@ static void phar_fancy_stat(struct stat *stat_sb, int type, zval *return_value T #else MAKE_LONG_ZVAL_INCREF(stat_blocks,-1); #endif - /* Store numeric indexes in propper order */ + /* Store numeric indexes in proper order */ zend_hash_next_index_insert(HASH_OF(return_value), (void *)&stat_dev, sizeof(zval *), NULL); zend_hash_next_index_insert(HASH_OF(return_value), (void *)&stat_ino, sizeof(zval *), NULL); zend_hash_next_index_insert(HASH_OF(return_value), (void *)&stat_mode, sizeof(zval *), NULL); diff --git a/ext/shmop/README b/ext/shmop/README index a8ea03af912..c4970376b0d 100644 --- a/ext/shmop/README +++ b/ext/shmop/README @@ -6,7 +6,7 @@ Shared Memory Operations Extension to PHP to communicate the deamon via SHM. PHP already had a shared memory extension (sysvshm) written by Christian Cartus , unfortunately this extension was designed with PHP only in mind and - offers high level features which are extremly bothersome for basic SHM + offers high level features which are extremely bothersome for basic SHM we had in mind. After spending a day trying to reverse engineer and figure out the format of sysvshm we decided that it would be much easier to add our own extension to php for simple SHM operations, we were right :)). diff --git a/ext/snmp/snmp.c b/ext/snmp/snmp.c index 4dd4badcd2c..06df7d81b58 100644 --- a/ext/snmp/snmp.c +++ b/ext/snmp/snmp.c @@ -1588,7 +1588,7 @@ PHP_FUNCTION(snmpwalk) /* }}} */ /* {{{ proto mixed snmprealwalk(string host, string community, mixed object_id [, int timeout [, int retries]]) - Return all objects including their respective object id withing the specified one */ + Return all objects including their respective object id within the specified one */ PHP_FUNCTION(snmprealwalk) { php_snmp(INTERNAL_FUNCTION_PARAM_PASSTHRU, SNMP_CMD_WALK, SNMP_VERSION_1); @@ -1616,7 +1616,7 @@ PHP_FUNCTION(snmp_get_quick_print) /* }}} */ /* {{{ proto bool snmp_set_quick_print(int quick_print) - Return all objects including their respective object id withing the specified one */ + Return all objects including their respective object id within the specified one */ PHP_FUNCTION(snmp_set_quick_print) { long a1; @@ -1698,7 +1698,7 @@ PHP_FUNCTION(snmp2_walk) /* }}} */ /* {{{ proto mixed snmp2_real_walk(string host, string community, mixed object_id [, int timeout [, int retries]]) - Return all objects including their respective object id withing the specified one */ + Return all objects including their respective object id within the specified one */ PHP_FUNCTION(snmp2_real_walk) { php_snmp(INTERNAL_FUNCTION_PARAM_PASSTHRU, SNMP_CMD_WALK, SNMP_VERSION_2c); @@ -1893,7 +1893,7 @@ PHP_METHOD(snmp, getnext) /* }}} */ /* {{{ proto mixed SNMP::walk(mixed object_id [, bool $suffix_as_key = FALSE [, int $max_repetitions [, int $non_repeaters]]) - Return all objects including their respective object id withing the specified one as array of oid->value pairs */ + Return all objects including their respective object id within the specified one as array of oid->value pairs */ PHP_METHOD(snmp, walk) { php_snmp(INTERNAL_FUNCTION_PARAM_PASSTHRU, SNMP_CMD_WALK, (-1)); diff --git a/ext/soap/TODO.old b/ext/soap/TODO.old index b219c61f8a3..821dc310724 100644 --- a/ext/soap/TODO.old +++ b/ext/soap/TODO.old @@ -18,7 +18,7 @@ when using wsdls and function names are similar find the best match void test(int); void test(string); maybe use the same alogrithim as ext/java. -investigate further http keep_alive... inital testing proved slower.. maybe php_streams will speed things up.. +investigate further http keep_alive... initial testing proved slower.. maybe php_streams will speed things up.. provide schema 1999/2001 support.... through memory leak testing possible using shared memory for sdl caching... diff --git a/ext/soap/interop/client_round2_interop.php b/ext/soap/interop/client_round2_interop.php index fd5767cc179..bd52f287718 100644 --- a/ext/soap/interop/client_round2_interop.php +++ b/ext/soap/interop/client_round2_interop.php @@ -93,7 +93,7 @@ class Interop_Client function _fetchEndpoints(&$soapclient, $test) { $this->_getEndpoints($test, 1); - // retreive endpoints from the endpoint server + // retrieve endpoints from the endpoint server $endpointArray = $soapclient->__soapCall("GetEndpointInfo",array("groupName"=>$test),array('soapaction'=>"http://soapinterop.org/",'uri'=>"http://soapinterop.org/")); if (is_soap_fault($endpointArray) || PEAR::isError($endpointArray)) { if ($this->html) print "
";
@@ -133,7 +133,7 @@ class Interop_Client
 
     /**
     *  fetchEndpoints
-    * retreive endpoints interop server
+    * retrieve endpoints interop server
     *
     * @return boolean result
     * @access private
@@ -158,7 +158,7 @@ class Interop_Client
             }
             return NULL;
         }
-        // retreive all endpoints now
+        // retrieve all endpoints now
         $this->currentTest = $test;
         $x = $this->_getEndpoints($test);
         return $x;
@@ -166,7 +166,7 @@ class Interop_Client
 
     /**
     *  getEndpoints
-    * retreive endpoints from either database or interop server
+    * retrieve endpoints from either database or interop server
     *
     * @param string base (see local var $tests)
     * @param boolean all (if false, only get valid endpoints, status=1)
@@ -182,7 +182,7 @@ class Interop_Client
 
     /**
     *  _getEndpoints
-    * retreive endpoints from database
+    * retrieve endpoints from database
     *
     * @param string base (see local var $tests)
     * @param boolean all (if false, only get valid endpoints, status=1)
@@ -222,7 +222,7 @@ class Interop_Client
 
     /**
     *  getResults
-    * retreive results from the database, stuff them into the endpoint array
+    * retrieve results from the database, stuff them into the endpoint array
     *
     * @access private
     */
@@ -230,7 +230,7 @@ class Interop_Client
         // be sure we have the right endpoints for this test result
         $this->getEndpoints($test);
 
-        // retreive the results and put them into the endpoint info
+        // retrieve the results and put them into the endpoint info
         $sql = "select * from results where class='$test' and type='$type' and wsdl=$wsdl";
         $results = $this->dbc->getAll($sql,NULL, DB_FETCHMODE_ASSOC );
         foreach ($results as $result) {
@@ -657,12 +657,12 @@ try {
 
     /**
     *  getResults
-    * retreive results from the database, stuff them into the endpoint array
+    * retrieve results from the database, stuff them into the endpoint array
     *
     * @access private
     */
     function getMethodList($test = 'base') {
-        // retreive the results and put them into the endpoint info
+        // retrieve the results and put them into the endpoint info
         $sql = "select distinct(function) from results where class='$test' order by function";
         $results = $this->dbc->getAll($sql);
         $ar = array();
diff --git a/ext/soap/package.xml b/ext/soap/package.xml
index e43fd36024d..6c68f8dd4cd 100644
--- a/ext/soap/package.xml
+++ b/ext/soap/package.xml
@@ -34,7 +34,7 @@
     2002-07-07
     alpha
     
-	- First offical PEAR/PECL release
+	- First official PEAR/PECL release
     
   
   
diff --git a/ext/soap/php_sdl.h b/ext/soap/php_sdl.h
index fd2d78db9e8..fb7a459b830 100644
--- a/ext/soap/php_sdl.h
+++ b/ext/soap/php_sdl.h
@@ -87,7 +87,7 @@ struct _sdlBinding {
 	void           *bindingAttributes; /* sdlSoapBindingPtr */
 };
 
-/* Soap Binding Specfic stuff */
+/* Soap Binding Specific stuff */
 struct _sdlSoapBinding {
 	sdlEncodingStyle  style;
 	sdlTransport      transport; /* not implemented yet */
diff --git a/ext/soap/soap.c b/ext/soap/soap.c
index 31ea7759894..79084ed2632 100644
--- a/ext/soap/soap.c
+++ b/ext/soap/soap.c
@@ -3121,7 +3121,7 @@ PHP_METHOD(SoapClient, __doRequest)
 
 /* {{{ proto void SoapClient::__setCookie(string name [, strung value])
    Sets cookie thet will sent with SOAP request.
-   The call to this function will effect all folowing calls of SOAP methods.
+   The call to this function will effect all following calls of SOAP methods.
    If value is not specified cookie is removed. */
 PHP_METHOD(SoapClient, __setCookie)
 {
diff --git a/ext/soap/tests/bugs/bug27742.wsdl b/ext/soap/tests/bugs/bug27742.wsdl
index 7f1514acbf3..a9429981c3a 100644
--- a/ext/soap/tests/bugs/bug27742.wsdl
+++ b/ext/soap/tests/bugs/bug27742.wsdl
@@ -726,7 +726,7 @@
 	
 	
 		
-			Containes genre information where available for the program records.  A program may have more than one genre with different relevence factors.
+			Contains genre information where available for the program records.  A program may have more than one genre with different relevance factors.
 		
 		
 			
@@ -749,7 +749,7 @@
 										
 										
 											
-												A relevence factor that applies to the genre classification for the program.  A relevence factor of 1 indicates that this is the top-level genre under which the program is classified.
+												A relevance factor that applies to the genre classification for the program.  A relevance factor of 1 indicates that this is the top-level genre under which the program is classified.
 											
 										
 									
diff --git a/ext/soap/tests/bugs/bug50698_2.phpt b/ext/soap/tests/bugs/bug50698_2.phpt
index a39f4b56bfa..7ff667423ce 100644
--- a/ext/soap/tests/bugs/bug50698_2.phpt
+++ b/ext/soap/tests/bugs/bug50698_2.phpt
@@ -1,5 +1,5 @@
 --TEST--
-Request #50698_2 (SoapClient should handle wsdls with some incompatiable endpoints -- EDGECASE: Large mix of compatiable and incompatiable endpoints.)
+Request #50698_2 (SoapClient should handle wsdls with some incompatiable endpoints -- EDGECASE: Large mix of compatible and incompatiable endpoints.)
 --SKIPIF--
 
 --INI--
diff --git a/ext/spl/internal/recursivecachingiterator.inc b/ext/spl/internal/recursivecachingiterator.inc
index 0676d435f22..cd5d3e31f51 100644
--- a/ext/spl/internal/recursivecachingiterator.inc
+++ b/ext/spl/internal/recursivecachingiterator.inc
@@ -80,7 +80,7 @@ class RecursiveCachingIterator extends CachingIterator implements RecursiveItera
 	/** @return whether the current element has children
 	 * @note The check whether the Iterator for the children can be created was
 	 *       already executed. Hence when flag CATCH_GET_CHILD was given in
-	 *       constructor this fucntion returns false so that getChildren does 
+	 *       constructor this function returns false so that getChildren does 
 	 *       not try to access those children.
 	 */
 	function hasChildren()
diff --git a/ext/spl/spl.php b/ext/spl/spl.php
index c276f1f2eec..ff9d1b6bbe1 100755
--- a/ext/spl/spl.php
+++ b/ext/spl/spl.php
@@ -958,7 +958,7 @@ class SplFileInfo
 	 *
 	 * @param mode              open mode
 	 * @param use_include_path  whether to search include paths (don't use)
-	 * @param context           resource context to pased to open function
+	 * @param context           resource context to passed to open function
 	 * @throw RuntimeException  if file cannot be opened (e.g. insufficient
 	 *                          access rights).
 	 * @return The opened file as a SplFileObject instance
diff --git a/ext/spl/tests/SplFixedArray_fromarray_param_multiarray.phpt b/ext/spl/tests/SplFixedArray_fromarray_param_multiarray.phpt
index f57fe78fb8f..659f61c80d8 100644
--- a/ext/spl/tests/SplFixedArray_fromarray_param_multiarray.phpt
+++ b/ext/spl/tests/SplFixedArray_fromarray_param_multiarray.phpt
@@ -1,5 +1,5 @@
 --TEST--
-Tries to create a SplFixedArray using the fromArray() function and a multi dimentional array.
+Tries to create a SplFixedArray using the fromArray() function and a multi dimensional array.
 --CREDITS--
 Philip Norton philipnorton42@gmail.com
 --FILE--
diff --git a/ext/spl/tests/bug53071.phpt b/ext/spl/tests/bug53071.phpt
index c2c2605e2eb..9d5dac4cd03 100644
--- a/ext/spl/tests/bug53071.phpt
+++ b/ext/spl/tests/bug53071.phpt
@@ -12,7 +12,7 @@ function LimitedScope()
 	$myA = new myClass();
 	$myB = new SplObjectStorage();
 	$myC = new myClass();
-	$myC->member = $myA; // myC has a referece to myA
+	$myC->member = $myA; // myC has a reference to myA
 	$myB->Attach($myC);  // myB attaches myC
 	$myA->member = $myB; // myA has myB, comleting the cycle
 }
diff --git a/ext/sqlite3/libsqlite/sqlite3.c b/ext/sqlite3/libsqlite/sqlite3.c
index e5aa96f6b00..99aeccc46f1 100644
--- a/ext/sqlite3/libsqlite/sqlite3.c
+++ b/ext/sqlite3/libsqlite/sqlite3.c
@@ -10022,7 +10022,7 @@ SQLITE_PRIVATE void sqlite3PCacheSetDefault(void);
 ** shared locks begins at SHARED_FIRST. 
 **
 ** The same locking strategy and
-** byte ranges are used for Unix.  This leaves open the possiblity of having
+** byte ranges are used for Unix.  This leaves open the possibility of having
 ** clients on win95, winNT, and unix all talking to the same shared file
 ** and all locking correctly.  To do so would require that samba (or whatever
 ** tool is being used for file sharing) implements locks correctly between
@@ -11971,7 +11971,7 @@ struct TriggerStep {
   u8 op;               /* One of TK_DELETE, TK_UPDATE, TK_INSERT, TK_SELECT */
   u8 orconf;           /* OE_Rollback etc. */
   Trigger *pTrig;      /* The trigger that this step is a part of */
-  Select *pSelect;     /* SELECT statment or RHS of INSERT INTO .. SELECT ... */
+  Select *pSelect;     /* SELECT statement or RHS of INSERT INTO .. SELECT ... */
   Token target;        /* Target table for DELETE, UPDATE, INSERT */
   Expr *pWhere;        /* The WHERE clause for DELETE or UPDATE steps */
   ExprList *pExprList; /* SET clause for UPDATE. */
@@ -13019,7 +13019,7 @@ SQLITE_PRIVATE   int sqlite3MemdebugNoType(void*,u8);
 **
 *************************************************************************
 **
-** This file contains definitions of global variables and contants.
+** This file contains definitions of global variables and constants.
 */
 
 /* An array to map all upper-case characters into their corresponding
@@ -13908,7 +13908,7 @@ struct Mem {
 #endif
 
 /*
-** Each auxilliary data pointer stored by a user defined function 
+** Each auxiliary data pointer stored by a user defined function 
 ** implementation calling sqlite3_set_auxdata() is stored in an instance
 ** of this structure. All such structures associated with a single VM
 ** are stored in a linked list headed at Vdbe.pAuxData. All are destroyed
@@ -17632,7 +17632,7 @@ SQLITE_PRIVATE const sqlite3_mem_methods *sqlite3MemGetMemsys3(void){
 **   1.  All memory allocations sizes are rounded up to a power of 2.
 **
 **   2.  If two adjacent free blocks are the halves of a larger block,
-**       then the two blocks are coalesed into the single larger block.
+**       then the two blocks are coalesced into the single larger block.
 **
 **   3.  New memory is allocated from the first available free block.
 **
@@ -18570,7 +18570,7 @@ SQLITE_PRIVATE sqlite3_mutex_methods const *sqlite3DefaultMutex(void){
 
 /*
 ** The sqlite3_mutex.id, sqlite3_mutex.nRef, and sqlite3_mutex.owner fields
-** are necessary under two condidtions:  (1) Debug builds and (2) using
+** are necessary under two conditions:  (1) Debug builds and (2) using
 ** home-grown mutexes.  Encapsulate these conditions into a single #define.
 */
 #if defined(SQLITE_DEBUG) || defined(SQLITE_HOMEGROWN_RECURSIVE_MUTEX)
@@ -21904,7 +21904,7 @@ SQLITE_PRIVATE void sqlite3ErrorMsg(Parse *pParse, const char *zFormat, ...){
 ** occur.
 **
 ** 2002-Feb-14: This routine is extended to remove MS-Access style
-** brackets from around identifers.  For example:  "[a-b-c]" becomes
+** brackets from around identifiers.  For example:  "[a-b-c]" becomes
 ** "a-b-c".
 */
 SQLITE_PRIVATE int sqlite3Dequote(char *z){
@@ -22146,7 +22146,7 @@ do_atof_calc:
   /* store the result */
   *pResult = result;
 
-  /* return true if number and no extra non-whitespace chracters after */
+  /* return true if number and no extra non-whitespace characters after */
   return z>=zEnd && nDigits>0 && eValid && nonNum==0;
 #else
   return !sqlite3Atoi64(z, pResult, length, enc);
@@ -22837,7 +22837,7 @@ SQLITE_PRIVATE int sqlite3SafetyCheckSickOrOk(sqlite3 *db){
 }
 
 /*
-** Attempt to add, substract, or multiply the 64-bit signed value iB against
+** Attempt to add, subtract, or multiply the 64-bit signed value iB against
 ** the other 64-bit signed integer at *pA and store the result in *pA.
 ** Return 0 on success.  Or if the operation would have resulted in an
 ** overflow, leave *pA unchanged and return 1.
@@ -26863,7 +26863,7 @@ static int unixRead(
 #endif
 
 #if SQLITE_MAX_MMAP_SIZE>0
-  /* Deal with as much of this read request as possible by transfering
+  /* Deal with as much of this read request as possible by transferring
   ** data from the memory mapping using memcpy().  */
   if( offsetmmapSize ){
     if( offset+amt <= pFile->mmapSize ){
@@ -26998,7 +26998,7 @@ static int unixWrite(
 #endif
 
 #if SQLITE_MAX_MMAP_SIZE>0
-  /* Deal with as much of this write request as possible by transfering
+  /* Deal with as much of this write request as possible by transferring
   ** data from the memory mapping using memcpy().  */
   if( offsetmmapSize ){
     if( offset+amt <= pFile->mmapSize ){
@@ -28557,7 +28557,7 @@ static int unixUnfetch(sqlite3_file *fd, i64 iOff, void *p){
 ** looks at the filesystem type and tries to guess the best locking
 ** strategy from that.
 **
-** For finder-funtion F, two objects are created:
+** For finder-function F, two objects are created:
 **
 **    (1) The real finder-function named "FImpt()".
 **
@@ -29998,7 +29998,7 @@ static int unixGetLastError(sqlite3_vfs *NotUsed, int NotUsed2, char *NotUsed3){
 ** setting the environment variable SQLITE_FORCE_PROXY_LOCKING to 1 will
 ** force proxy locking to be used for every database file opened, and 0
 ** will force automatic proxy locking to be disabled for all database
-** files (explicity calling the SQLITE_SET_LOCKPROXYFILE pragma or
+** files (explicitly calling the SQLITE_SET_LOCKPROXYFILE pragma or
 ** sqlite_file_control API is not affected by SQLITE_FORCE_PROXY_LOCKING).
 */
 
@@ -30529,7 +30529,7 @@ static int proxyTakeConch(unixFile *pFile){
               fprintf(stderr, "fchmod %o FAILED with %d %s\n",
                       cmode, code, strerror(code));
             } else {
-              fprintf(stderr, "fchmod %o SUCCEDED\n",cmode);
+              fprintf(stderr, "fchmod %o SUCCEEDED\n",cmode);
             }
           }else{
             int code = errno;
@@ -33761,7 +33761,7 @@ static int winRead(
            pFile->h, pBuf, amt, offset, pFile->locktype));
 
 #if SQLITE_MAX_MMAP_SIZE>0
-  /* Deal with as much of this read request as possible by transfering
+  /* Deal with as much of this read request as possible by transferring
   ** data from the memory mapping using memcpy().  */
   if( offsetmmapSize ){
     if( offset+amt <= pFile->mmapSize ){
@@ -33833,7 +33833,7 @@ static int winWrite(
            pFile->h, pBuf, amt, offset, pFile->locktype));
 
 #if SQLITE_MAX_MMAP_SIZE>0
-  /* Deal with as much of this write request as possible by transfering
+  /* Deal with as much of this write request as possible by transferring
   ** data from the memory mapping using memcpy().  */
   if( offsetmmapSize ){
     if( offset+amt <= pFile->mmapSize ){
@@ -33965,7 +33965,7 @@ static int winTruncate(sqlite3_file *id, sqlite3_int64 nByte){
 #ifdef SQLITE_TEST
 /*
 ** Count the number of fullsyncs and normal syncs.  This is used to test
-** that syncs and fullsyncs are occuring at the right times.
+** that syncs and fullsyncs are occurring at the right times.
 */
 SQLITE_API int sqlite3_sync_count = 0;
 SQLITE_API int sqlite3_fullsync_count = 0;
@@ -39330,8 +39330,8 @@ SQLITE_PRIVATE int sqlite3RowSetNext(RowSet *p, i64 *pRowid){
 ** Check to see if element iRowid was inserted into the rowset as
 ** part of any insert batch prior to iBatch.  Return 1 or 0.
 **
-** If this is the first test of a new batch and if there exist entires
-** on pRowSet->pEntry, then sort those entires into the forest at
+** If this is the first test of a new batch and if there exist entries
+** on pRowSet->pEntry, then sort those entries into the forest at
 ** pRowSet->pForest so that they can be tested.
 */
 SQLITE_PRIVATE int sqlite3RowSetTest(RowSet *pRowSet, u8 iBatch, sqlite3_int64 iRowid){
@@ -39613,7 +39613,7 @@ SQLITE_PRIVATE int sqlite3WalFramesize(Wal *pWal);
 ** Definition: Two databases (or the same database at two points it time)
 ** are said to be "logically equivalent" if they give the same answer to
 ** all queries.  Note in particular the content of freelist leaf
-** pages can be changed arbitarily without effecting the logical equivalence
+** pages can be changed arbitrarily without effecting the logical equivalence
 ** of the database.
 ** 
 ** (7) At any time, if any subset, including the empty set and the total set,
@@ -39838,7 +39838,7 @@ int sqlite3PagerTrace=1;  /* True to enable tracing */
 **    outstanding transactions have been abandoned, the pager is able to
 **    transition back to OPEN state, discarding the contents of the 
 **    page-cache and any other in-memory state at the same time. Everything
-**    is reloaded from disk (and, if necessary, hot-journal rollback peformed)
+**    is reloaded from disk (and, if necessary, hot-journal rollback performed)
 **    when a read-transaction is next opened on the pager (transitioning
 **    the pager into READER state). At that point the system has recovered 
 **    from the error.
@@ -41196,7 +41196,7 @@ static int writeMasterJournal(Pager *pPager, const char *zMaster){
   }
   pPager->journalOff += (nMaster+20);
 
-  /* If the pager is in peristent-journal mode, then the physical 
+  /* If the pager is in persistent-journal mode, then the physical 
   ** journal-file may extend past the end of the master-journal name
   ** and 8 bytes of magic data just written to the file. This is 
   ** dangerous because the code to rollback a hot-journal file
@@ -41369,7 +41369,7 @@ static void pager_unlock(Pager *pPager){
 
 /*
 ** This function is called whenever an IOERR or FULL error that requires
-** the pager to transition into the ERROR state may ahve occurred.
+** the pager to transition into the ERROR state may have occurred.
 ** The first argument is a pointer to the pager structure, the second 
 ** the error-code about to be returned by a pager API function. The 
 ** value returned is a copy of the second argument to this function. 
@@ -48080,7 +48080,7 @@ SQLITE_PRIVATE int sqlite3WalOpen(
 }
 
 /*
-** Change the size to which the WAL file is trucated on each reset.
+** Change the size to which the WAL file is truncated on each reset.
 */
 SQLITE_PRIVATE void sqlite3WalLimit(Wal *pWal, i64 iLimit){
   if( pWal ) pWal->mxWalSize = iLimit;
@@ -54531,7 +54531,7 @@ SQLITE_PRIVATE int sqlite3BtreeCloseCursor(BtCursor *pCur){
 ** compiler to crash when getCellInfo() is implemented as a macro.
 ** But there is a measureable speed advantage to using the macro on gcc
 ** (when less compiler optimizations like -Os or -O0 are used and the
-** compiler is not doing agressive inlining.)  So we use a real function
+** compiler is not doing aggressive inlining.)  So we use a real function
 ** for MSVC and a macro for everything else.  Ticket #2457.
 */
 #ifndef NDEBUG
@@ -54929,7 +54929,7 @@ static int accessPayload(
 
 /*
 ** Read part of the key associated with cursor pCur.  Exactly
-** "amt" bytes will be transfered into pBuf[].  The transfer
+** "amt" bytes will be transferred into pBuf[].  The transfer
 ** begins at "offset".
 **
 ** The caller must ensure that pCur is pointing to a valid row
@@ -54949,7 +54949,7 @@ SQLITE_PRIVATE int sqlite3BtreeKey(BtCursor *pCur, u32 offset, u32 amt, void *pB
 
 /*
 ** Read part of the data associated with cursor pCur.  Exactly
-** "amt" bytes will be transfered into pBuf[].  The transfer
+** "amt" bytes will be transferred into pBuf[].  The transfer
 ** begins at "offset".
 **
 ** Return SQLITE_OK on success or an error code if anything goes
@@ -62945,7 +62945,7 @@ SQLITE_PRIVATE void sqlite3VdbeRewind(Vdbe *p){
 **
 ** This function may be called exact once on a each virtual machine.
 ** After this routine is called the VM has been "packaged" and is ready
-** to run.  After this routine is called, futher calls to 
+** to run.  After this routine is called, further calls to 
 ** sqlite3VdbeAddOp() functions are prohibited.  This routine disconnects
 ** the Vdbe from the Parse object that helped generate it so that the
 ** the Vdbe becomes an independent entity and the Parse object can be
@@ -62997,7 +62997,7 @@ SQLITE_PRIVATE void sqlite3VdbeMakeReady(
   /* Allocate space for memory registers, SQL variables, VDBE cursors and 
   ** an array to marshal SQL function arguments in.
   */
-  zCsr = (u8*)&p->aOp[p->nOp];            /* Memory avaliable for allocation */
+  zCsr = (u8*)&p->aOp[p->nOp];            /* Memory available for allocation */
   zEnd = (u8*)&p->aOp[pParse->nOpAlloc];  /* First byte past end of zCsr[] */
 
   resolveP2Values(p, &nArg);
@@ -63323,7 +63323,7 @@ static int vdbeCommit(sqlite3 *db, Vdbe *p){
 
   /* The complex case - There is a multi-file write-transaction active.
   ** This requires a master journal file to ensure the transaction is
-  ** committed atomicly.
+  ** committed atomically.
   */
 #ifndef SQLITE_OMIT_DISKIO
   else{
@@ -65560,7 +65560,7 @@ SQLITE_API int sqlite3_value_type(sqlite3_value* pVal){
 ** The following routines are used by user-defined functions to specify
 ** the function result.
 **
-** The setStrOrError() funtion calls sqlite3VdbeMemSetStr() to store the
+** The setStrOrError() function calls sqlite3VdbeMemSetStr() to store the
 ** result as a string or blob but if the string or blob is too large, it
 ** then sets the error code to SQLITE_TOOBIG
 */
@@ -65981,7 +65981,7 @@ SQLITE_API void *sqlite3_aggregate_context(sqlite3_context *p, int nByte){
 }
 
 /*
-** Return the auxilary data pointer, if any, for the iArg'th argument to
+** Return the auxiliary data pointer, if any, for the iArg'th argument to
 ** the user-function defined by pCtx.
 */
 SQLITE_API void *sqlite3_get_auxdata(sqlite3_context *pCtx, int iArg){
@@ -65996,7 +65996,7 @@ SQLITE_API void *sqlite3_get_auxdata(sqlite3_context *pCtx, int iArg){
 }
 
 /*
-** Set the auxilary data pointer and delete function, for the iArg'th
+** Set the auxiliary data pointer and delete function, for the iArg'th
 ** argument to the user-function defined by pCtx. Any previous value is
 ** deleted by calling the delete function specified when it was set.
 */
@@ -75506,7 +75506,7 @@ SQLITE_PRIVATE int sqlite3MemJournalSize(void){
 
 /*
 ** Walk an expression tree.  Invoke the callback once for each node
-** of the expression, while decending.  (In other words, the callback
+** of the expression, while descending.  (In other words, the callback
 ** is invoked before visiting children.)
 **
 ** The return value from the callback should be one of the WRC_*
@@ -77026,7 +77026,7 @@ SQLITE_PRIVATE int sqlite3ResolveExprNames(
 
 /*
 ** Resolve all names in all expressions of a SELECT and in all
-** decendents of the SELECT, including compounds off of p->pPrior,
+** descendants of the SELECT, including compounds off of p->pPrior,
 ** subqueries in expressions, and subqueries used as FROM clause
 ** terms.
 **
@@ -77119,7 +77119,7 @@ SQLITE_PRIVATE void sqlite3ResolveSelfReference(
 ** affinity of that column is returned. Otherwise, 0x00 is returned,
 ** indicating no affinity for the expression.
 **
-** i.e. the WHERE clause expresssions in the following statements all
+** i.e. the WHERE clause expressions in the following statements all
 ** have an affinity:
 **
 ** CREATE TABLE t1(a);
@@ -77835,7 +77835,7 @@ static int exprStructSize(Expr *p){
 ** Note that with flags==EXPRDUP_REDUCE, this routines works on full-size
 ** (unreduced) Expr objects as they or originally constructed by the parser.
 ** During expression analysis, extra information is computed and moved into
-** later parts of teh Expr object and that extra information might get chopped
+** later parts of the Expr object and that extra information might get chopped
 ** off if the expression is reduced.  Note also that it does not work to
 ** make a EXPRDUP_REDUCE copy of a reduced expression.  It is only legal
 ** to reduce a pristine expression tree from the parser.  The implementation
@@ -81503,7 +81503,7 @@ static void renameParentFunc(
 ** ALTER TABLE command. The first argument is the text of a CREATE TRIGGER 
 ** statement. The second is a table name. The table name in the CREATE 
 ** TRIGGER statement is replaced with the third argument and the result 
-** returned. This is analagous to renameTableFunc() above, except for CREATE
+** returned. This is analogous to renameTableFunc() above, except for CREATE
 ** TRIGGER, not CREATE INDEX and CREATE TABLE.
 */
 static void renameTriggerFunc(
@@ -83682,7 +83682,7 @@ static void initAvgEq(Index *pIdx){
       /* Set nSum to the number of distinct (iCol+1) field prefixes that
       ** occur in the stat4 table for this index before pFinal. Set
       ** sumEq to the sum of the nEq values for column iCol for the same
-      ** set (adding the value only once where there exist dupicate 
+      ** set (adding the value only once where there exist duplicate 
       ** prefixes).  */
       for(i=0; i<(pIdx->nSample-1); i++){
         if( aSample[i].anDLt[iCol]!=aSample[i+1].anDLt[iCol] ){
@@ -95333,7 +95333,7 @@ static int xferOptimization(
   }
 #endif
 #ifndef SQLITE_OMIT_FOREIGN_KEY
-  /* Disallow the transfer optimization if the destination table constains
+  /* Disallow the transfer optimization if the destination table contains
   ** any foreign key constraints.  This is more restrictive than necessary.
   ** But the main beneficiary of the transfer optimization is the VACUUM 
   ** command, and the VACUUM command disables foreign key constraints.  So
@@ -96561,7 +96561,7 @@ static int sqlite3LoadExtension(
   ** entry point name "sqlite3_extension_init" was not found, then
   ** construct an entry point name "sqlite3_X_init" where the X is
   ** replaced by the lowercase value of every ASCII alphabetic 
-  ** character in the filename after the last "/" upto the first ".",
+  ** character in the filename after the last "/" up to the first ".",
   ** and eliding the first three characters if they are "lib".  
   ** Examples:
   **
@@ -101878,7 +101878,7 @@ static void generateWithRecursiveQuery(
   int iQueue;                   /* The Queue table */
   int iDistinct = 0;            /* To ensure unique results if UNION */
   int eDest = SRT_Table;        /* How to write to Queue */
-  SelectDest destQueue;         /* SelectDest targetting the Queue table */
+  SelectDest destQueue;         /* SelectDest targeting the Queue table */
   int i;                        /* Loop counter */
   int rc;                       /* Result code */
   ExprList *pOrderBy;           /* The ORDER BY clause */
@@ -102383,7 +102383,7 @@ multi_select_end:
 
 /*
 ** Code an output subroutine for a coroutine implementation of a
-** SELECT statment.
+** SELECT statement.
 **
 ** The data to be output is contained in pIn->iSdst.  There are
 ** pIn->nSdst columns to be output.  pDest is where the output should
@@ -103184,7 +103184,7 @@ static int flattenSubquery(
   pSubSrc = pSub->pSrc;
   assert( pSubSrc );
   /* Prior to version 3.1.2, when LIMIT and OFFSET had to be simple constants,
-  ** not arbitrary expresssions, we allowed some combining of LIMIT and OFFSET
+  ** not arbitrary expressions, we allowed some combining of LIMIT and OFFSET
   ** because they could be computed at compile-time.  But when LIMIT and OFFSET
   ** became arbitrary expressions, we were forced to add restrictions (13)
   ** and (14). */
@@ -103570,7 +103570,7 @@ static u8 minMaxQuery(AggInfo *pAggInfo, ExprList **ppMinMax){
 
 /*
 ** The select statement passed as the first argument is an aggregate query.
-** The second argment is the associated aggregate-info object. This 
+** The second argument is the associated aggregate-info object. This 
 ** function tests if the SELECT is of the form:
 **
 **   SELECT count(*) FROM 
@@ -103903,7 +103903,7 @@ static void selectPopWith(Walker *pWalker, Select *p){
 **         without worrying about messing up the presistent representation
 **         of the view.
 **
-**    (3)  Add terms to the WHERE clause to accomodate the NATURAL keyword
+**    (3)  Add terms to the WHERE clause to accommodate the NATURAL keyword
 **         on joins and the ON and USING clause of joins.
 **
 **    (4)  Scan the list of columns in the result set (pEList) looking
@@ -104871,7 +104871,7 @@ SQLITE_PRIVATE int sqlite3Select(
     */
     if( pGroupBy ){
       KeyInfo *pKeyInfo;  /* Keying information for the group by clause */
-      int j1;             /* A-vs-B comparision jump */
+      int j1;             /* A-vs-B comparison jump */
       int addrOutputRow;  /* Start of subroutine that outputs a result row */
       int regOutputRow;   /* Return address register for output subroutine */
       int addrSetAbort;   /* Set the abort flag and return */
@@ -107168,7 +107168,7 @@ SQLITE_PRIVATE void sqlite3Update(
   }
 
   /* Populate the array of registers beginning at regNew with the new
-  ** row data. This array is used to check constaints, create the new
+  ** row data. This array is used to check constraints, create the new
   ** table and index records, and as the values for any new.* references
   ** made by triggers.
   **
@@ -107542,7 +107542,7 @@ static int execExecSql(sqlite3 *db, char **pzErrMsg, const char *zSql){
 ** step (3) requires additional temporary disk space approximately equal
 ** to the size of the original database for the rollback journal.
 ** Hence, temporary disk space that is approximately 2x the size of the
-** orginal database is required.  Every page of the database is written
+** original database is required.  Every page of the database is written
 ** approximately 3 times:  Once for step (2) and twice for step (3).
 ** Two writes per page are required in step (3) because the original
 ** database content must be written into the rollback journal prior to
@@ -109122,7 +109122,7 @@ static int whereLoopResize(sqlite3*, WhereLoop*, int);
 ** 1.  Then using those as a basis to compute the N best WherePath objects
 ** of length 2.  And so forth until the length of WherePaths equals the
 ** number of nodes in the FROM clause.  The best (lowest cost) WherePath
-** at the end is the choosen query plan.
+** at the end is the chosen query plan.
 */
 struct WherePath {
   Bitmask maskLoop;     /* Bitmask of all WhereLoop objects in this path */
@@ -110367,7 +110367,7 @@ static void exprAnalyzeOrTerm(
         }
         if( (chngToIN & getMask(&pWInfo->sMaskSet, pOrTerm->leftCursor))==0 ){
           /* This term must be of the form t1.a==t2.b where t2 is in the
-          ** chngToIN set but t1 is not.  This term will be either preceeded
+          ** chngToIN set but t1 is not.  This term will be either preceded
           ** or follwed by an inverted copy (t2.b==t1.a).  Skip this term 
           ** and use its inversion. */
           testcase( pOrTerm->wtFlags & TERM_COPIED );
@@ -111396,7 +111396,7 @@ static void whereKeyStats(
 ** number of rows that the index scan is expected to visit without 
 ** considering the range constraints. If nEq is 0, this is the number of 
 ** rows in the index. Assuming no error occurs, *pnOut is adjusted (reduced)
-** to account for the range contraints pLower and pUpper.
+** to account for the range constraints pLower and pUpper.
 ** 
 ** In the absence of sqlite_stat4 ANALYZE data, or if such data cannot be
 ** used, each range inequality reduces the search space by a factor of 4. 
@@ -114067,7 +114067,7 @@ static int whereLoopAddAll(WhereLoopBuilder *pBuilder){
 ** strict.  With GROUP BY and DISTINCT the only requirement is that
 ** equivalent rows appear immediately adjacent to one another.  GROUP BY
 ** and DISTINT do not require rows to appear in any particular order as long
-** as equivelent rows are grouped together.  Thus for GROUP BY and DISTINCT
+** as equivalent rows are grouped together.  Thus for GROUP BY and DISTINCT
 ** the pOrderBy terms can be matched in any order.  With ORDER BY, the 
 ** pOrderBy terms must be matched in strict left-to-right order.
 */
@@ -119734,7 +119734,7 @@ SQLITE_PRIVATE const char sqlite3IsEbcdicIdChar[];
 **                 a statement.
 **
 **   (4) CREATE    The keyword CREATE has been seen at the beginning of a
-**                 statement, possibly preceeded by EXPLAIN and/or followed by
+**                 statement, possibly preceded by EXPLAIN and/or followed by
 **                 TEMP or TEMPORARY
 **
 **   (5) TRIGGER   We are in the middle of a trigger definition that must be
@@ -119787,7 +119787,7 @@ SQLITE_API int sqlite3_complete(const char *zSql){
   };
 #else
   /* If triggers are not supported by this compile then the statement machine
-  ** used to detect the end of a statement is much simplier
+  ** used to detect the end of a statement is much simpler
   */
   static const u8 trans[3][3] = {
                      /* Token:           */
@@ -124622,7 +124622,7 @@ struct Fts3Table {
 #endif
 
 #ifdef SQLITE_TEST
-  /* True to disable the incremental doclist optimization. This is controled
+  /* True to disable the incremental doclist optimization. This is controlled
   ** by special insert command 'test-no-incr-doclist'.  */
   int bNoIncrDoclist;
 #endif
@@ -124665,7 +124665,7 @@ struct Fts3Cursor {
 
 /*
 ** The Fts3Cursor.eSearch member is always set to one of the following.
-** Actualy, Fts3Cursor.eSearch can be greater than or equal to
+** Actually, Fts3Cursor.eSearch can be greater than or equal to
 ** FTS3_FULLTEXT_SEARCH.  If so, then Fts3Cursor.eSearch - 2 is the index
 ** of the column to be searched.  For example, in
 **
@@ -132785,7 +132785,7 @@ static const char cType[] = {
 **
 ** In these routine, the letters are in reverse order.  So the 'y' rule
 ** is that 'y' is a consonant unless it is followed by another
-** consonent.
+** consonant.
 */
 static int isVowel(const char*);
 static int isConsonant(const char *z){
@@ -132881,7 +132881,7 @@ static int doubleConsonant(const char *z){
 
 /*
 ** Return TRUE if the word ends with three letters which
-** are consonant-vowel-consonent and where the final consonant
+** are consonant-vowel-consonant and where the final consonant
 ** is not 'w', 'x', or 'y'.
 **
 ** The word is reversed here.  So we are really checking the
@@ -132897,7 +132897,7 @@ static int star_oh(const char *z){
 
 /*
 ** If the word ends with zFrom and xCond() is true for the stem
-** of the word that preceeds the zFrom ending, then change the 
+** of the word that precedes the zFrom ending, then change the 
 ** ending to zTo.
 **
 ** The input word *pz and zFrom are both in reverse order.  zTo
@@ -139692,7 +139692,7 @@ SQLITE_PRIVATE int sqlite3Fts3DeferToken(
 /*
 ** SQLite value pRowid contains the rowid of a row that may or may not be
 ** present in the FTS3 table. If it is, delete it and adjust the contents
-** of subsiduary data structures accordingly.
+** of subsidiary data structures accordingly.
 */
 static int fts3DeleteByRowid(
   Fts3Table *p, 
@@ -140399,7 +140399,7 @@ static int fts3StringAppend(
   }
 
   /* If there is insufficient space allocated at StrBuffer.z, use realloc()
-  ** to grow the buffer until so that it is big enough to accomadate the
+  ** to grow the buffer until so that it is big enough to accommodate the
   ** appended data.
   */
   if( pStr->n+nAppend+1>=pStr->nAlloc ){
@@ -141300,7 +141300,7 @@ SQLITE_PRIVATE void sqlite3Fts3Offsets(
     sCtx.iTerm = 0;
     (void)fts3ExprIterate(pCsr->pExpr, fts3ExprTermOffsetInit, (void *)&sCtx);
 
-    /* Retreive the text stored in column iCol. If an SQL NULL is stored 
+    /* Retrieve the text stored in column iCol. If an SQL NULL is stored 
     ** in column iCol, jump immediately to the next iteration of the loop.
     ** If an OOM occurs while retrieving the data (this can happen if SQLite
     ** needs to transform the data from utf-16 to utf-8), return SQLITE_NOMEM 
diff --git a/ext/standard/dir.c b/ext/standard/dir.c
index c64f37c2d61..091ecf03ca7 100644
--- a/ext/standard/dir.c
+++ b/ext/standard/dir.c
@@ -515,7 +515,7 @@ no_results:
 				continue;
 			}
 		}
-		/* we need to do this everytime since GLOB_ONLYDIR does not guarantee that
+		/* we need to do this every time since GLOB_ONLYDIR does not guarantee that
 		 * all directories will be filtered. GNU libc documentation states the
 		 * following: 
 		 * If the information about the type of the file is easily available 
diff --git a/ext/standard/html_tables/ents_html401.txt b/ext/standard/html_tables/ents_html401.txt
index 7e1564b2297..bd3ded9fdec 100644
--- a/ext/standard/html_tables/ents_html401.txt
+++ b/ext/standard/html_tables/ents_html401.txt
@@ -1,4 +1,4 @@
-#039 0027 //artifical; there's no ' in HTML 4.01
+#039 0027 //artificial; there's no ' in HTML 4.01
 nbsp 00A0
 iexcl 00A1
 cent 00A2
diff --git a/ext/standard/image.c b/ext/standard/image.c
index f1910d21919..122e06335a9 100644
--- a/ext/standard/image.c
+++ b/ext/standard/image.c
@@ -460,7 +460,7 @@ static int php_read_APP(php_stream * stream, unsigned int marker, zval *info TSR
 	snprintf(markername, sizeof(markername), "APP%d", marker - M_APP0);
 
 	if (zend_hash_find(Z_ARRVAL_P(info), markername, strlen(markername)+1, (void **) &tmp) == FAILURE) {
-		/* XXX we onyl catch the 1st tag of it's kind! */
+		/* XXX we only catch the 1st tag of it's kind! */
 		add_assoc_stringl(info, markername, buffer, length, 1);
 	}
 
@@ -532,7 +532,7 @@ static struct gfxinfo *php_handle_jpeg (php_stream * stream, zval *info TSRMLS_D
 			case M_APP14:
 			case M_APP15:
 				if (info) {
-					if (!php_read_APP(stream, marker, info TSRMLS_CC)) { /* read all the app markes... */
+					if (!php_read_APP(stream, marker, info TSRMLS_CC)) { /* read all the app marks... */
 						return result;
 					}
 				} else {
diff --git a/ext/standard/scanf.h b/ext/standard/scanf.h
index 9d4acd4a8f8..b1f5772e8a8 100644
--- a/ext/standard/scanf.h
+++ b/ext/standard/scanf.h
@@ -23,7 +23,7 @@
 
 
 #define SCAN_MAX_ARGS   0xFF    /* Maximum number of variable which can be      */
-                                /* passed to (f|s)scanf. This is an artifical   */
+                                /* passed to (f|s)scanf. This is an artificial   */
                                 /* upper limit to keep resources in check and   */
                                 /* minimize the possibility of exploits         */
 
diff --git a/ext/standard/tests/strings/sprintf_variation34.phpt b/ext/standard/tests/strings/sprintf_variation34.phpt
index c6186b67807..8a5cd809d66 100644
--- a/ext/standard/tests/strings/sprintf_variation34.phpt
+++ b/ext/standard/tests/strings/sprintf_variation34.phpt
@@ -29,8 +29,8 @@ $integer_values = array(
   0Xfff,
   0XFA,
   -0x80000000, // max negative integer as hexadecimal
-  0x7fffffff,  // max postive integer as hexadecimal
-  0x7FFFFFFF,  // max postive integer as hexadecimal
+  0x7fffffff,  // max positive integer as hexadecimal
+  0x7FFFFFFF,  // max positive integer as hexadecimal
   0123,        // integer as octal 
   01912,       // should be quivalent to octal 1
   -020000000000, // max negative integer as octal 
diff --git a/ext/standard/tests/strings/sprintf_variation40_64bit.phpt b/ext/standard/tests/strings/sprintf_variation40_64bit.phpt
index da6f37ace4b..029e94c7821 100644
--- a/ext/standard/tests/strings/sprintf_variation40_64bit.phpt
+++ b/ext/standard/tests/strings/sprintf_variation40_64bit.phpt
@@ -25,8 +25,8 @@ $integer_values = array(
   0Xfff,
   0XFA,
   -0x80000000, // max negative integer as hexadecimal
-  0x7fffffff,  // max postive integer as hexadecimal
-  0x7FFFFFFF,  // max postive integer as hexadecimal
+  0x7fffffff,  // max positive integer as hexadecimal
+  0x7FFFFFFF,  // max positive integer as hexadecimal
   0123,        // integer as octal 
   01912,       // should be quivalent to octal 1
   -020000000000, // max negative integer as octal 
diff --git a/ext/xmlrpc/libxmlrpc/xml_to_soap.c b/ext/xmlrpc/libxmlrpc/xml_to_soap.c
index ac103e0616e..61f9834e9d4 100644
--- a/ext/xmlrpc/libxmlrpc/xml_to_soap.c
+++ b/ext/xmlrpc/libxmlrpc/xml_to_soap.c
@@ -243,7 +243,7 @@ XMLRPC_VALUE xml_element_to_SOAP_REQUEST_worker(XMLRPC_REQUEST request,
 		xCurrent = XMLRPC_CreateValueEmpty();
 	}
 
-	/* increment recursion depth guage */
+	/* increment recursion depth gauge */
 	depth ++;
 
 	/* safety first. must have a valid element */
diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c
index a9db166c839..a9a55a8aeff 100644
--- a/ext/zip/php_zip.c
+++ b/ext/zip/php_zip.c
@@ -602,7 +602,7 @@ int php_zip_glob(char *pattern, int pattern_len, long flags, zval *return_value
 
 	array_init(return_value);
 	for (n = 0; n < globbuf.gl_pathc; n++) {
-		/* we need to do this everytime since GLOB_ONLYDIR does not guarantee that
+		/* we need to do this every time since GLOB_ONLYDIR does not guarantee that
 		 * all directories will be filtered. GNU libc documentation states the
 		 * following:
 		 * If the information about the type of the file is easily available
diff --git a/ext/zlib/zlib_filter.c b/ext/zlib/zlib_filter.c
index c8150085465..ec8f6c8e900 100644
--- a/ext/zlib/zlib_filter.c
+++ b/ext/zlib/zlib_filter.c
@@ -391,7 +391,7 @@ static php_stream_filter *php_zlib_filter_create(const char *filtername, zval *f
 					if (zend_hash_find(HASH_OF(filterparams), "level", sizeof("level"), (void**) &tmpzval) == SUCCESS) {
 						tmp = **tmpzval;
 
-						/* Psuedo pass through to catch level validating code */
+						/* Pseudo pass through to catch level validating code */
 						goto factory_setlevel;
 					}
 					break;
diff --git a/ext/zlib/zlib_win32_howto.txt b/ext/zlib/zlib_win32_howto.txt
index a4e01a4845e..e2a2b79cc7d 100644
--- a/ext/zlib/zlib_win32_howto.txt
+++ b/ext/zlib/zlib_win32_howto.txt
@@ -1,7 +1,7 @@
 Rules for building ZLIB
 -----------------------
 
-The zlib project requires the folowing files:
+The zlib project requires the following files:
 
 php_build\zlib\include\zlib.h
 php_build\zlib\include\zconf.h
diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c
index 437d09cf32f..c0b040a6d0c 100644
--- a/sapi/cgi/cgi_main.c
+++ b/sapi/cgi/cgi_main.c
@@ -2273,7 +2273,7 @@ consult the installation file that came with this distribution, or visit \n\
 
 				/* all remaining arguments are part of the query string
 				 * this section of code concatenates all remaining arguments
-				 * into a single string, seperating args with a &
+				 * into a single string, separating args with a &
 				 * this allows command lines like:
 				 *
 				 *  test.php v1=test v2=hello+world!
diff --git a/sapi/cli/php_http_parser.c b/sapi/cli/php_http_parser.c
index d3bc496f4e3..2fc0405499b 100644
--- a/sapi/cli/php_http_parser.c
+++ b/sapi/cli/php_http_parser.c
@@ -1378,7 +1378,7 @@ size_t php_http_parser_execute (php_http_parser *parser,
         /* Here we call the headers_complete callback. This is somewhat
          * different than other callbacks because if the user returns 1, we
          * will interpret that as saying that this message has no body. This
-         * is needed for the annoying case of recieving a response to a HEAD
+         * is needed for the annoying case of receiving a response to a HEAD
          * request.
          */
         if (settings->on_headers_complete) {
diff --git a/sapi/fpm/fpm/fpm_env.c b/sapi/fpm/fpm/fpm_env.c
index 2ff0bdc0e4b..3bdb3463414 100644
--- a/sapi/fpm/fpm/fpm_env.c
+++ b/sapi/fpm/fpm/fpm_env.c
@@ -212,7 +212,7 @@ int fpm_env_init_main() /* {{{ */
 #ifndef HAVE_SETPROCTITLE
 #ifdef __linux__
 	/*
-	 * This piece of code has been inspirated from nginx and pureftpd code, whic
+	 * This piece of code has been inspirated from nginx and pureftpd code, which
 	 * are under BSD licence.
 	 *
 	 * To change the process title in Linux we have to set argv[1] to NULL
diff --git a/sapi/litespeed/lsapilib.c b/sapi/litespeed/lsapilib.c
index aac823fc1c6..c915aec392f 100644
--- a/sapi/litespeed/lsapilib.c
+++ b/sapi/litespeed/lsapilib.c
@@ -2662,7 +2662,7 @@ static void lsapi_check_child_status( long tmCur )
     }
     if ( abs( g_prefork_server->m_iCurChildren - count ) > 1 )
     {
-        fprintf( stderr, "Children tracking is wrong: PID: %d, Cur Childen: %d, count: %d, idle: %d, dying: %d\n", getpid(), 
+        fprintf( stderr, "Children tracking is wrong: PID: %d, Cur Children: %d, count: %d, idle: %d, dying: %d\n", getpid(), 
                 g_prefork_server->m_iCurChildren, count, idle, dying );
 
     }
diff --git a/sapi/nsapi/nsapi-readme.txt b/sapi/nsapi/nsapi-readme.txt
index 54980bf0e0d..10ad9f7eed3 100644
--- a/sapi/nsapi/nsapi-readme.txt
+++ b/sapi/nsapi/nsapi-readme.txt
@@ -1,7 +1,7 @@
 Configuration of your Netscape/iPlanet/Sun Webserver for PHP5
 -----------------------------------------------------------------
 
-These instructions are targetted at Netscape Enterprise Web Server and
+These instructions are targeted at Netscape Enterprise Web Server and
 SUN/Netscape Alliance iPlanet Web Server and the new Sun Java System Webserver.
 On other web servers your milage may vary.
 
diff --git a/sapi/phpdbg/phpdbg.c b/sapi/phpdbg/phpdbg.c
index 6ee41b75868..2f0ed2eab6d 100644
--- a/sapi/phpdbg/phpdbg.c
+++ b/sapi/phpdbg/phpdbg.c
@@ -1580,7 +1580,7 @@ phpdbg_out:
 
 #ifdef _WIN32
 	} __except(phpdbg_exception_handler_win32(xp = GetExceptionInformation())) {
-		phpdbg_error("segfault", "", "Access violation (Segementation fault) encountered\ntrying to abort cleanly...");
+		phpdbg_error("segfault", "", "Access violation (Segmentation fault) encountered\ntrying to abort cleanly...");
 	}
 #endif
 
diff --git a/sapi/phpdbg/xml.md b/sapi/phpdbg/xml.md
index 0556fb24152..b1203eab6fb 100644
--- a/sapi/phpdbg/xml.md
+++ b/sapi/phpdbg/xml.md
@@ -231,7 +231,7 @@ frame
 - internal: has value "internal" when being an internal function call (one cannot inspect that frame)
 
 - being an error: (by type)
- - maxnum: tried to access a frame with a number heigher than existing (or < 0)
+ - maxnum: tried to access a frame with a number higher than existing (or < 0)
 
 ### attributes on <arg> ###
 
@@ -403,7 +403,7 @@ exec
 - command executing and compiling a given file
  - <exec type="unset" context="" />: indicates unsetting of the old context
  - <exec type="unsetops" />: indicates unsetting of the old compiled opcodes
- - <exec type="unchanged" />: same execution context choosen again
+ - <exec type="unchanged" />: same execution context chosen again
  - <exec type="set" context="" />: indicates setting of the new context
 - errors by tag
  - <compile>
@@ -554,7 +554,7 @@ set
 
 ### breaks ###
 
-- generally enables / disables breakpoint functionality silently with no futher xml answer
+- generally enables / disables breakpoint functionality silently with no further xml answer
 - if the boolean switch is omitted, it emits current state in a <setbreaks active="" /> where active is on or off
 
 ### color ###
diff --git a/sapi/thttpd/thttpd_patch b/sapi/thttpd/thttpd_patch
index 33de9214891..f6e45d5f151 100644
--- a/sapi/thttpd/thttpd_patch
+++ b/sapi/thttpd/thttpd_patch
@@ -2059,7 +2059,7 @@ diff -ur thttpd-2.21b/thttpd.c thttpd-2.21b-cool/thttpd.c
 @@ -1519,7 +1697,7 @@
      if ( c->bytes_sent >= c->bytes_to_send )
  	{
- 	/* This conection is finished! */
+ 	/* This connection is finished! */
 -	clear_connection( c, tvP );
 +	clear_connection( c, tvP, 1 );
  	return;
diff --git a/server-tests.php b/server-tests.php
index 688fee485a0..42dc61b3855 100755
--- a/server-tests.php
+++ b/server-tests.php
@@ -961,7 +961,7 @@ class testHarness {
 			if ($just_save_results || strlen(trim($user_input)) == 0 || strtolower($user_input[0]) == 'y') {
 				/*  
 				 * Collect information about the host system for our report
-				 * Fetch phpinfo() output so that we can see the PHP enviroment
+				 * Fetch phpinfo() output so that we can see the PHP environment
 				 * Make an archive of all the failed tests
 				 * Send an email
 				 */

From 06fdf359e3217f795fded77e337d5417426b8d64 Mon Sep 17 00:00:00 2001
From: Veres Lajos 
Date: Thu, 20 Nov 2014 20:00:07 +0000
Subject: [PATCH 060/102] typo fixes - https://github.com/vlajos/misspell_fixer

---
 INSTALL                                       |   2 +-
 README.TESTING2                               |   6 +-
 ext/calendar/julian.c                         |   2 +-
 ext/calendar/tests/unixtojd.phpt              |   4 +-
 ext/date/lib/parse_tz.c                       |   6 +-
 ext/date/tests/002.phpt                       |   2 +-
 ext/date/tests/bug13142.phpt                  |   2 +-
 ext/date/tests/bug26317.phpt                  |   2 +-
 ext/date/tests/bug26320.phpt                  |   2 +-
 ext/fileinfo/fileinfo.php                     |   2 +-
 ext/fileinfo/libmagic/patchlevel.h            |   2 +-
 ext/fileinfo/tests/magic                      |  14 +-
 ext/ftp/ftp.h                                 |   4 +-
 ext/gd/libgd/gd.h                             |   2 +-
 ext/gd/libgd/gd_arc_f_buggy.c                 |   2 +-
 ext/gd/libgd/gdft.c                           |   2 +-
 ext/gd/libgd/webpimg.c                        |   4 +-
 ext/gd/libgd/webpimg.h                        |   2 +-
 ext/interbase/tests/005.phpt                  |   2 +-
 ext/libxml/libxml.c                           |   2 +-
 ext/mbstring/README_PHP3-i18n-ja              |   4 +-
 ext/mbstring/libmbfl/filters/unicode_prop.h   |   2 +-
 ext/mbstring/libmbfl/mbfl/mbfl_consts.h       |   2 +-
 .../tests/mb_strtolower_variation3.phpt       |   2 +-
 .../tests/mb_strtoupper_variation3.phpt       |   2 +-
 ext/mcrypt/tests/mcrypt_ecb_3des_decrypt.phpt |   2 +-
 ext/mcrypt/tests/mcrypt_ecb_3des_encrypt.phpt |   2 +-
 ext/mcrypt/tests/mcrypt_encrypt_3des_cbc.phpt |   4 +-
 ext/mcrypt/tests/mcrypt_encrypt_3des_ecb.phpt |   2 +-
 .../tests/mcrypt_rijndael128_128BitKey.phpt   |   2 +-
 ext/mysqli/tests/mysqli_ps_select_union.phpt  |   4 +-
 .../tests/mysqli_result_references.phpt       |   6 +-
 .../mysqli_result_references_mysqlnd.phpt     |   2 +-
 ...stmt_bind_param_check_param_no_change.phpt |   4 +-
 ext/pcntl/README                              |   2 +-
 ext/pcre/pcrelib/ChangeLog                    |   4 +-
 ext/pcre/pcrelib/HACKING                      |   2 +-
 ext/pcre/pcrelib/README                       |   2 +-
 ext/pcre/pcrelib/doc/pcre.txt                 |   2 +-
 ext/pcre/pcrelib/pcre_exec.c                  |   2 +-
 ext/pcre/pcrelib/pcre_printint.c              |   2 +-
 ext/pcre/pcrelib/pcre_study.c                 |   2 +-
 ext/pcre/pcrelib/pcredemo.c                   |   4 +-
 ext/pcre/pcrelib/sljit/sljitLir.c             |   2 +-
 ext/pcre/pcrelib/sljit/sljitLir.h             |   4 +-
 ext/pcre/pcrelib/sljit/sljitNativeARM_32.c    |   4 +-
 ext/pcre/pcrelib/sljit/sljitNativeTILEGX_64.c |   2 +-
 ext/pdo/pdo_dbh.c                             |   2 +-
 ext/pdo/pdo_stmt.c                            |   2 +-
 ext/pdo/tests/bug_39656.phpt                  |   2 +-
 ext/pdo_mysql/tests/pdo_mysql_stmt_blobs.phpt |   4 +-
 ext/pgsql/README                              |   2 +-
 ext/pgsql/pgsql.c                             |   6 +-
 ext/phar/func_interceptors.c                  |   2 +-
 ext/shmop/README                              |   2 +-
 ext/snmp/snmp.c                               |   8 +-
 ext/soap/TODO.old                             |   2 +-
 ext/soap/interop/client_round2_interop.php    |  18 +--
 ext/soap/package.xml                          |   2 +-
 ext/soap/php_sdl.h                            |   2 +-
 ext/soap/php_soap.h                           |   2 +-
 ext/soap/soap.c                               |  16 +--
 ext/soap/tests/bugs/bug27742.wsdl             |   4 +-
 ext/soap/tests/bugs/bug50698_2.phpt           |   2 +-
 ext/spl/internal/recursivecachingiterator.inc |   2 +-
 ext/spl/spl.php                               |   2 +-
 ...FixedArray_fromarray_param_multiarray.phpt |   2 +-
 ext/spl/tests/bug53071.phpt                   |   2 +-
 ext/sqlite3/libsqlite/sqlite3.c               | 126 +++++++++---------
 ext/standard/dir.c                            |   2 +-
 ext/standard/html_tables/ents_html401.txt     |   2 +-
 ext/standard/image.c                          |   4 +-
 ext/standard/scanf.h                          |   2 +-
 .../tests/strings/sprintf_variation34.phpt    |   4 +-
 .../strings/sprintf_variation40_64bit.phpt    |   4 +-
 ext/xmlrpc/libxmlrpc/xml_to_soap.c            |   2 +-
 ext/zip/php_zip.c                             |   2 +-
 ext/zlib/zlib_filter.c                        |   2 +-
 ext/zlib/zlib_win32_howto.txt                 |   2 +-
 sapi/cgi/cgi_main.c                           |   2 +-
 sapi/cli/php_http_parser.c                    |   2 +-
 sapi/fpm/fpm/fpm_env.c                        |   2 +-
 sapi/litespeed/lsapilib.c                     |   2 +-
 sapi/nsapi/nsapi-readme.txt                   |   2 +-
 sapi/phpdbg/phpdbg.c                          |   2 +-
 sapi/phpdbg/xml.md                            |   6 +-
 sapi/thttpd/thttpd_patch                      |   2 +-
 server-tests.php                              |   2 +-
 88 files changed, 200 insertions(+), 200 deletions(-)

diff --git a/INSTALL b/INSTALL
index 3071f267ae8..935877b9f9f 100644
--- a/INSTALL
+++ b/INSTALL
@@ -155,7 +155,7 @@ Table of Contents
    a  list  of all available options along with short explanations running
    ./configure   --help.   Our  manual  documents  the  different  options
    separately.  You  will find the core options in the appendix, while the
-   different  extension  specific  options  are  descibed on the reference
+   different  extension  specific  options  are  described on the reference
    pages.
 
    When  PHP  is  configured,  you  are  ready  to build the module and/or
diff --git a/README.TESTING2 b/README.TESTING2
index 3c4f1beb29e..34f7e833279 100644
--- a/README.TESTING2
+++ b/README.TESTING2
@@ -8,7 +8,7 @@ the original run-tests.php script.  server-tests is *not* used by
 'make test'.  server-tests was developed to provide support for
 testing PHP under it's primary environment, HTTP, and can run the
 PHP tests under any of the SAPI modules that are direct executables, 
-or are accessable via HTTP.
+or are accessible via HTTP.
 
 [New features]
 ----------------
@@ -95,7 +95,7 @@ include:
   $filename     full native path to file, will become PATH_TRANSLATED
   $filepath     =dirname($filename)
   $scriptname   this is what will become SCRIPT_NAME unless you override it
-  $docroot      the equivelant of DOCUMENT_ROOT under Apache
+  $docroot      the equivalent of DOCUMENT_ROOT under Apache
   $cwd          the directory that the test is being initiated from
   $this->conf   all server-tests configuration vars
   $this->env    all environment variables that will get passed to the test
@@ -105,7 +105,7 @@ include:
 This section is also eval'd, and is similar in nature to --ENV--.  However,
 this section is used to build the url used in an HTTP request.  Valid values
 to set in this section would include:
-  SCRIPT_NAME   The inital part of the request url
+  SCRIPT_NAME   The initial part of the request url
   PATH_INFO     The pathinfo part of a request url
   FRAGMENT      The fragment section of a url (after #)
   QUERY_STRING  The query part of a url (after ?)
diff --git a/ext/calendar/julian.c b/ext/calendar/julian.c
index 659ffc17403..904727ff042 100644
--- a/ext/calendar/julian.c
+++ b/ext/calendar/julian.c
@@ -47,7 +47,7 @@
  *
  * CALENDAR OVERVIEW
  *
- *     Julias Ceasar created the calendar in 46 B.C. as a modified form of
+ *     Julius Caesar created the calendar in 46 B.C. as a modified form of
  *     the old Roman republican calendar which was based on lunar cycles.
  *     The new Julian calendar set fixed lengths for the months, abandoning
  *     the lunar cycle.  It also specified that there would be exactly 12
diff --git a/ext/calendar/tests/unixtojd.phpt b/ext/calendar/tests/unixtojd.phpt
index 4eeb1ca93e3..6183cae9eef 100644
--- a/ext/calendar/tests/unixtojd.phpt
+++ b/ext/calendar/tests/unixtojd.phpt
@@ -21,10 +21,10 @@ putenv('TZ=UTC');
 //		-uses --INI-- section with date.timezone=UTC
 //		-uses putenv('TZ=UTC')
 // date.timezone=UTC
-//		-if ommitted from easter_date.phpt, outputs DATE_TZ_ERRMSG warning
+//		-if omitted from easter_date.phpt, outputs DATE_TZ_ERRMSG warning
 //			-easter_date() calls mktime() and localtime()
 //			-whereas unixtojd(1000000000) calls localtime(1000000000)
-//		-if ommitted from unixtojd.phpt, does NOT output DATE_TZ_ERRMSG
+//		-if omitted from unixtojd.phpt, does NOT output DATE_TZ_ERRMSG
 //
 // unixtojd() calls php_localtime_r() which for Pacific timezone systems, returns a time -8 hours
 //		-this incorrect localtime is passed to the julian date conversion (GregorianToSDN) function which works (probably correctly)
diff --git a/ext/date/lib/parse_tz.c b/ext/date/lib/parse_tz.c
index a503f9e01ec..eb6d0af3102 100644
--- a/ext/date/lib/parse_tz.c
+++ b/ext/date/lib/parse_tz.c
@@ -336,7 +336,7 @@ static ttinfo* fetch_timezone_offset(timelib_tzinfo *tz, timelib_sll ts, timelib
 {
 	uint32_t i;
 
-	/* If there is no transistion time, we pick the first one, if that doesn't
+	/* If there is no transition time, we pick the first one, if that doesn't
 	 * exist we return NULL */
 	if (!tz->timecnt || !tz->trans) {
 		*transition_time = 0;
@@ -346,8 +346,8 @@ static ttinfo* fetch_timezone_offset(timelib_tzinfo *tz, timelib_sll ts, timelib
 		return NULL;
 	}
 
-	/* If the TS is lower than the first transistion time, then we scan over
-	 * all the transistion times to find the first non-DST one, or the first
+	/* If the TS is lower than the first transition time, then we scan over
+	 * all the transition times to find the first non-DST one, or the first
 	 * one in case there are only DST entries. Not sure which smartass came up
 	 * with this idea in the first though :) */
 	if (ts < tz->trans[0]) {
diff --git a/ext/date/tests/002.phpt b/ext/date/tests/002.phpt
index 92d0d5f105c..adbea5e2316 100644
--- a/ext/date/tests/002.phpt
+++ b/ext/date/tests/002.phpt
@@ -3,7 +3,7 @@ strtotime() function
 --SKIPIF--
 
 --FILE--
diff --git a/ext/date/tests/bug13142.phpt b/ext/date/tests/bug13142.phpt
index 5254142baac..5849a94427a 100644
--- a/ext/date/tests/bug13142.phpt
+++ b/ext/date/tests/bug13142.phpt
@@ -8,7 +8,7 @@ if (defined('PHP_WINDOWS_VERSION_MAJOR')) {
 	die("skip. set TZ env is not supported at runtime.");
 }
 if (!@putenv("TZ=US/Eastern") || getenv("TZ") != 'US/Eastern') {
-	die("skip unable to change TZ enviroment variable\n");
+	die("skip unable to change TZ environment variable\n");
 }
 ?>
 --FILE--
diff --git a/ext/date/tests/bug26317.phpt b/ext/date/tests/bug26317.phpt
index 5b79bec525c..27d6ff12500 100644
--- a/ext/date/tests/bug26317.phpt
+++ b/ext/date/tests/bug26317.phpt
@@ -4,7 +4,7 @@ Bug #26317 (military timezone offset signedness)
 date.timezone=GMT0
 --SKIPIF--
 if (!@putenv("TZ=GMT0") || getenv("TZ") != 'GMT0') {
-	die("skip unable to change TZ enviroment variable\n");
+	die("skip unable to change TZ environment variable\n");
 }
 --FILE--
 7	string		x		version %.2s
 # We skip the path here, because it is often long (so file will
 # truncate it) and mostly redundant.
-# The inverted index functionality was added some time betwen
+# The inverted index functionality was added some time between
 # versions 11 and 15, so look for -q if version is above 14:
 >7	string		>14
 >>10	search/100	\ -q\ 		with inverted index
@@ -3972,7 +3972,7 @@
 # .cwk
 0	string	\002\000\210\003\102\117\102\117\000\001\206 Claris works document
 # .plt
-0	string	\020\341\000\000\010\010	Claris Works pallete files .plt
+0	string	\020\341\000\000\010\010	Claris Works palette files .plt
 
 # .msp a dictionary file I am not sure about this I have only one .msp file
 0	string	\002\271\262\000\040\002\000\164	Claris works dictionary
@@ -4443,9 +4443,9 @@
 >6 byte&0x04  =0x8  \b, [4-Scr]
 
 #------------------------------------------------------------------------------
-# gameboy:  file(1) magic for the Nintendo (Color) Gameboy raw ROM format
+# game boy:  file(1) magic for the Nintendo (Color) Game Boy raw ROM format
 #
-0x104 belong 0xCEED6666 Gameboy ROM:
+0x104 belong 0xCEED6666 Game Boy ROM:
 >0x134 string >\0 "%.16s"
 >0x146 byte 0x03  \b,[SGB]
 >0x147 byte 0x00  \b, [ROM ONLY]
@@ -4605,8 +4605,8 @@
 0	string		\x01ZZZZZ\x01	3DO "Opera" file system
 
 # From Gurkan Sengun , www.linuks.mine.nu
-0	string		GBS		Nintendo Gameboy Music/Audio Data
-12	string		GameBoy\ Music\ Module	Nintendo Gameboy Music Module
+0	string		GBS		Nintendo Game Boy Music/Audio Data
+12	string		GameBoy\ Music\ Module	Nintendo Game Boy Music Module
 
 # Playstations Patch Files from: From: Thomas Klausner 
 0	string	PPF30			Playstation Patch File version 3.0
@@ -15279,7 +15279,7 @@
 # $File: oasis,v 1.1 2011/03/15 02:09:38 christos Exp $
 # OASIS
 # Summary: OASIS stream file
-# Long descripton: Open Artwork System Interchange Standard
+# Long description: Open Artwork System Interchange Standard
 # File extension: .oas
 # Full name:	Ben Cowley (bcowley@broadcom.com)
 #		Philip Dixon (pdixon@broadcom.com)
diff --git a/ext/ftp/ftp.h b/ext/ftp/ftp.h
index f2051fe1956..e54eda07900 100644
--- a/ext/ftp/ftp.h
+++ b/ext/ftp/ftp.h
@@ -69,8 +69,8 @@ typedef struct ftpbuf
 	ftptype_t	type;			/* current transfer type */
 	int		pasv;			/* 0=off; 1=pasv; 2=ready */
 	php_sockaddr_storage	pasvaddr;	/* passive mode address */
-	zend_long	timeout_sec;	/* User configureable timeout (seconds) */
-	int			autoseek;	/* User configureable autoseek flag */
+	zend_long	timeout_sec;	/* User configurable timeout (seconds) */
+	int			autoseek;	/* User configurable autoseek flag */
 
 	int				nb;		/* "nonblocking" transfer in progress */
 	databuf_t		*data;	/* Data connection for "nonblocking" transfers */
diff --git a/ext/gd/libgd/gd.h b/ext/gd/libgd/gd.h
index b61d972e80d..0ace31ba034 100644
--- a/ext/gd/libgd/gd.h
+++ b/ext/gd/libgd/gd.h
@@ -782,7 +782,7 @@ int gdImageBrightness(gdImagePtr src, int brightness);
 /* Set the contrast level  for the image  */
 int gdImageContrast(gdImagePtr src, double contrast);
 
-/* Simply adds or substracts respectively red, green or blue to a pixel */
+/* Simply adds or subtracts respectively red, green or blue to a pixel */
 int gdImageColor(gdImagePtr src, const int red, const int green, const int blue, const int alpha);
 
 /* Image convolution by a 3x3 custom matrix */
diff --git a/ext/gd/libgd/gd_arc_f_buggy.c b/ext/gd/libgd/gd_arc_f_buggy.c
index c26e42171a7..ffab5512306 100644
--- a/ext/gd/libgd/gd_arc_f_buggy.c
+++ b/ext/gd/libgd/gd_arc_f_buggy.c
@@ -1,6 +1,6 @@
 /* This is potentially great stuff, but fails against the test
    program at the end. This would probably be much more
-   efficent than the implementation currently in gd.c if the
+   efficient than the implementation currently in gd.c if the
    errors in the output were corrected. TBB */
 
 #if 0
diff --git a/ext/gd/libgd/gdft.c b/ext/gd/libgd/gdft.c
index 4148cf47bb1..763efcf68ca 100644
--- a/ext/gd/libgd/gdft.c
+++ b/ext/gd/libgd/gdft.c
@@ -464,7 +464,7 @@ static void *fontFetch (char **error, void *key)
 		return NULL;
 	}
 
-	/* FIXME - This mapping stuff is imcomplete - where is the spec? */
+	/* FIXME - This mapping stuff is incomplete - where is the spec? */
 	/* EAM   - It's worse than that. It's pointless to match character encodings here.
 	 *         As currently written, the stored a->face->charmap only matches one of
 	 *         the actual charmaps and we cannot know at this stage if it is the right
diff --git a/ext/gd/libgd/webpimg.c b/ext/gd/libgd/webpimg.c
index 01bef93c48c..95a8081e058 100644
--- a/ext/gd/libgd/webpimg.c
+++ b/ext/gd/libgd/webpimg.c
@@ -169,7 +169,7 @@ static inline uint32 get_le32(const uint8* const data) {
  *   Y2/U2/V2: The Y/U/V data of the second image
  *
  * Returns the PSNR (http://en.wikipedia.org/wiki/Peak_signal-to-noise_ratio)
- * value computed bewteen the two images
+ * value computed between the two images
  */
 double GetPSNRYuv(const uint8* Y1,
                   const uint8* U1,
@@ -210,7 +210,7 @@ double GetPSNRYuv(const uint8* Y1,
  *   imgdata: data buffer containing webp image
  *   imgdata_size: size of the imgdata buffer
  *
- * Returns the PSNR value computed bewteen the two images
+ * Returns the PSNR value computed between the two images
  */
 double WebPGetPSNR(const uint8* Y1,
                    const uint8* U1,
diff --git a/ext/gd/libgd/webpimg.h b/ext/gd/libgd/webpimg.h
index db23de5bb24..bc0f9722bd2 100644
--- a/ext/gd/libgd/webpimg.h
+++ b/ext/gd/libgd/webpimg.h
@@ -57,7 +57,7 @@ typedef enum WebPResultType {
  *      3. p_Y/p_U/p_V : pointer to the Y/U/V data buffer (this routine will
  *                       allocate memory for the buffer, fill the buffer with
  *                       appropriate data and transfer owner ship of the buffer
- *                       to caller. Caller is reponsible for freeing the memory).
+ *                       to caller. Caller is responsible for freeing the memory).
  *                       Note that the memory for Y, U, V buffers is alloacted
  *                       in one chunk, hence one should call free(*p_Y) only.
  *                       Do not try to free the U and V buffers.
diff --git a/ext/interbase/tests/005.phpt b/ext/interbase/tests/005.phpt
index c5167c132e4..08b8e53ef30 100644
--- a/ext/interbase/tests/005.phpt
+++ b/ext/interbase/tests/005.phpt
@@ -63,7 +63,7 @@ simple default transaction test without ibase_trans()
 /*
 default transaction on default link
 First open transaction on link will be default.
-$tr_def_l1 may be ommited. All queryes without link and trans
+$tr_def_l1 may be omitted. All queryes without link and trans
 parameters run in this context
 */
     
diff --git a/ext/libxml/libxml.c b/ext/libxml/libxml.c
index d9e92541e92..3e4fb60825e 100644
--- a/ext/libxml/libxml.c
+++ b/ext/libxml/libxml.c
@@ -1143,7 +1143,7 @@ zval *php_libxml_register_export(zend_class_entry *ce, php_libxml_export_node ex
 {
 	php_libxml_func_handler export_hnd;
 	
-	/* Initialize in case this module hasnt been loaded yet */
+	/* Initialize in case this module hasn't been loaded yet */
 	php_libxml_initialize();
 	export_hnd.export_func = export_function;
 
diff --git a/ext/mbstring/README_PHP3-i18n-ja b/ext/mbstring/README_PHP3-i18n-ja
index 869fe3e4958..eabe9e90f25 100644
--- a/ext/mbstring/README_PHP3-i18n-ja
+++ b/ext/mbstring/README_PHP3-i18n-ja
@@ -371,7 +371,7 @@ o i18n.internal_encoding - internal encoding
     encodings, following conditions have to be satisfied in order
     to use them:
        - per byte encoding
-       - single byte charactor in range of 00h-7fh which is compatible 
+       - single byte character in range of 00h-7fh which is compatible 
          with ASCII
        - multibyte without 00h-7fh
     In case of Japanese, EUC-JP and UTF-8 are the only encoding that
@@ -408,7 +408,7 @@ o i18n.script_encoding - script encoding
     entering the script parser.
 
     Be aware that auto detection may fail under some conditions.
-    For best auto detection, add multibyte charactor at beginning of
+    For best auto detection, add multibyte character at beginning of
     script.
 
 
diff --git a/ext/mbstring/libmbfl/filters/unicode_prop.h b/ext/mbstring/libmbfl/filters/unicode_prop.h
index d21ec61dfb1..4feb5756e35 100644
--- a/ext/mbstring/libmbfl/filters/unicode_prop.h
+++ b/ext/mbstring/libmbfl/filters/unicode_prop.h
@@ -22,7 +22,7 @@
  *
  */
 
-/* charactor property table */
+/* character property table */
 #define MBFL_CHP_CTL		0x01
 #define MBFL_CHP_DIGIT		0x02
 #define MBFL_CHP_UALPHA		0x04
diff --git a/ext/mbstring/libmbfl/mbfl/mbfl_consts.h b/ext/mbstring/libmbfl/mbfl/mbfl_consts.h
index 6a630c8fcd8..b11119a80bc 100644
--- a/ext/mbstring/libmbfl/mbfl/mbfl_consts.h
+++ b/ext/mbstring/libmbfl/mbfl/mbfl_consts.h
@@ -45,7 +45,7 @@
 #define MBFL_ENCTYPE_ENC_STRM	0x00002000
 #define MBFL_ENCTYPE_GL_UNSAFE	0x00004000
 
-/* wchar plane, special charactor */
+/* wchar plane, special character */
 #define MBFL_WCSPLANE_MASK			0xffff
 #define MBFL_WCSPLANE_UCS2MAX		0x00010000
 #define MBFL_WCSPLANE_UTF32MAX		0x00110000
diff --git a/ext/mbstring/tests/mb_strtolower_variation3.phpt b/ext/mbstring/tests/mb_strtolower_variation3.phpt
index 08b3467853e..99256e1ec48 100644
--- a/ext/mbstring/tests/mb_strtolower_variation3.phpt
+++ b/ext/mbstring/tests/mb_strtolower_variation3.phpt
@@ -14,7 +14,7 @@ function_exists('mb_strtolower') or die("skip mb_strtolower() is not available i
 
 /*
  * Pass a Japanese string and a mixed Japanese and ASCII string to mb_strtolower
- * to check correct conversion is occuring (Japanese characters should not be converted).
+ * to check correct conversion is occurring (Japanese characters should not be converted).
  */
 
 echo "*** Testing mb_strtolower() : usage variations ***\n";
diff --git a/ext/mbstring/tests/mb_strtoupper_variation3.phpt b/ext/mbstring/tests/mb_strtoupper_variation3.phpt
index a4bf3b128fd..f0cb0fa47c8 100644
--- a/ext/mbstring/tests/mb_strtoupper_variation3.phpt
+++ b/ext/mbstring/tests/mb_strtoupper_variation3.phpt
@@ -14,7 +14,7 @@ function_exists('mb_strtoupper') or die("skip mb_strtoupper() is not available i
 
 /*
  * Pass a Japanese string and a mixed Japanese and ASCII string to mb_strtolower
- * to check correct conversion is occuring (Japanese characters should not be converted).
+ * to check correct conversion is occurring (Japanese characters should not be converted).
  */
 
 echo "*** Testing mb_strtoupper() : usage variations ***\n";
diff --git a/ext/mcrypt/tests/mcrypt_ecb_3des_decrypt.phpt b/ext/mcrypt/tests/mcrypt_ecb_3des_decrypt.phpt
index e718107b9be..ace9f829d89 100644
--- a/ext/mcrypt/tests/mcrypt_ecb_3des_decrypt.phpt
+++ b/ext/mcrypt/tests/mcrypt_ecb_3des_decrypt.phpt
@@ -23,7 +23,7 @@ $cipher = MCRYPT_TRIPLEDES;
 $data = b"This is the secret message which must be encrypted";
 $mode = MCRYPT_DECRYPT;
 
-// tripledes uses keys upto 192 bits (24 bytes)
+// tripledes uses keys up to 192 bits (24 bytes)
 $keys = array(
    b'12345678', 
    b'12345678901234567890', 
diff --git a/ext/mcrypt/tests/mcrypt_ecb_3des_encrypt.phpt b/ext/mcrypt/tests/mcrypt_ecb_3des_encrypt.phpt
index 7e295797793..65ef3ad8e2c 100644
--- a/ext/mcrypt/tests/mcrypt_ecb_3des_encrypt.phpt
+++ b/ext/mcrypt/tests/mcrypt_ecb_3des_encrypt.phpt
@@ -23,7 +23,7 @@ $cipher = MCRYPT_TRIPLEDES;
 $data = b"This is the secret message which must be encrypted";
 $mode = MCRYPT_ENCRYPT;
 
-// tripledes uses keys upto 192 bits (24 bytes)
+// tripledes uses keys up to 192 bits (24 bytes)
 $keys = array(
    b'12345678', 
    b'12345678901234567890', 
diff --git a/ext/mcrypt/tests/mcrypt_encrypt_3des_cbc.phpt b/ext/mcrypt/tests/mcrypt_encrypt_3des_cbc.phpt
index 51a64943b29..8b3cbd83665 100644
--- a/ext/mcrypt/tests/mcrypt_encrypt_3des_cbc.phpt
+++ b/ext/mcrypt/tests/mcrypt_encrypt_3des_cbc.phpt
@@ -21,13 +21,13 @@ echo "*** Testing mcrypt_encrypt() : TripleDES functionality ***\n";
 //test tripledes, aes
 //test different lengths of key, iv
 //test no iv being passed on CBC, ECB 
-//test upto 32 bytes with unlimited strength
+//test up to 32 bytes with unlimited strength
 
 $cipher = MCRYPT_TRIPLEDES;
 $mode = MCRYPT_MODE_CBC;
 $data = b'This is the secret message which must be encrypted';
 
-// tripledes uses keys upto 192 bits (24 bytes)
+// tripledes uses keys up to 192 bits (24 bytes)
 $keys = array(
    b'12345678', 
    b'12345678901234567890', 
diff --git a/ext/mcrypt/tests/mcrypt_encrypt_3des_ecb.phpt b/ext/mcrypt/tests/mcrypt_encrypt_3des_ecb.phpt
index 941eb7935f5..ea6b2c21603 100644
--- a/ext/mcrypt/tests/mcrypt_encrypt_3des_ecb.phpt
+++ b/ext/mcrypt/tests/mcrypt_encrypt_3des_ecb.phpt
@@ -20,7 +20,7 @@ $cipher = MCRYPT_TRIPLEDES;
 $mode = MCRYPT_MODE_ECB;
 $data = b'This is the secret message which must be encrypted';
 
-// tripledes uses keys upto 192 bits (24 bytes)
+// tripledes uses keys up to 192 bits (24 bytes)
 $keys = array(
    b'12345678', 
    b'12345678901234567890', 
diff --git a/ext/mcrypt/tests/mcrypt_rijndael128_128BitKey.phpt b/ext/mcrypt/tests/mcrypt_rijndael128_128BitKey.phpt
index 621f7b1dbd4..5f5a4bea56c 100644
--- a/ext/mcrypt/tests/mcrypt_rijndael128_128BitKey.phpt
+++ b/ext/mcrypt/tests/mcrypt_rijndael128_128BitKey.phpt
@@ -30,7 +30,7 @@ $cipher = MCRYPT_RIJNDAEL_128;
 $mode = MCRYPT_MODE_CBC;
 $data = b'This is the secret message which must be encrypted';
 
-// keys upto 128 bits (16 bytes)
+// keys up to 128 bits (16 bytes)
 $keys = array(
    null, 
    '', 
diff --git a/ext/mysqli/tests/mysqli_ps_select_union.phpt b/ext/mysqli/tests/mysqli_ps_select_union.phpt
index fed81b309dd..a4659c42672 100644
--- a/ext/mysqli/tests/mysqli_ps_select_union.phpt
+++ b/ext/mysqli/tests/mysqli_ps_select_union.phpt
@@ -44,8 +44,8 @@ require_once('skipifconnectfailure.inc');
 	if ($IS_MYSQLND) {
 		/*
 		Advantage mysqlnd -
-		The metadata mysqlnd has availabe after prepare is better than
-		the one made availabe by the MySQL Client Library (libmysql).
+		The metadata mysqlnd has available after prepare is better than
+		the one made available by the MySQL Client Library (libmysql).
 		"libmysql" will give wrong results and that is OK -
 		http://bugs.mysql.com/bug.php?id=47483
 		*/
diff --git a/ext/mysqli/tests/mysqli_result_references.phpt b/ext/mysqli/tests/mysqli_result_references.phpt
index 9b5d476ac45..e0092677548 100644
--- a/ext/mysqli/tests/mysqli_result_references.phpt
+++ b/ext/mysqli/tests/mysqli_result_references.phpt
@@ -19,7 +19,7 @@ require_once('skipifconnectfailure.inc');
 
 	$idx = 0;
 	while ($row = mysqli_fetch_assoc($res)) {
-		/* mysqlnd: force seperation - create copies */
+		/* mysqlnd: force separation - create copies */
 		$references[$idx] = array(
 			'id' 		=> &$row['id'],
 			'label'	=> $row['label'] . '');
@@ -30,7 +30,7 @@ require_once('skipifconnectfailure.inc');
 
 	mysqli_data_seek($res, 0);
 	while ($row = mysqli_fetch_assoc($res)) {
-		/* mysqlnd: force seperation - create copies */
+		/* mysqlnd: force separation - create copies */
 		$references[$idx] = array(
 			'id' 		=> &$row['id'],
 			'label'	=> $row['label'] . '');
@@ -48,7 +48,7 @@ require_once('skipifconnectfailure.inc');
 		printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
 	while ($row = mysqli_fetch_assoc($res)) {
-		/* mysqlnd: force seperation - create copies*/
+		/* mysqlnd: force separation - create copies*/
 		$references[$idx] = array(
 			'id' 		=> &$row['id'],
 			'label'	=> $row['label'] . '');
diff --git a/ext/mysqli/tests/mysqli_result_references_mysqlnd.phpt b/ext/mysqli/tests/mysqli_result_references_mysqlnd.phpt
index 39353652571..60c5491b546 100644
--- a/ext/mysqli/tests/mysqli_result_references_mysqlnd.phpt
+++ b/ext/mysqli/tests/mysqli_result_references_mysqlnd.phpt
@@ -48,7 +48,7 @@ if ((version_compare(PHP_VERSION, '6.0', '==') == 1))
 		$references[$idx]['row_copy'] 	= $rows[$i];
 		$references[$idx]['id_ref'] 		= &$rows[$i]['id'];
 		$references[$idx]['id_copy']		= $rows[$i]['id'];
-		/* enforce seperation */
+		/* enforce separation */
 		$references[$idx]['id_copy_mod']= $rows[$i]['id'] + 0;
 	}
 	mysqli_free_result($res);
diff --git a/ext/mysqli/tests/mysqli_stmt_bind_param_check_param_no_change.phpt b/ext/mysqli/tests/mysqli_stmt_bind_param_check_param_no_change.phpt
index 03d15902af5..e7bce112af5 100644
--- a/ext/mysqli/tests/mysqli_stmt_bind_param_check_param_no_change.phpt
+++ b/ext/mysqli/tests/mysqli_stmt_bind_param_check_param_no_change.phpt
@@ -21,9 +21,9 @@ require_once('skipifconnectfailure.inc');
 
 	echo "Test 1:\n";
 	$stmt = $link->prepare("SELECT ? FOO");
-	var_dump($foo); // here you can see the bar member var beeing a string
+	var_dump($foo); // here you can see the bar member var being a string
 	$stmt->bind_param("s", $foo->bar);
-	var_dump($foo); // this will show $foo->bar beeing a reference string
+	var_dump($foo); // this will show $foo->bar being a reference string
 	$stmt->bind_result($one);
 	$stmt->execute();
 	$stmt->fetch();
diff --git a/ext/pcntl/README b/ext/pcntl/README
index cadd11121c8..7b80924e491 100644
--- a/ext/pcntl/README
+++ b/ext/pcntl/README
@@ -1,7 +1,7 @@
 Process Control Module for PHP (pcntl)
 
 This module will attempt to implement all features related to process spawning and
-control (fork(), waitpid(), signal(), WIF's, etc). This is extremly experimental, 
+control (fork(), waitpid(), signal(), WIF's, etc). This is extremely experimental, 
 with hope to become stable on most UNIX's. I greatly apreciate any feedback, fixes, 
 and or suggestions on how to improve/better implement
 this functionality.
diff --git a/ext/pcre/pcrelib/ChangeLog b/ext/pcre/pcrelib/ChangeLog
index 279398ef402..f07c59787b0 100644
--- a/ext/pcre/pcrelib/ChangeLog
+++ b/ext/pcre/pcrelib/ChangeLog
@@ -1544,7 +1544,7 @@ Version 8.10 25-Jun-2010
 
 7.  Minor change to pcretest.c to avoid a compiler warning.
 
-8.  Added four artifical Unicode properties to help with an option to make
+8.  Added four artificial Unicode properties to help with an option to make
     \s etc use properties (see next item). The new properties are: Xan
     (alphanumeric), Xsp (Perl space), Xps (POSIX space), and Xwd (word).
 
@@ -4169,7 +4169,7 @@ Version 4.3 21-May-03
    (i)   The utf8_table... variables are now declared "const".
 
    (ii)  The code for \cx, which used the "case flipping" table to upper case
-         lower case letters, now just substracts 32. This is ASCII-specific,
+         lower case letters, now just subtracts 32. This is ASCII-specific,
          but the whole concept of \cx is ASCII-specific, so it seems
          reasonable.
 
diff --git a/ext/pcre/pcrelib/HACKING b/ext/pcre/pcrelib/HACKING
index 691b7a14e50..83955042125 100644
--- a/ext/pcre/pcrelib/HACKING
+++ b/ext/pcre/pcrelib/HACKING
@@ -360,7 +360,7 @@ reference number if the reference is to a unique capturing group (either by
 number or by name). When named groups are used, there may be more than one
 group with the same name. In this case, a reference by name generates OP_DNREF
 or OP_DNREFI. These are followed by two counts: the index (not the byte offset) 
-in the group name table of the first entry for the requred name, followed by
+in the group name table of the first entry for the required name, followed by
 the number of groups with the same name.
 
 
diff --git a/ext/pcre/pcrelib/README b/ext/pcre/pcrelib/README
index 88f2dfd4efd..5a1d553fffa 100644
--- a/ext/pcre/pcrelib/README
+++ b/ext/pcre/pcrelib/README
@@ -392,7 +392,7 @@ library. They are also documented in the pcrebuild man page.
   avoided by linking with libedit (which has a BSD licence) instead.
 
   Enabling libreadline causes the -lreadline option to be added to the pcretest
-  build. In many operating environments with a sytem-installed readline
+  build. In many operating environments with a system-installed readline
   library this is sufficient. However, in some environments (e.g. if an
   unmodified distribution version of readline is in use), it may be necessary
   to specify something like LIBS="-lncurses" as well. This is because, to quote
diff --git a/ext/pcre/pcrelib/doc/pcre.txt b/ext/pcre/pcrelib/doc/pcre.txt
index 14cbb8bf2be..548d80b90f0 100644
--- a/ext/pcre/pcrelib/doc/pcre.txt
+++ b/ext/pcre/pcrelib/doc/pcre.txt
@@ -1242,7 +1242,7 @@ PCRETEST OPTION FOR LIBREADLINE SUPPORT
        pcretest linked in this way, there may be licensing issues.
 
        Setting  this  option  causes  the -lreadline option to be added to the
-       pcretest build. In many operating environments with  a  sytem-installed
+       pcretest build. In many operating environments with  a system-installed
        libreadline this is sufficient. However, in some environments (e.g.  if
        an unmodified distribution version of readline is in use),  some  extra
        configuration  may  be necessary. The INSTALL file for libreadline says
diff --git a/ext/pcre/pcrelib/pcre_exec.c b/ext/pcre/pcrelib/pcre_exec.c
index ab58735d5c2..be0af116339 100644
--- a/ext/pcre/pcrelib/pcre_exec.c
+++ b/ext/pcre/pcrelib/pcre_exec.c
@@ -1038,7 +1038,7 @@ for (;;)
     the result of a recursive call to match() whatever happened so it was
     possible to reduce stack usage by turning this into a tail recursion,
     except in the case of a possibly empty group. However, now that there is
-    the possiblity of (*THEN) occurring in the final alternative, this
+    the possibility of (*THEN) occurring in the final alternative, this
     optimization is no longer always possible.
 
     We can optimize if we know there are no (*THEN)s in the pattern; at present
diff --git a/ext/pcre/pcrelib/pcre_printint.c b/ext/pcre/pcrelib/pcre_printint.c
index 8cbb1613958..1a91c500466 100644
--- a/ext/pcre/pcrelib/pcre_printint.c
+++ b/ext/pcre/pcrelib/pcre_printint.c
@@ -68,7 +68,7 @@ appropriately for an application, not for building PCRE. */
 #include "pcre.h"
 #include "pcre_internal.h"
 
-/* These are the funtions that are contained within. It doesn't seem worth
+/* These are the functions that are contained within. It doesn't seem worth
 having a separate .h file just for this. */
 
 #endif /* PCRE_INCLUDED */
diff --git a/ext/pcre/pcrelib/pcre_study.c b/ext/pcre/pcrelib/pcre_study.c
index 2fe43c69202..0e26db9d6c7 100644
--- a/ext/pcre/pcrelib/pcre_study.c
+++ b/ext/pcre/pcrelib/pcre_study.c
@@ -988,7 +988,7 @@ do
       tcode = set_table_bit(start_bits, tcode + 1, TRUE, cd, utf);
       break;
 
-      /* Single-char upto sets the bit and tries the next */
+      /* Single-char up to sets the bit and tries the next */
 
       case OP_UPTO:
       case OP_MINUPTO:
diff --git a/ext/pcre/pcrelib/pcredemo.c b/ext/pcre/pcrelib/pcredemo.c
index 946aba45cdc..1ca77f1537a 100644
--- a/ext/pcre/pcrelib/pcredemo.c
+++ b/ext/pcre/pcrelib/pcredemo.c
@@ -144,7 +144,7 @@ if (rc < 0)
   return 1;
   }
 
-/* Match succeded */
+/* Match succeeded */
 
 printf("\nMatch succeeded at offset %d\n", ovector[0]);
 
@@ -362,7 +362,7 @@ for (;;)
     return 1;
     }
 
-  /* Match succeded */
+  /* Match succeeded */
 
   printf("\nMatch succeeded again at offset %d\n", ovector[0]);
 
diff --git a/ext/pcre/pcrelib/sljit/sljitLir.c b/ext/pcre/pcrelib/sljit/sljitLir.c
index 1acecba8b43..0afce2524a0 100644
--- a/ext/pcre/pcrelib/sljit/sljitLir.c
+++ b/ext/pcre/pcrelib/sljit/sljitLir.c
@@ -1428,7 +1428,7 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_jump* sljit_emit_cmp(struct sljit_compiler
 #endif
 
 	if (SLJIT_UNLIKELY((src1 & SLJIT_IMM) && !(src2 & SLJIT_IMM))) {
-		/* Immediate is prefered as second argument by most architectures. */
+		/* Immediate is preferred as second argument by most architectures. */
 		switch (condition) {
 		case SLJIT_C_LESS:
 			condition = SLJIT_C_GREATER;
diff --git a/ext/pcre/pcrelib/sljit/sljitLir.h b/ext/pcre/pcrelib/sljit/sljitLir.h
index e2cd21846df..9c9acdfe219 100644
--- a/ext/pcre/pcrelib/sljit/sljitLir.h
+++ b/ext/pcre/pcrelib/sljit/sljitLir.h
@@ -90,7 +90,7 @@ of sljitConfigInternal.h */
 #define SLJIT_SUCCESS			0
 /* After the call of sljit_generate_code(), the error code of the compiler
    is set to this value to avoid future sljit calls (in debug mode at least).
-   The complier should be freed after sljit_generate_code(). */
+   The compiler should be freed after sljit_generate_code(). */
 #define SLJIT_ERR_COMPILED		1
 /* Cannot allocate non executable memory. */
 #define SLJIT_ERR_ALLOC_FAILED		2
@@ -898,7 +898,7 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_const* sljit_emit_const(struct sljit_compi
 
 /* After the code generation the address for label, jump and const instructions
    are computed. Since these structures are freed by sljit_free_compiler, the
-   addresses must be preserved by the user program elsewere. */
+   addresses must be preserved by the user program elsewhere. */
 static SLJIT_INLINE sljit_uw sljit_get_label_addr(struct sljit_label *label) { return label->addr; }
 static SLJIT_INLINE sljit_uw sljit_get_jump_addr(struct sljit_jump *jump) { return jump->addr; }
 static SLJIT_INLINE sljit_uw sljit_get_const_addr(struct sljit_const *const_) { return const_->addr; }
diff --git a/ext/pcre/pcrelib/sljit/sljitNativeARM_32.c b/ext/pcre/pcrelib/sljit/sljitNativeARM_32.c
index 6747c4f6174..1342eaebf19 100644
--- a/ext/pcre/pcrelib/sljit/sljitNativeARM_32.c
+++ b/ext/pcre/pcrelib/sljit/sljitNativeARM_32.c
@@ -304,7 +304,7 @@ static sljit_uw patch_pc_relative_loads(sljit_uw *last_pc_patch, sljit_uw *code_
 	return counter;
 }
 
-/* In some rare ocasions we may need future patches. The probability is close to 0 in practice. */
+/* In some rare occasions we may need future patches. The probability is close to 0 in practice. */
 struct future_patch {
 	struct future_patch* next;
 	sljit_si index;
@@ -1205,7 +1205,7 @@ static sljit_si generate_int(struct sljit_compiler *compiler, sljit_si reg, slji
 	sljit_uw imm2;
 	sljit_si rol;
 
-	/* Step1: Search a zero byte (8 continous zero bit). */
+	/* Step1: Search a zero byte (8 continuous zero bit). */
 	mask = 0xff000000;
 	rol = 8;
 	while(1) {
diff --git a/ext/pcre/pcrelib/sljit/sljitNativeTILEGX_64.c b/ext/pcre/pcrelib/sljit/sljitNativeTILEGX_64.c
index d0b392e7a48..548b6c446ff 100644
--- a/ext/pcre/pcrelib/sljit/sljitNativeTILEGX_64.c
+++ b/ext/pcre/pcrelib/sljit/sljitNativeTILEGX_64.c
@@ -1843,7 +1843,7 @@ static SLJIT_INLINE sljit_si emit_single_op(struct sljit_compiler *compiler, slj
 				if (src1 != dst)
 					overflow_ra = reg_map[src1];
 				else {
-					/* Rare ocasion. */
+					/* Rare occasion. */
 					FAIL_IF(ADD(TMP_EREG2, reg_map[src1], ZERO));
 					overflow_ra = TMP_EREG2;
 				}
diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c
index aca52ebf203..8e35c1ee9ad 100644
--- a/ext/pdo/pdo_dbh.c
+++ b/ext/pdo/pdo_dbh.c
@@ -472,7 +472,7 @@ static void pdo_stmt_construct(zend_execute_data *execute_data, pdo_stmt_t *stmt
 }
 /* }}} */
 
-/* {{{ proto object PDO::prepare(string statment [, array options])
+/* {{{ proto object PDO::prepare(string statement [, array options])
    Prepares a statement for execution and returns a statement object */
 static PHP_METHOD(PDO, prepare)
 {
diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c
index dbc98c6e5f3..27cc157ed72 100644
--- a/ext/pdo/pdo_stmt.c
+++ b/ext/pdo/pdo_stmt.c
@@ -2016,7 +2016,7 @@ static PHP_METHOD(PDOStatement, setFetchMode)
 /* }}} */
 
 /* {{{ proto bool PDOStatement::nextRowset()
-   Advances to the next rowset in a multi-rowset statement handle. Returns true if it succeded, false otherwise */
+   Advances to the next rowset in a multi-rowset statement handle. Returns true if it succeeded, false otherwise */
 
 static int pdo_stmt_do_next_rowset(pdo_stmt_t *stmt TSRMLS_DC)
 {
diff --git a/ext/pdo/tests/bug_39656.phpt b/ext/pdo/tests/bug_39656.phpt
index 7d113ef4aab..9ee54916bb2 100644
--- a/ext/pdo/tests/bug_39656.phpt
+++ b/ext/pdo/tests/bug_39656.phpt
@@ -1,5 +1,5 @@
 --TEST--
-PDO Common: Bug #39656 (Crash when calling fetch() on a PDO statment object after closeCursor())
+PDO Common: Bug #39656 (Crash when calling fetch() on a PDO statement object after closeCursor())
 --SKIPIF--
 fetch(PDO::FETCH_ASSOC);
 
 		if ($ret['label'] !== $value) {
-			printf("[%03d + 3] Returned value seems to be wrong (%d vs. %d charachters). Check manually\n",
+			printf("[%03d + 3] Returned value seems to be wrong (%d vs. %d characters). Check manually\n",
 				$offset, strlen($ret['label']), strlen($value));
 			return false;
 		}
diff --git a/ext/pgsql/README b/ext/pgsql/README
index 785b4f034b3..86df804fbde 100644
--- a/ext/pgsql/README
+++ b/ext/pgsql/README
@@ -43,7 +43,7 @@ module with specific version. You need to install PostgreSQL
 somewhere in your system to build PHP with PostgreSQL support.
 
 ==== Note For PostgreSQL 7.2 ====
-I've tested upto 7.2.2.
+I've tested up to 7.2.2.
 
 ==== TODO List ===
 Make pg_convert() smater. 
diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c
index 4b1cc31cc81..119a47f24c3 100644
--- a/ext/pgsql/pgsql.c
+++ b/ext/pgsql/pgsql.c
@@ -1373,7 +1373,7 @@ static void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
 			/* ensure that the link did not die */
 			if (PGG(auto_reset_persistent) & 1) {
 				/* need to send & get something from backend to
-				   make sure we catch CONNECTION_BAD everytime */
+				   make sure we catch CONNECTION_BAD every time */
 				PGresult *pg_result;
 				pg_result = PQexec(le->ptr, "select 1");
 				PQclear(pg_result);
@@ -1478,7 +1478,7 @@ static void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
 		}
 		PGG(num_links)++;
 	}
-	/* set notice processer */
+	/* set notice processor */
 	if (! PGG(ignore_notices) && Z_TYPE_P(return_value) == IS_RESOURCE) {
 		PQsetNoticeProcessor(pgsql, _php_pgsql_notice_handler, (void*)Z_RES_HANDLE_P(return_value));
 	}
@@ -4344,7 +4344,7 @@ PHP_FUNCTION(pg_escape_bytea)
 #endif
 		to = (char *)PQescapeBytea((unsigned char*)from, from_len, &to_len);
 
-	RETVAL_STRINGL(to, to_len-1); /* to_len includes addtional '\0' */
+	RETVAL_STRINGL(to, to_len-1); /* to_len includes additional '\0' */
 }
 /* }}} */
 
diff --git a/ext/phar/func_interceptors.c b/ext/phar/func_interceptors.c
index 6d6cbc4918f..bd7324c78e1 100644
--- a/ext/phar/func_interceptors.c
+++ b/ext/phar/func_interceptors.c
@@ -564,7 +564,7 @@ static void phar_fancy_stat(zend_stat_t *stat_sb, int type, zval *return_value T
 #else
 		ZVAL_LONG(&stat_blocks,-1);
 #endif
-		/* Store numeric indexes in propper order */
+		/* Store numeric indexes in proper order */
 		zend_hash_next_index_insert(HASH_OF(return_value), &stat_dev);
 		zend_hash_next_index_insert(HASH_OF(return_value), &stat_ino);
 		zend_hash_next_index_insert(HASH_OF(return_value), &stat_mode);
diff --git a/ext/shmop/README b/ext/shmop/README
index a8ea03af912..c4970376b0d 100644
--- a/ext/shmop/README
+++ b/ext/shmop/README
@@ -6,7 +6,7 @@ Shared Memory Operations Extension to PHP
 	to communicate the deamon via SHM. PHP already had a shared memory
 	extension (sysvshm) written by Christian Cartus ,
 	unfortunately this extension was designed with PHP only in mind and
-	offers high level features which are extremly bothersome for basic SHM
+	offers high level features which are extremely bothersome for basic SHM
 	we had in mind.  After spending a day trying to reverse engineer and figure
 	out the format of sysvshm we decided that it would be much easier to
 	add our own extension to php for simple SHM operations, we were right :)). 
diff --git a/ext/snmp/snmp.c b/ext/snmp/snmp.c
index 250b1f0ebe4..90c1bff9515 100644
--- a/ext/snmp/snmp.c
+++ b/ext/snmp/snmp.c
@@ -1588,7 +1588,7 @@ PHP_FUNCTION(snmpwalk)
 /* }}} */
 
 /* {{{ proto mixed snmprealwalk(string host, string community, mixed object_id [, int timeout [, int retries]])
-   Return all objects including their respective object id withing the specified one */
+   Return all objects including their respective object id within the specified one */
 PHP_FUNCTION(snmprealwalk)
 {
 	php_snmp(INTERNAL_FUNCTION_PARAM_PASSTHRU, SNMP_CMD_WALK, SNMP_VERSION_1);
@@ -1616,7 +1616,7 @@ PHP_FUNCTION(snmp_get_quick_print)
 /* }}} */
 
 /* {{{ proto bool snmp_set_quick_print(int quick_print)
-   Return all objects including their respective object id withing the specified one */
+   Return all objects including their respective object id within the specified one */
 PHP_FUNCTION(snmp_set_quick_print)
 {
 	zend_long a1;
@@ -1698,7 +1698,7 @@ PHP_FUNCTION(snmp2_walk)
 /* }}} */
 
 /* {{{ proto mixed snmp2_real_walk(string host, string community, mixed object_id [, int timeout [, int retries]])
-   Return all objects including their respective object id withing the specified one */
+   Return all objects including their respective object id within the specified one */
 PHP_FUNCTION(snmp2_real_walk)
 {
 	php_snmp(INTERNAL_FUNCTION_PARAM_PASSTHRU, SNMP_CMD_WALK, SNMP_VERSION_2c);
@@ -1893,7 +1893,7 @@ PHP_METHOD(snmp, getnext)
 /* }}} */
 
 /* {{{ proto mixed SNMP::walk(mixed object_id [, bool $suffix_as_key = FALSE [, int $max_repetitions [, int $non_repeaters]])
-   Return all objects including their respective object id withing the specified one as array of oid->value pairs */
+   Return all objects including their respective object id within the specified one as array of oid->value pairs */
 PHP_METHOD(snmp, walk)
 {
 	php_snmp(INTERNAL_FUNCTION_PARAM_PASSTHRU, SNMP_CMD_WALK, (-1));
diff --git a/ext/soap/TODO.old b/ext/soap/TODO.old
index b219c61f8a3..821dc310724 100644
--- a/ext/soap/TODO.old
+++ b/ext/soap/TODO.old
@@ -18,7 +18,7 @@ when using wsdls and function names are similar find the best match
 	void test(int);
 	void test(string);
 	maybe use the same alogrithim as ext/java.
-investigate further http keep_alive... inital testing proved slower.. maybe php_streams will speed things up..
+investigate further http keep_alive... initial testing proved slower.. maybe php_streams will speed things up..
 provide schema 1999/2001 support....
 through memory leak testing
 possible using shared memory for sdl caching...
diff --git a/ext/soap/interop/client_round2_interop.php b/ext/soap/interop/client_round2_interop.php
index fd5767cc179..bd52f287718 100644
--- a/ext/soap/interop/client_round2_interop.php
+++ b/ext/soap/interop/client_round2_interop.php
@@ -93,7 +93,7 @@ class Interop_Client
     function _fetchEndpoints(&$soapclient, $test) {
         $this->_getEndpoints($test, 1);
 
-        // retreive endpoints from the endpoint server
+        // retrieve endpoints from the endpoint server
         $endpointArray = $soapclient->__soapCall("GetEndpointInfo",array("groupName"=>$test),array('soapaction'=>"http://soapinterop.org/",'uri'=>"http://soapinterop.org/"));
         if (is_soap_fault($endpointArray) || PEAR::isError($endpointArray)) {
             if ($this->html) print "
";
@@ -133,7 +133,7 @@ class Interop_Client
 
     /**
     *  fetchEndpoints
-    * retreive endpoints interop server
+    * retrieve endpoints interop server
     *
     * @return boolean result
     * @access private
@@ -158,7 +158,7 @@ class Interop_Client
             }
             return NULL;
         }
-        // retreive all endpoints now
+        // retrieve all endpoints now
         $this->currentTest = $test;
         $x = $this->_getEndpoints($test);
         return $x;
@@ -166,7 +166,7 @@ class Interop_Client
 
     /**
     *  getEndpoints
-    * retreive endpoints from either database or interop server
+    * retrieve endpoints from either database or interop server
     *
     * @param string base (see local var $tests)
     * @param boolean all (if false, only get valid endpoints, status=1)
@@ -182,7 +182,7 @@ class Interop_Client
 
     /**
     *  _getEndpoints
-    * retreive endpoints from database
+    * retrieve endpoints from database
     *
     * @param string base (see local var $tests)
     * @param boolean all (if false, only get valid endpoints, status=1)
@@ -222,7 +222,7 @@ class Interop_Client
 
     /**
     *  getResults
-    * retreive results from the database, stuff them into the endpoint array
+    * retrieve results from the database, stuff them into the endpoint array
     *
     * @access private
     */
@@ -230,7 +230,7 @@ class Interop_Client
         // be sure we have the right endpoints for this test result
         $this->getEndpoints($test);
 
-        // retreive the results and put them into the endpoint info
+        // retrieve the results and put them into the endpoint info
         $sql = "select * from results where class='$test' and type='$type' and wsdl=$wsdl";
         $results = $this->dbc->getAll($sql,NULL, DB_FETCHMODE_ASSOC );
         foreach ($results as $result) {
@@ -657,12 +657,12 @@ try {
 
     /**
     *  getResults
-    * retreive results from the database, stuff them into the endpoint array
+    * retrieve results from the database, stuff them into the endpoint array
     *
     * @access private
     */
     function getMethodList($test = 'base') {
-        // retreive the results and put them into the endpoint info
+        // retrieve the results and put them into the endpoint info
         $sql = "select distinct(function) from results where class='$test' order by function";
         $results = $this->dbc->getAll($sql);
         $ar = array();
diff --git a/ext/soap/package.xml b/ext/soap/package.xml
index e43fd36024d..6c68f8dd4cd 100644
--- a/ext/soap/package.xml
+++ b/ext/soap/package.xml
@@ -34,7 +34,7 @@
     2002-07-07
     alpha
     
-	- First offical PEAR/PECL release
+	- First official PEAR/PECL release
     
   
   
diff --git a/ext/soap/php_sdl.h b/ext/soap/php_sdl.h
index cf6e26b1794..9ecf40c067e 100644
--- a/ext/soap/php_sdl.h
+++ b/ext/soap/php_sdl.h
@@ -87,7 +87,7 @@ struct _sdlBinding {
 	void           *bindingAttributes; /* sdlSoapBindingPtr */
 };
 
-/* Soap Binding Specfic stuff */
+/* Soap Binding Specific stuff */
 struct _sdlSoapBinding {
 	sdlEncodingStyle  style;
 	sdlTransport      transport; /* not implemented yet */
diff --git a/ext/soap/php_soap.h b/ext/soap/php_soap.h
index 6d367929811..f32555cd936 100644
--- a/ext/soap/php_soap.h
+++ b/ext/soap/php_soap.h
@@ -92,7 +92,7 @@ struct _soapService {
 		zend_class_entry *ce;
 		zval *argv;
 		int argc;
-		int persistance;
+		int persistence;
 	} soap_class;
 
 	zval soap_object;
diff --git a/ext/soap/soap.c b/ext/soap/soap.c
index 94b5cf22a2e..0e7d004564f 100644
--- a/ext/soap/soap.c
+++ b/ext/soap/soap.c
@@ -1259,7 +1259,7 @@ PHP_METHOD(SoapServer, setPersistence)
 		if (service->type == SOAP_CLASS) {
 			if (value == SOAP_PERSISTENCE_SESSION ||
 				value == SOAP_PERSISTENCE_REQUEST) {
-				service->soap_class.persistance = value;
+				service->soap_class.persistence = value;
 			} else {
 				php_error_docref(NULL TSRMLS_CC, E_WARNING, "Tried to set persistence with bogus value (%pd)", value);
 				return;
@@ -1299,7 +1299,7 @@ PHP_METHOD(SoapServer, setClass)
 		service->type = SOAP_CLASS;
 		service->soap_class.ce = ce;
 
-		service->soap_class.persistance = SOAP_PERSISTENCE_REQUEST;
+		service->soap_class.persistence = SOAP_PERSISTENCE_REQUEST;
 		service->soap_class.argc = num_args;
 		if (service->soap_class.argc > 0) {
 			int i;
@@ -1657,7 +1657,7 @@ PHP_METHOD(SoapServer, handle)
 	} else if (service->type == SOAP_CLASS) {
 #if HAVE_PHP_SESSION && !defined(COMPILE_DL_SESSION)
 		/* If persistent then set soap_obj from from the previous created session (if available) */
-		if (service->soap_class.persistance == SOAP_PERSISTENCE_SESSION) {
+		if (service->soap_class.persistence == SOAP_PERSISTENCE_SESSION) {
 			zval *tmp_soap;
 			zval *session_vars;
 
@@ -1741,7 +1741,7 @@ PHP_METHOD(SoapServer, handle)
 			}
 #if HAVE_PHP_SESSION && !defined(COMPILE_DL_SESSION)
 			/* If session then update session hash with new object */
-			if (service->soap_class.persistance == SOAP_PERSISTENCE_SESSION) {
+			if (service->soap_class.persistence == SOAP_PERSISTENCE_SESSION) {
 				zval *tmp_soap_pp;
 				zval *session_vars = &PS(http_session_vars);
 
@@ -1848,7 +1848,7 @@ PHP_METHOD(SoapServer, handle)
 			call_status = call_user_function(NULL, soap_obj, &function_name, &retval, num_params, params TSRMLS_CC);
 			if (service->type == SOAP_CLASS) {
 #if HAVE_PHP_SESSION && !defined(COMPILE_DL_SESSION)
-				if (service->soap_class.persistance != SOAP_PERSISTENCE_SESSION) {
+				if (service->soap_class.persistence != SOAP_PERSISTENCE_SESSION) {
 					zval_ptr_dtor(soap_obj);
 					soap_obj = NULL;
 				}
@@ -1875,7 +1875,7 @@ PHP_METHOD(SoapServer, handle)
 		}
 		if (service->type == SOAP_CLASS) {
 #if HAVE_PHP_SESSION && !defined(COMPILE_DL_SESSION)
-			if (soap_obj && service->soap_class.persistance != SOAP_PERSISTENCE_SESSION) {
+			if (soap_obj && service->soap_class.persistence != SOAP_PERSISTENCE_SESSION) {
 #else
 			if (soap_obj) {
 #endif
@@ -1919,7 +1919,7 @@ PHP_METHOD(SoapServer, handle)
 		}
 		if (service->type == SOAP_CLASS) {
 #if HAVE_PHP_SESSION && !defined(COMPILE_DL_SESSION)
-			if (soap_obj && service->soap_class.persistance != SOAP_PERSISTENCE_SESSION) {
+			if (soap_obj && service->soap_class.persistence != SOAP_PERSISTENCE_SESSION) {
 #else
 			if (soap_obj) {
 #endif
@@ -3113,7 +3113,7 @@ PHP_METHOD(SoapClient, __doRequest)
 
 /* {{{ proto void SoapClient::__setCookie(string name [, strung value])
    Sets cookie thet will sent with SOAP request.
-   The call to this function will effect all folowing calls of SOAP methods.
+   The call to this function will effect all following calls of SOAP methods.
    If value is not specified cookie is removed. */
 PHP_METHOD(SoapClient, __setCookie)
 {
diff --git a/ext/soap/tests/bugs/bug27742.wsdl b/ext/soap/tests/bugs/bug27742.wsdl
index 7f1514acbf3..a9429981c3a 100644
--- a/ext/soap/tests/bugs/bug27742.wsdl
+++ b/ext/soap/tests/bugs/bug27742.wsdl
@@ -726,7 +726,7 @@
 	
 	
 		
-			Containes genre information where available for the program records.  A program may have more than one genre with different relevence factors.
+			Contains genre information where available for the program records.  A program may have more than one genre with different relevance factors.
 		
 		
 			
@@ -749,7 +749,7 @@
 										
 										
 											
-												A relevence factor that applies to the genre classification for the program.  A relevence factor of 1 indicates that this is the top-level genre under which the program is classified.
+												A relevance factor that applies to the genre classification for the program.  A relevance factor of 1 indicates that this is the top-level genre under which the program is classified.
 											
 										
 									
diff --git a/ext/soap/tests/bugs/bug50698_2.phpt b/ext/soap/tests/bugs/bug50698_2.phpt
index a39f4b56bfa..7ff667423ce 100644
--- a/ext/soap/tests/bugs/bug50698_2.phpt
+++ b/ext/soap/tests/bugs/bug50698_2.phpt
@@ -1,5 +1,5 @@
 --TEST--
-Request #50698_2 (SoapClient should handle wsdls with some incompatiable endpoints -- EDGECASE: Large mix of compatiable and incompatiable endpoints.)
+Request #50698_2 (SoapClient should handle wsdls with some incompatiable endpoints -- EDGECASE: Large mix of compatible and incompatiable endpoints.)
 --SKIPIF--
 
 --INI--
diff --git a/ext/spl/internal/recursivecachingiterator.inc b/ext/spl/internal/recursivecachingiterator.inc
index 0676d435f22..cd5d3e31f51 100644
--- a/ext/spl/internal/recursivecachingiterator.inc
+++ b/ext/spl/internal/recursivecachingiterator.inc
@@ -80,7 +80,7 @@ class RecursiveCachingIterator extends CachingIterator implements RecursiveItera
 	/** @return whether the current element has children
 	 * @note The check whether the Iterator for the children can be created was
 	 *       already executed. Hence when flag CATCH_GET_CHILD was given in
-	 *       constructor this fucntion returns false so that getChildren does 
+	 *       constructor this function returns false so that getChildren does 
 	 *       not try to access those children.
 	 */
 	function hasChildren()
diff --git a/ext/spl/spl.php b/ext/spl/spl.php
index c276f1f2eec..ff9d1b6bbe1 100755
--- a/ext/spl/spl.php
+++ b/ext/spl/spl.php
@@ -958,7 +958,7 @@ class SplFileInfo
 	 *
 	 * @param mode              open mode
 	 * @param use_include_path  whether to search include paths (don't use)
-	 * @param context           resource context to pased to open function
+	 * @param context           resource context to passed to open function
 	 * @throw RuntimeException  if file cannot be opened (e.g. insufficient
 	 *                          access rights).
 	 * @return The opened file as a SplFileObject instance
diff --git a/ext/spl/tests/SplFixedArray_fromarray_param_multiarray.phpt b/ext/spl/tests/SplFixedArray_fromarray_param_multiarray.phpt
index f57fe78fb8f..659f61c80d8 100644
--- a/ext/spl/tests/SplFixedArray_fromarray_param_multiarray.phpt
+++ b/ext/spl/tests/SplFixedArray_fromarray_param_multiarray.phpt
@@ -1,5 +1,5 @@
 --TEST--
-Tries to create a SplFixedArray using the fromArray() function and a multi dimentional array.
+Tries to create a SplFixedArray using the fromArray() function and a multi dimensional array.
 --CREDITS--
 Philip Norton philipnorton42@gmail.com
 --FILE--
diff --git a/ext/spl/tests/bug53071.phpt b/ext/spl/tests/bug53071.phpt
index c2c2605e2eb..9d5dac4cd03 100644
--- a/ext/spl/tests/bug53071.phpt
+++ b/ext/spl/tests/bug53071.phpt
@@ -12,7 +12,7 @@ function LimitedScope()
 	$myA = new myClass();
 	$myB = new SplObjectStorage();
 	$myC = new myClass();
-	$myC->member = $myA; // myC has a referece to myA
+	$myC->member = $myA; // myC has a reference to myA
 	$myB->Attach($myC);  // myB attaches myC
 	$myA->member = $myB; // myA has myB, comleting the cycle
 }
diff --git a/ext/sqlite3/libsqlite/sqlite3.c b/ext/sqlite3/libsqlite/sqlite3.c
index e5aa96f6b00..99aeccc46f1 100644
--- a/ext/sqlite3/libsqlite/sqlite3.c
+++ b/ext/sqlite3/libsqlite/sqlite3.c
@@ -10022,7 +10022,7 @@ SQLITE_PRIVATE void sqlite3PCacheSetDefault(void);
 ** shared locks begins at SHARED_FIRST. 
 **
 ** The same locking strategy and
-** byte ranges are used for Unix.  This leaves open the possiblity of having
+** byte ranges are used for Unix.  This leaves open the possibility of having
 ** clients on win95, winNT, and unix all talking to the same shared file
 ** and all locking correctly.  To do so would require that samba (or whatever
 ** tool is being used for file sharing) implements locks correctly between
@@ -11971,7 +11971,7 @@ struct TriggerStep {
   u8 op;               /* One of TK_DELETE, TK_UPDATE, TK_INSERT, TK_SELECT */
   u8 orconf;           /* OE_Rollback etc. */
   Trigger *pTrig;      /* The trigger that this step is a part of */
-  Select *pSelect;     /* SELECT statment or RHS of INSERT INTO .. SELECT ... */
+  Select *pSelect;     /* SELECT statement or RHS of INSERT INTO .. SELECT ... */
   Token target;        /* Target table for DELETE, UPDATE, INSERT */
   Expr *pWhere;        /* The WHERE clause for DELETE or UPDATE steps */
   ExprList *pExprList; /* SET clause for UPDATE. */
@@ -13019,7 +13019,7 @@ SQLITE_PRIVATE   int sqlite3MemdebugNoType(void*,u8);
 **
 *************************************************************************
 **
-** This file contains definitions of global variables and contants.
+** This file contains definitions of global variables and constants.
 */
 
 /* An array to map all upper-case characters into their corresponding
@@ -13908,7 +13908,7 @@ struct Mem {
 #endif
 
 /*
-** Each auxilliary data pointer stored by a user defined function 
+** Each auxiliary data pointer stored by a user defined function 
 ** implementation calling sqlite3_set_auxdata() is stored in an instance
 ** of this structure. All such structures associated with a single VM
 ** are stored in a linked list headed at Vdbe.pAuxData. All are destroyed
@@ -17632,7 +17632,7 @@ SQLITE_PRIVATE const sqlite3_mem_methods *sqlite3MemGetMemsys3(void){
 **   1.  All memory allocations sizes are rounded up to a power of 2.
 **
 **   2.  If two adjacent free blocks are the halves of a larger block,
-**       then the two blocks are coalesed into the single larger block.
+**       then the two blocks are coalesced into the single larger block.
 **
 **   3.  New memory is allocated from the first available free block.
 **
@@ -18570,7 +18570,7 @@ SQLITE_PRIVATE sqlite3_mutex_methods const *sqlite3DefaultMutex(void){
 
 /*
 ** The sqlite3_mutex.id, sqlite3_mutex.nRef, and sqlite3_mutex.owner fields
-** are necessary under two condidtions:  (1) Debug builds and (2) using
+** are necessary under two conditions:  (1) Debug builds and (2) using
 ** home-grown mutexes.  Encapsulate these conditions into a single #define.
 */
 #if defined(SQLITE_DEBUG) || defined(SQLITE_HOMEGROWN_RECURSIVE_MUTEX)
@@ -21904,7 +21904,7 @@ SQLITE_PRIVATE void sqlite3ErrorMsg(Parse *pParse, const char *zFormat, ...){
 ** occur.
 **
 ** 2002-Feb-14: This routine is extended to remove MS-Access style
-** brackets from around identifers.  For example:  "[a-b-c]" becomes
+** brackets from around identifiers.  For example:  "[a-b-c]" becomes
 ** "a-b-c".
 */
 SQLITE_PRIVATE int sqlite3Dequote(char *z){
@@ -22146,7 +22146,7 @@ do_atof_calc:
   /* store the result */
   *pResult = result;
 
-  /* return true if number and no extra non-whitespace chracters after */
+  /* return true if number and no extra non-whitespace characters after */
   return z>=zEnd && nDigits>0 && eValid && nonNum==0;
 #else
   return !sqlite3Atoi64(z, pResult, length, enc);
@@ -22837,7 +22837,7 @@ SQLITE_PRIVATE int sqlite3SafetyCheckSickOrOk(sqlite3 *db){
 }
 
 /*
-** Attempt to add, substract, or multiply the 64-bit signed value iB against
+** Attempt to add, subtract, or multiply the 64-bit signed value iB against
 ** the other 64-bit signed integer at *pA and store the result in *pA.
 ** Return 0 on success.  Or if the operation would have resulted in an
 ** overflow, leave *pA unchanged and return 1.
@@ -26863,7 +26863,7 @@ static int unixRead(
 #endif
 
 #if SQLITE_MAX_MMAP_SIZE>0
-  /* Deal with as much of this read request as possible by transfering
+  /* Deal with as much of this read request as possible by transferring
   ** data from the memory mapping using memcpy().  */
   if( offsetmmapSize ){
     if( offset+amt <= pFile->mmapSize ){
@@ -26998,7 +26998,7 @@ static int unixWrite(
 #endif
 
 #if SQLITE_MAX_MMAP_SIZE>0
-  /* Deal with as much of this write request as possible by transfering
+  /* Deal with as much of this write request as possible by transferring
   ** data from the memory mapping using memcpy().  */
   if( offsetmmapSize ){
     if( offset+amt <= pFile->mmapSize ){
@@ -28557,7 +28557,7 @@ static int unixUnfetch(sqlite3_file *fd, i64 iOff, void *p){
 ** looks at the filesystem type and tries to guess the best locking
 ** strategy from that.
 **
-** For finder-funtion F, two objects are created:
+** For finder-function F, two objects are created:
 **
 **    (1) The real finder-function named "FImpt()".
 **
@@ -29998,7 +29998,7 @@ static int unixGetLastError(sqlite3_vfs *NotUsed, int NotUsed2, char *NotUsed3){
 ** setting the environment variable SQLITE_FORCE_PROXY_LOCKING to 1 will
 ** force proxy locking to be used for every database file opened, and 0
 ** will force automatic proxy locking to be disabled for all database
-** files (explicity calling the SQLITE_SET_LOCKPROXYFILE pragma or
+** files (explicitly calling the SQLITE_SET_LOCKPROXYFILE pragma or
 ** sqlite_file_control API is not affected by SQLITE_FORCE_PROXY_LOCKING).
 */
 
@@ -30529,7 +30529,7 @@ static int proxyTakeConch(unixFile *pFile){
               fprintf(stderr, "fchmod %o FAILED with %d %s\n",
                       cmode, code, strerror(code));
             } else {
-              fprintf(stderr, "fchmod %o SUCCEDED\n",cmode);
+              fprintf(stderr, "fchmod %o SUCCEEDED\n",cmode);
             }
           }else{
             int code = errno;
@@ -33761,7 +33761,7 @@ static int winRead(
            pFile->h, pBuf, amt, offset, pFile->locktype));
 
 #if SQLITE_MAX_MMAP_SIZE>0
-  /* Deal with as much of this read request as possible by transfering
+  /* Deal with as much of this read request as possible by transferring
   ** data from the memory mapping using memcpy().  */
   if( offsetmmapSize ){
     if( offset+amt <= pFile->mmapSize ){
@@ -33833,7 +33833,7 @@ static int winWrite(
            pFile->h, pBuf, amt, offset, pFile->locktype));
 
 #if SQLITE_MAX_MMAP_SIZE>0
-  /* Deal with as much of this write request as possible by transfering
+  /* Deal with as much of this write request as possible by transferring
   ** data from the memory mapping using memcpy().  */
   if( offsetmmapSize ){
     if( offset+amt <= pFile->mmapSize ){
@@ -33965,7 +33965,7 @@ static int winTruncate(sqlite3_file *id, sqlite3_int64 nByte){
 #ifdef SQLITE_TEST
 /*
 ** Count the number of fullsyncs and normal syncs.  This is used to test
-** that syncs and fullsyncs are occuring at the right times.
+** that syncs and fullsyncs are occurring at the right times.
 */
 SQLITE_API int sqlite3_sync_count = 0;
 SQLITE_API int sqlite3_fullsync_count = 0;
@@ -39330,8 +39330,8 @@ SQLITE_PRIVATE int sqlite3RowSetNext(RowSet *p, i64 *pRowid){
 ** Check to see if element iRowid was inserted into the rowset as
 ** part of any insert batch prior to iBatch.  Return 1 or 0.
 **
-** If this is the first test of a new batch and if there exist entires
-** on pRowSet->pEntry, then sort those entires into the forest at
+** If this is the first test of a new batch and if there exist entries
+** on pRowSet->pEntry, then sort those entries into the forest at
 ** pRowSet->pForest so that they can be tested.
 */
 SQLITE_PRIVATE int sqlite3RowSetTest(RowSet *pRowSet, u8 iBatch, sqlite3_int64 iRowid){
@@ -39613,7 +39613,7 @@ SQLITE_PRIVATE int sqlite3WalFramesize(Wal *pWal);
 ** Definition: Two databases (or the same database at two points it time)
 ** are said to be "logically equivalent" if they give the same answer to
 ** all queries.  Note in particular the content of freelist leaf
-** pages can be changed arbitarily without effecting the logical equivalence
+** pages can be changed arbitrarily without effecting the logical equivalence
 ** of the database.
 ** 
 ** (7) At any time, if any subset, including the empty set and the total set,
@@ -39838,7 +39838,7 @@ int sqlite3PagerTrace=1;  /* True to enable tracing */
 **    outstanding transactions have been abandoned, the pager is able to
 **    transition back to OPEN state, discarding the contents of the 
 **    page-cache and any other in-memory state at the same time. Everything
-**    is reloaded from disk (and, if necessary, hot-journal rollback peformed)
+**    is reloaded from disk (and, if necessary, hot-journal rollback performed)
 **    when a read-transaction is next opened on the pager (transitioning
 **    the pager into READER state). At that point the system has recovered 
 **    from the error.
@@ -41196,7 +41196,7 @@ static int writeMasterJournal(Pager *pPager, const char *zMaster){
   }
   pPager->journalOff += (nMaster+20);
 
-  /* If the pager is in peristent-journal mode, then the physical 
+  /* If the pager is in persistent-journal mode, then the physical 
   ** journal-file may extend past the end of the master-journal name
   ** and 8 bytes of magic data just written to the file. This is 
   ** dangerous because the code to rollback a hot-journal file
@@ -41369,7 +41369,7 @@ static void pager_unlock(Pager *pPager){
 
 /*
 ** This function is called whenever an IOERR or FULL error that requires
-** the pager to transition into the ERROR state may ahve occurred.
+** the pager to transition into the ERROR state may have occurred.
 ** The first argument is a pointer to the pager structure, the second 
 ** the error-code about to be returned by a pager API function. The 
 ** value returned is a copy of the second argument to this function. 
@@ -48080,7 +48080,7 @@ SQLITE_PRIVATE int sqlite3WalOpen(
 }
 
 /*
-** Change the size to which the WAL file is trucated on each reset.
+** Change the size to which the WAL file is truncated on each reset.
 */
 SQLITE_PRIVATE void sqlite3WalLimit(Wal *pWal, i64 iLimit){
   if( pWal ) pWal->mxWalSize = iLimit;
@@ -54531,7 +54531,7 @@ SQLITE_PRIVATE int sqlite3BtreeCloseCursor(BtCursor *pCur){
 ** compiler to crash when getCellInfo() is implemented as a macro.
 ** But there is a measureable speed advantage to using the macro on gcc
 ** (when less compiler optimizations like -Os or -O0 are used and the
-** compiler is not doing agressive inlining.)  So we use a real function
+** compiler is not doing aggressive inlining.)  So we use a real function
 ** for MSVC and a macro for everything else.  Ticket #2457.
 */
 #ifndef NDEBUG
@@ -54929,7 +54929,7 @@ static int accessPayload(
 
 /*
 ** Read part of the key associated with cursor pCur.  Exactly
-** "amt" bytes will be transfered into pBuf[].  The transfer
+** "amt" bytes will be transferred into pBuf[].  The transfer
 ** begins at "offset".
 **
 ** The caller must ensure that pCur is pointing to a valid row
@@ -54949,7 +54949,7 @@ SQLITE_PRIVATE int sqlite3BtreeKey(BtCursor *pCur, u32 offset, u32 amt, void *pB
 
 /*
 ** Read part of the data associated with cursor pCur.  Exactly
-** "amt" bytes will be transfered into pBuf[].  The transfer
+** "amt" bytes will be transferred into pBuf[].  The transfer
 ** begins at "offset".
 **
 ** Return SQLITE_OK on success or an error code if anything goes
@@ -62945,7 +62945,7 @@ SQLITE_PRIVATE void sqlite3VdbeRewind(Vdbe *p){
 **
 ** This function may be called exact once on a each virtual machine.
 ** After this routine is called the VM has been "packaged" and is ready
-** to run.  After this routine is called, futher calls to 
+** to run.  After this routine is called, further calls to 
 ** sqlite3VdbeAddOp() functions are prohibited.  This routine disconnects
 ** the Vdbe from the Parse object that helped generate it so that the
 ** the Vdbe becomes an independent entity and the Parse object can be
@@ -62997,7 +62997,7 @@ SQLITE_PRIVATE void sqlite3VdbeMakeReady(
   /* Allocate space for memory registers, SQL variables, VDBE cursors and 
   ** an array to marshal SQL function arguments in.
   */
-  zCsr = (u8*)&p->aOp[p->nOp];            /* Memory avaliable for allocation */
+  zCsr = (u8*)&p->aOp[p->nOp];            /* Memory available for allocation */
   zEnd = (u8*)&p->aOp[pParse->nOpAlloc];  /* First byte past end of zCsr[] */
 
   resolveP2Values(p, &nArg);
@@ -63323,7 +63323,7 @@ static int vdbeCommit(sqlite3 *db, Vdbe *p){
 
   /* The complex case - There is a multi-file write-transaction active.
   ** This requires a master journal file to ensure the transaction is
-  ** committed atomicly.
+  ** committed atomically.
   */
 #ifndef SQLITE_OMIT_DISKIO
   else{
@@ -65560,7 +65560,7 @@ SQLITE_API int sqlite3_value_type(sqlite3_value* pVal){
 ** The following routines are used by user-defined functions to specify
 ** the function result.
 **
-** The setStrOrError() funtion calls sqlite3VdbeMemSetStr() to store the
+** The setStrOrError() function calls sqlite3VdbeMemSetStr() to store the
 ** result as a string or blob but if the string or blob is too large, it
 ** then sets the error code to SQLITE_TOOBIG
 */
@@ -65981,7 +65981,7 @@ SQLITE_API void *sqlite3_aggregate_context(sqlite3_context *p, int nByte){
 }
 
 /*
-** Return the auxilary data pointer, if any, for the iArg'th argument to
+** Return the auxiliary data pointer, if any, for the iArg'th argument to
 ** the user-function defined by pCtx.
 */
 SQLITE_API void *sqlite3_get_auxdata(sqlite3_context *pCtx, int iArg){
@@ -65996,7 +65996,7 @@ SQLITE_API void *sqlite3_get_auxdata(sqlite3_context *pCtx, int iArg){
 }
 
 /*
-** Set the auxilary data pointer and delete function, for the iArg'th
+** Set the auxiliary data pointer and delete function, for the iArg'th
 ** argument to the user-function defined by pCtx. Any previous value is
 ** deleted by calling the delete function specified when it was set.
 */
@@ -75506,7 +75506,7 @@ SQLITE_PRIVATE int sqlite3MemJournalSize(void){
 
 /*
 ** Walk an expression tree.  Invoke the callback once for each node
-** of the expression, while decending.  (In other words, the callback
+** of the expression, while descending.  (In other words, the callback
 ** is invoked before visiting children.)
 **
 ** The return value from the callback should be one of the WRC_*
@@ -77026,7 +77026,7 @@ SQLITE_PRIVATE int sqlite3ResolveExprNames(
 
 /*
 ** Resolve all names in all expressions of a SELECT and in all
-** decendents of the SELECT, including compounds off of p->pPrior,
+** descendants of the SELECT, including compounds off of p->pPrior,
 ** subqueries in expressions, and subqueries used as FROM clause
 ** terms.
 **
@@ -77119,7 +77119,7 @@ SQLITE_PRIVATE void sqlite3ResolveSelfReference(
 ** affinity of that column is returned. Otherwise, 0x00 is returned,
 ** indicating no affinity for the expression.
 **
-** i.e. the WHERE clause expresssions in the following statements all
+** i.e. the WHERE clause expressions in the following statements all
 ** have an affinity:
 **
 ** CREATE TABLE t1(a);
@@ -77835,7 +77835,7 @@ static int exprStructSize(Expr *p){
 ** Note that with flags==EXPRDUP_REDUCE, this routines works on full-size
 ** (unreduced) Expr objects as they or originally constructed by the parser.
 ** During expression analysis, extra information is computed and moved into
-** later parts of teh Expr object and that extra information might get chopped
+** later parts of the Expr object and that extra information might get chopped
 ** off if the expression is reduced.  Note also that it does not work to
 ** make a EXPRDUP_REDUCE copy of a reduced expression.  It is only legal
 ** to reduce a pristine expression tree from the parser.  The implementation
@@ -81503,7 +81503,7 @@ static void renameParentFunc(
 ** ALTER TABLE command. The first argument is the text of a CREATE TRIGGER 
 ** statement. The second is a table name. The table name in the CREATE 
 ** TRIGGER statement is replaced with the third argument and the result 
-** returned. This is analagous to renameTableFunc() above, except for CREATE
+** returned. This is analogous to renameTableFunc() above, except for CREATE
 ** TRIGGER, not CREATE INDEX and CREATE TABLE.
 */
 static void renameTriggerFunc(
@@ -83682,7 +83682,7 @@ static void initAvgEq(Index *pIdx){
       /* Set nSum to the number of distinct (iCol+1) field prefixes that
       ** occur in the stat4 table for this index before pFinal. Set
       ** sumEq to the sum of the nEq values for column iCol for the same
-      ** set (adding the value only once where there exist dupicate 
+      ** set (adding the value only once where there exist duplicate 
       ** prefixes).  */
       for(i=0; i<(pIdx->nSample-1); i++){
         if( aSample[i].anDLt[iCol]!=aSample[i+1].anDLt[iCol] ){
@@ -95333,7 +95333,7 @@ static int xferOptimization(
   }
 #endif
 #ifndef SQLITE_OMIT_FOREIGN_KEY
-  /* Disallow the transfer optimization if the destination table constains
+  /* Disallow the transfer optimization if the destination table contains
   ** any foreign key constraints.  This is more restrictive than necessary.
   ** But the main beneficiary of the transfer optimization is the VACUUM 
   ** command, and the VACUUM command disables foreign key constraints.  So
@@ -96561,7 +96561,7 @@ static int sqlite3LoadExtension(
   ** entry point name "sqlite3_extension_init" was not found, then
   ** construct an entry point name "sqlite3_X_init" where the X is
   ** replaced by the lowercase value of every ASCII alphabetic 
-  ** character in the filename after the last "/" upto the first ".",
+  ** character in the filename after the last "/" up to the first ".",
   ** and eliding the first three characters if they are "lib".  
   ** Examples:
   **
@@ -101878,7 +101878,7 @@ static void generateWithRecursiveQuery(
   int iQueue;                   /* The Queue table */
   int iDistinct = 0;            /* To ensure unique results if UNION */
   int eDest = SRT_Table;        /* How to write to Queue */
-  SelectDest destQueue;         /* SelectDest targetting the Queue table */
+  SelectDest destQueue;         /* SelectDest targeting the Queue table */
   int i;                        /* Loop counter */
   int rc;                       /* Result code */
   ExprList *pOrderBy;           /* The ORDER BY clause */
@@ -102383,7 +102383,7 @@ multi_select_end:
 
 /*
 ** Code an output subroutine for a coroutine implementation of a
-** SELECT statment.
+** SELECT statement.
 **
 ** The data to be output is contained in pIn->iSdst.  There are
 ** pIn->nSdst columns to be output.  pDest is where the output should
@@ -103184,7 +103184,7 @@ static int flattenSubquery(
   pSubSrc = pSub->pSrc;
   assert( pSubSrc );
   /* Prior to version 3.1.2, when LIMIT and OFFSET had to be simple constants,
-  ** not arbitrary expresssions, we allowed some combining of LIMIT and OFFSET
+  ** not arbitrary expressions, we allowed some combining of LIMIT and OFFSET
   ** because they could be computed at compile-time.  But when LIMIT and OFFSET
   ** became arbitrary expressions, we were forced to add restrictions (13)
   ** and (14). */
@@ -103570,7 +103570,7 @@ static u8 minMaxQuery(AggInfo *pAggInfo, ExprList **ppMinMax){
 
 /*
 ** The select statement passed as the first argument is an aggregate query.
-** The second argment is the associated aggregate-info object. This 
+** The second argument is the associated aggregate-info object. This 
 ** function tests if the SELECT is of the form:
 **
 **   SELECT count(*) FROM 
@@ -103903,7 +103903,7 @@ static void selectPopWith(Walker *pWalker, Select *p){
 **         without worrying about messing up the presistent representation
 **         of the view.
 **
-**    (3)  Add terms to the WHERE clause to accomodate the NATURAL keyword
+**    (3)  Add terms to the WHERE clause to accommodate the NATURAL keyword
 **         on joins and the ON and USING clause of joins.
 **
 **    (4)  Scan the list of columns in the result set (pEList) looking
@@ -104871,7 +104871,7 @@ SQLITE_PRIVATE int sqlite3Select(
     */
     if( pGroupBy ){
       KeyInfo *pKeyInfo;  /* Keying information for the group by clause */
-      int j1;             /* A-vs-B comparision jump */
+      int j1;             /* A-vs-B comparison jump */
       int addrOutputRow;  /* Start of subroutine that outputs a result row */
       int regOutputRow;   /* Return address register for output subroutine */
       int addrSetAbort;   /* Set the abort flag and return */
@@ -107168,7 +107168,7 @@ SQLITE_PRIVATE void sqlite3Update(
   }
 
   /* Populate the array of registers beginning at regNew with the new
-  ** row data. This array is used to check constaints, create the new
+  ** row data. This array is used to check constraints, create the new
   ** table and index records, and as the values for any new.* references
   ** made by triggers.
   **
@@ -107542,7 +107542,7 @@ static int execExecSql(sqlite3 *db, char **pzErrMsg, const char *zSql){
 ** step (3) requires additional temporary disk space approximately equal
 ** to the size of the original database for the rollback journal.
 ** Hence, temporary disk space that is approximately 2x the size of the
-** orginal database is required.  Every page of the database is written
+** original database is required.  Every page of the database is written
 ** approximately 3 times:  Once for step (2) and twice for step (3).
 ** Two writes per page are required in step (3) because the original
 ** database content must be written into the rollback journal prior to
@@ -109122,7 +109122,7 @@ static int whereLoopResize(sqlite3*, WhereLoop*, int);
 ** 1.  Then using those as a basis to compute the N best WherePath objects
 ** of length 2.  And so forth until the length of WherePaths equals the
 ** number of nodes in the FROM clause.  The best (lowest cost) WherePath
-** at the end is the choosen query plan.
+** at the end is the chosen query plan.
 */
 struct WherePath {
   Bitmask maskLoop;     /* Bitmask of all WhereLoop objects in this path */
@@ -110367,7 +110367,7 @@ static void exprAnalyzeOrTerm(
         }
         if( (chngToIN & getMask(&pWInfo->sMaskSet, pOrTerm->leftCursor))==0 ){
           /* This term must be of the form t1.a==t2.b where t2 is in the
-          ** chngToIN set but t1 is not.  This term will be either preceeded
+          ** chngToIN set but t1 is not.  This term will be either preceded
           ** or follwed by an inverted copy (t2.b==t1.a).  Skip this term 
           ** and use its inversion. */
           testcase( pOrTerm->wtFlags & TERM_COPIED );
@@ -111396,7 +111396,7 @@ static void whereKeyStats(
 ** number of rows that the index scan is expected to visit without 
 ** considering the range constraints. If nEq is 0, this is the number of 
 ** rows in the index. Assuming no error occurs, *pnOut is adjusted (reduced)
-** to account for the range contraints pLower and pUpper.
+** to account for the range constraints pLower and pUpper.
 ** 
 ** In the absence of sqlite_stat4 ANALYZE data, or if such data cannot be
 ** used, each range inequality reduces the search space by a factor of 4. 
@@ -114067,7 +114067,7 @@ static int whereLoopAddAll(WhereLoopBuilder *pBuilder){
 ** strict.  With GROUP BY and DISTINCT the only requirement is that
 ** equivalent rows appear immediately adjacent to one another.  GROUP BY
 ** and DISTINT do not require rows to appear in any particular order as long
-** as equivelent rows are grouped together.  Thus for GROUP BY and DISTINCT
+** as equivalent rows are grouped together.  Thus for GROUP BY and DISTINCT
 ** the pOrderBy terms can be matched in any order.  With ORDER BY, the 
 ** pOrderBy terms must be matched in strict left-to-right order.
 */
@@ -119734,7 +119734,7 @@ SQLITE_PRIVATE const char sqlite3IsEbcdicIdChar[];
 **                 a statement.
 **
 **   (4) CREATE    The keyword CREATE has been seen at the beginning of a
-**                 statement, possibly preceeded by EXPLAIN and/or followed by
+**                 statement, possibly preceded by EXPLAIN and/or followed by
 **                 TEMP or TEMPORARY
 **
 **   (5) TRIGGER   We are in the middle of a trigger definition that must be
@@ -119787,7 +119787,7 @@ SQLITE_API int sqlite3_complete(const char *zSql){
   };
 #else
   /* If triggers are not supported by this compile then the statement machine
-  ** used to detect the end of a statement is much simplier
+  ** used to detect the end of a statement is much simpler
   */
   static const u8 trans[3][3] = {
                      /* Token:           */
@@ -124622,7 +124622,7 @@ struct Fts3Table {
 #endif
 
 #ifdef SQLITE_TEST
-  /* True to disable the incremental doclist optimization. This is controled
+  /* True to disable the incremental doclist optimization. This is controlled
   ** by special insert command 'test-no-incr-doclist'.  */
   int bNoIncrDoclist;
 #endif
@@ -124665,7 +124665,7 @@ struct Fts3Cursor {
 
 /*
 ** The Fts3Cursor.eSearch member is always set to one of the following.
-** Actualy, Fts3Cursor.eSearch can be greater than or equal to
+** Actually, Fts3Cursor.eSearch can be greater than or equal to
 ** FTS3_FULLTEXT_SEARCH.  If so, then Fts3Cursor.eSearch - 2 is the index
 ** of the column to be searched.  For example, in
 **
@@ -132785,7 +132785,7 @@ static const char cType[] = {
 **
 ** In these routine, the letters are in reverse order.  So the 'y' rule
 ** is that 'y' is a consonant unless it is followed by another
-** consonent.
+** consonant.
 */
 static int isVowel(const char*);
 static int isConsonant(const char *z){
@@ -132881,7 +132881,7 @@ static int doubleConsonant(const char *z){
 
 /*
 ** Return TRUE if the word ends with three letters which
-** are consonant-vowel-consonent and where the final consonant
+** are consonant-vowel-consonant and where the final consonant
 ** is not 'w', 'x', or 'y'.
 **
 ** The word is reversed here.  So we are really checking the
@@ -132897,7 +132897,7 @@ static int star_oh(const char *z){
 
 /*
 ** If the word ends with zFrom and xCond() is true for the stem
-** of the word that preceeds the zFrom ending, then change the 
+** of the word that precedes the zFrom ending, then change the 
 ** ending to zTo.
 **
 ** The input word *pz and zFrom are both in reverse order.  zTo
@@ -139692,7 +139692,7 @@ SQLITE_PRIVATE int sqlite3Fts3DeferToken(
 /*
 ** SQLite value pRowid contains the rowid of a row that may or may not be
 ** present in the FTS3 table. If it is, delete it and adjust the contents
-** of subsiduary data structures accordingly.
+** of subsidiary data structures accordingly.
 */
 static int fts3DeleteByRowid(
   Fts3Table *p, 
@@ -140399,7 +140399,7 @@ static int fts3StringAppend(
   }
 
   /* If there is insufficient space allocated at StrBuffer.z, use realloc()
-  ** to grow the buffer until so that it is big enough to accomadate the
+  ** to grow the buffer until so that it is big enough to accommodate the
   ** appended data.
   */
   if( pStr->n+nAppend+1>=pStr->nAlloc ){
@@ -141300,7 +141300,7 @@ SQLITE_PRIVATE void sqlite3Fts3Offsets(
     sCtx.iTerm = 0;
     (void)fts3ExprIterate(pCsr->pExpr, fts3ExprTermOffsetInit, (void *)&sCtx);
 
-    /* Retreive the text stored in column iCol. If an SQL NULL is stored 
+    /* Retrieve the text stored in column iCol. If an SQL NULL is stored 
     ** in column iCol, jump immediately to the next iteration of the loop.
     ** If an OOM occurs while retrieving the data (this can happen if SQLite
     ** needs to transform the data from utf-16 to utf-8), return SQLITE_NOMEM 
diff --git a/ext/standard/dir.c b/ext/standard/dir.c
index a822ac4da05..6a09ce3af51 100644
--- a/ext/standard/dir.c
+++ b/ext/standard/dir.c
@@ -517,7 +517,7 @@ no_results:
 				continue;
 			}
 		}
-		/* we need to do this everytime since GLOB_ONLYDIR does not guarantee that
+		/* we need to do this every time since GLOB_ONLYDIR does not guarantee that
 		 * all directories will be filtered. GNU libc documentation states the
 		 * following: 
 		 * If the information about the type of the file is easily available 
diff --git a/ext/standard/html_tables/ents_html401.txt b/ext/standard/html_tables/ents_html401.txt
index 7e1564b2297..bd3ded9fdec 100644
--- a/ext/standard/html_tables/ents_html401.txt
+++ b/ext/standard/html_tables/ents_html401.txt
@@ -1,4 +1,4 @@
-#039 0027 //artifical; there's no ' in HTML 4.01
+#039 0027 //artificial; there's no ' in HTML 4.01
 nbsp 00A0
 iexcl 00A1
 cent 00A2
diff --git a/ext/standard/image.c b/ext/standard/image.c
index 54159e37856..adeb1c5be65 100644
--- a/ext/standard/image.c
+++ b/ext/standard/image.c
@@ -461,7 +461,7 @@ static int php_read_APP(php_stream * stream, unsigned int marker, zval *info TSR
 	snprintf(markername, sizeof(markername), "APP%d", marker - M_APP0);
 
 	if ((tmp = zend_hash_str_find(Z_ARRVAL_P(info), markername, strlen(markername))) == NULL) {
-		/* XXX we onyl catch the 1st tag of it's kind! */
+		/* XXX we only catch the 1st tag of it's kind! */
 		add_assoc_stringl(info, markername, buffer, length);
 	}
 
@@ -533,7 +533,7 @@ static struct gfxinfo *php_handle_jpeg (php_stream * stream, zval *info TSRMLS_D
 			case M_APP14:
 			case M_APP15:
 				if (info) {
-					if (!php_read_APP(stream, marker, info TSRMLS_CC)) { /* read all the app markes... */
+					if (!php_read_APP(stream, marker, info TSRMLS_CC)) { /* read all the app marks... */
 						return result;
 					}
 				} else {
diff --git a/ext/standard/scanf.h b/ext/standard/scanf.h
index ddb9803512e..6d9e8a443ca 100644
--- a/ext/standard/scanf.h
+++ b/ext/standard/scanf.h
@@ -23,7 +23,7 @@
 
 
 #define SCAN_MAX_ARGS   0xFF    /* Maximum number of variable which can be      */
-                                /* passed to (f|s)scanf. This is an artifical   */
+                                /* passed to (f|s)scanf. This is an artificial   */
                                 /* upper limit to keep resources in check and   */
                                 /* minimize the possibility of exploits         */
 
diff --git a/ext/standard/tests/strings/sprintf_variation34.phpt b/ext/standard/tests/strings/sprintf_variation34.phpt
index c6186b67807..8a5cd809d66 100644
--- a/ext/standard/tests/strings/sprintf_variation34.phpt
+++ b/ext/standard/tests/strings/sprintf_variation34.phpt
@@ -29,8 +29,8 @@ $integer_values = array(
   0Xfff,
   0XFA,
   -0x80000000, // max negative integer as hexadecimal
-  0x7fffffff,  // max postive integer as hexadecimal
-  0x7FFFFFFF,  // max postive integer as hexadecimal
+  0x7fffffff,  // max positive integer as hexadecimal
+  0x7FFFFFFF,  // max positive integer as hexadecimal
   0123,        // integer as octal 
   01912,       // should be quivalent to octal 1
   -020000000000, // max negative integer as octal 
diff --git a/ext/standard/tests/strings/sprintf_variation40_64bit.phpt b/ext/standard/tests/strings/sprintf_variation40_64bit.phpt
index da6f37ace4b..029e94c7821 100644
--- a/ext/standard/tests/strings/sprintf_variation40_64bit.phpt
+++ b/ext/standard/tests/strings/sprintf_variation40_64bit.phpt
@@ -25,8 +25,8 @@ $integer_values = array(
   0Xfff,
   0XFA,
   -0x80000000, // max negative integer as hexadecimal
-  0x7fffffff,  // max postive integer as hexadecimal
-  0x7FFFFFFF,  // max postive integer as hexadecimal
+  0x7fffffff,  // max positive integer as hexadecimal
+  0x7FFFFFFF,  // max positive integer as hexadecimal
   0123,        // integer as octal 
   01912,       // should be quivalent to octal 1
   -020000000000, // max negative integer as octal 
diff --git a/ext/xmlrpc/libxmlrpc/xml_to_soap.c b/ext/xmlrpc/libxmlrpc/xml_to_soap.c
index ac103e0616e..61f9834e9d4 100644
--- a/ext/xmlrpc/libxmlrpc/xml_to_soap.c
+++ b/ext/xmlrpc/libxmlrpc/xml_to_soap.c
@@ -243,7 +243,7 @@ XMLRPC_VALUE xml_element_to_SOAP_REQUEST_worker(XMLRPC_REQUEST request,
 		xCurrent = XMLRPC_CreateValueEmpty();
 	}
 
-	/* increment recursion depth guage */
+	/* increment recursion depth gauge */
 	depth ++;
 
 	/* safety first. must have a valid element */
diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c
index 4accc22e30f..b50e2406565 100644
--- a/ext/zip/php_zip.c
+++ b/ext/zip/php_zip.c
@@ -556,7 +556,7 @@ int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_v
 
 	array_init(return_value);
 	for (n = 0; n < globbuf.gl_pathc; n++) {
-		/* we need to do this everytime since GLOB_ONLYDIR does not guarantee that
+		/* we need to do this every time since GLOB_ONLYDIR does not guarantee that
 		 * all directories will be filtered. GNU libc documentation states the
 		 * following:
 		 * If the information about the type of the file is easily available
diff --git a/ext/zlib/zlib_filter.c b/ext/zlib/zlib_filter.c
index 45ef2a8f7d7..2f0d1f77067 100644
--- a/ext/zlib/zlib_filter.c
+++ b/ext/zlib/zlib_filter.c
@@ -386,7 +386,7 @@ static php_stream_filter *php_zlib_filter_create(const char *filtername, zval *f
 					if ((tmpzval = zend_hash_str_find(HASH_OF(filterparams), "level", sizeof("level") - 1))) {
 						ZVAL_COPY_VALUE(&tmp, tmpzval);
 
-						/* Psuedo pass through to catch level validating code */
+						/* Pseudo pass through to catch level validating code */
 						goto factory_setlevel;
 					}
 					break;
diff --git a/ext/zlib/zlib_win32_howto.txt b/ext/zlib/zlib_win32_howto.txt
index 0c46a888312..59ff3c4f4c7 100644
--- a/ext/zlib/zlib_win32_howto.txt
+++ b/ext/zlib/zlib_win32_howto.txt
@@ -1,7 +1,7 @@
 Rules for building ZLIB
 -----------------------
 
-The zlib project requires the folowing files:
+The zlib project requires the following files:
 
 php_build\zlib\include\zlib.h
 php_build\zlib\include\zconf.h
diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c
index f06787543e4..2d673217735 100644
--- a/sapi/cgi/cgi_main.c
+++ b/sapi/cgi/cgi_main.c
@@ -2280,7 +2280,7 @@ consult the installation file that came with this distribution, or visit \n\
 
 				/* all remaining arguments are part of the query string
 				 * this section of code concatenates all remaining arguments
-				 * into a single string, seperating args with a &
+				 * into a single string, separating args with a &
 				 * this allows command lines like:
 				 *
 				 *  test.php v1=test v2=hello+world!
diff --git a/sapi/cli/php_http_parser.c b/sapi/cli/php_http_parser.c
index cc649af79a2..31ae4167d19 100644
--- a/sapi/cli/php_http_parser.c
+++ b/sapi/cli/php_http_parser.c
@@ -1378,7 +1378,7 @@ size_t php_http_parser_execute (php_http_parser *parser,
         /* Here we call the headers_complete callback. This is somewhat
          * different than other callbacks because if the user returns 1, we
          * will interpret that as saying that this message has no body. This
-         * is needed for the annoying case of recieving a response to a HEAD
+         * is needed for the annoying case of receiving a response to a HEAD
          * request.
          */
         if (settings->on_headers_complete) {
diff --git a/sapi/fpm/fpm/fpm_env.c b/sapi/fpm/fpm/fpm_env.c
index 2ff0bdc0e4b..3bdb3463414 100644
--- a/sapi/fpm/fpm/fpm_env.c
+++ b/sapi/fpm/fpm/fpm_env.c
@@ -212,7 +212,7 @@ int fpm_env_init_main() /* {{{ */
 #ifndef HAVE_SETPROCTITLE
 #ifdef __linux__
 	/*
-	 * This piece of code has been inspirated from nginx and pureftpd code, whic
+	 * This piece of code has been inspirated from nginx and pureftpd code, which
 	 * are under BSD licence.
 	 *
 	 * To change the process title in Linux we have to set argv[1] to NULL
diff --git a/sapi/litespeed/lsapilib.c b/sapi/litespeed/lsapilib.c
index cf63f6ab1ce..daf0f37f14e 100644
--- a/sapi/litespeed/lsapilib.c
+++ b/sapi/litespeed/lsapilib.c
@@ -2662,7 +2662,7 @@ static void lsapi_check_child_status( long tmCur )
     }
     if ( abs( g_prefork_server->m_iCurChildren - count ) > 1 )
     {
-        fprintf( stderr, "Children tracking is wrong: PID: %d, Cur Childen: %d, count: %d, idle: %d, dying: %d\n", getpid(), 
+        fprintf( stderr, "Children tracking is wrong: PID: %d, Cur Children: %d, count: %d, idle: %d, dying: %d\n", getpid(), 
                 g_prefork_server->m_iCurChildren, count, idle, dying );
 
     }
diff --git a/sapi/nsapi/nsapi-readme.txt b/sapi/nsapi/nsapi-readme.txt
index 812507957ef..6bf4afb83df 100644
--- a/sapi/nsapi/nsapi-readme.txt
+++ b/sapi/nsapi/nsapi-readme.txt
@@ -1,7 +1,7 @@
 Configuration of your Netscape/iPlanet/Sun Webserver for PHP7
 -----------------------------------------------------------------
 
-These instructions are targetted at Netscape Enterprise Web Server and
+These instructions are targeted at Netscape Enterprise Web Server and
 SUN/Netscape Alliance iPlanet Web Server and the new Sun Java System Webserver.
 On other web servers your milage may vary.
 
diff --git a/sapi/phpdbg/phpdbg.c b/sapi/phpdbg/phpdbg.c
index ec65a22f121..c6246697853 100644
--- a/sapi/phpdbg/phpdbg.c
+++ b/sapi/phpdbg/phpdbg.c
@@ -1571,7 +1571,7 @@ phpdbg_out:
 
 #ifdef _WIN32
 	} __except(phpdbg_exception_handler_win32(xp = GetExceptionInformation())) {
-		phpdbg_error("segfault", "", "Access violation (Segementation fault) encountered\ntrying to abort cleanly...");
+		phpdbg_error("segfault", "", "Access violation (Segmentation fault) encountered\ntrying to abort cleanly...");
 	}
 phpdbg_out:
 #endif
diff --git a/sapi/phpdbg/xml.md b/sapi/phpdbg/xml.md
index 7871b313766..56dcaaa1f71 100644
--- a/sapi/phpdbg/xml.md
+++ b/sapi/phpdbg/xml.md
@@ -225,7 +225,7 @@ frame
 - internal: has value "internal" when being an internal function call (one cannot inspect that frame)
 
 - being an error: (by type)
- - maxnum: tried to access a frame with a number heigher than existing (or < 0)
+ - maxnum: tried to access a frame with a number higher than existing (or < 0)
 
 ### attributes on <arg> ###
 
@@ -378,7 +378,7 @@ exec
 - command executing and compiling a given file
  - <exec type="unset" context="" />: indicates unsetting of the old context
  - <exec type="unsetops" />: indicates unsetting of the old compiled opcodes
- - <exec type="unchanged" />: same execution context choosen again
+ - <exec type="unchanged" />: same execution context chosen again
  - <exec type="set" context="" />: indicates setting of the new context
 - errors by tag
  - <compile>
@@ -527,7 +527,7 @@ set
 
 ### breaks ###
 
-- generally enables / disables breakpoint functionality silently with no futher xml answer
+- generally enables / disables breakpoint functionality silently with no further xml answer
 - if the boolean switch is omitted, it emits current state in a <setbreaks active="" /> where active is on or off
 
 ### color ###
diff --git a/sapi/thttpd/thttpd_patch b/sapi/thttpd/thttpd_patch
index 1a9ed29d608..1463d8fe0a5 100644
--- a/sapi/thttpd/thttpd_patch
+++ b/sapi/thttpd/thttpd_patch
@@ -2059,7 +2059,7 @@ diff -ur thttpd-2.21b/thttpd.c thttpd-2.21b-cool/thttpd.c
 @@ -1519,7 +1697,7 @@
      if ( c->bytes_sent >= c->bytes_to_send )
  	{
- 	/* This conection is finished! */
+ 	/* This connection is finished! */
 -	clear_connection( c, tvP );
 +	clear_connection( c, tvP, 1 );
  	return;
diff --git a/server-tests.php b/server-tests.php
index 8666895a960..3c5e36532af 100755
--- a/server-tests.php
+++ b/server-tests.php
@@ -961,7 +961,7 @@ class testHarness {
 			if ($just_save_results || strlen(trim($user_input)) == 0 || strtolower($user_input[0]) == 'y') {
 				/*  
 				 * Collect information about the host system for our report
-				 * Fetch phpinfo() output so that we can see the PHP enviroment
+				 * Fetch phpinfo() output so that we can see the PHP environment
 				 * Make an archive of all the failed tests
 				 * Send an email
 				 */

From dd70a2c7ae2b9c15f8dc0a4bdcdf6f09b6cc721e Mon Sep 17 00:00:00 2001
From: Bob Weinand 
Date: Mon, 24 Nov 2014 00:07:45 +0100
Subject: [PATCH 061/102] Added NEWS entry and test for bug 68446

---
 NEWS                     |  1 +
 Zend/tests/bug68446.phpt | 36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+)
 create mode 100644 Zend/tests/bug68446.phpt

diff --git a/NEWS b/NEWS
index 3a04ddb7290..af4ce9b7572 100644
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,7 @@ PHP                                                                        NEWS
   . Fixed bug #68355 (Inconsistency in example php.ini comments).
     (Chris McCafferty)
   . Fixed bug #68185 ("Inconsistent insteadof definition."- incorrectly triggered). (Julien)
+  . Fixed bug #68446 (Array constant not accepted for array parameter default). (Bob)
 
 - FPM:
   . Fixed bug #68420 (listen=9000 listens to ipv6 localhost instead of all
diff --git a/Zend/tests/bug68446.phpt b/Zend/tests/bug68446.phpt
new file mode 100644
index 00000000000..48e6f52f1cc
--- /dev/null
+++ b/Zend/tests/bug68446.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Bug #68446 (Array constant not accepted for array parameter default)
+--FILE--
+
+--EXPECTF--
+NULL
+array(0) {
+}
+NULL
+array(0) {
+}
+array(1) {
+  [0]=>
+  int(1)
+}
+
+Catchable fatal error: Argument 1 passed to a() must be of the type array, null given, called in %s on line %d and defined in %s on line %d
+

From f652ff054458a65b0e9aa5d7d51a82e980a112c8 Mon Sep 17 00:00:00 2001
From: Dominic Luechinger 
Date: Tue, 18 Nov 2014 22:12:37 +0100
Subject: [PATCH 062/102] Minor fix: Missing quotes in openssl test case for
 bug bug64802

---
 ext/openssl/tests/bug64802.phpt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ext/openssl/tests/bug64802.phpt b/ext/openssl/tests/bug64802.phpt
index be0b5f9b5b0..3a1e4fb03ce 100644
--- a/ext/openssl/tests/bug64802.phpt
+++ b/ext/openssl/tests/bug64802.phpt
@@ -3,7 +3,7 @@ Bug #64802: openssl_x509_parse fails to parse subject properly in some cases
 --SKIPIF--
 
 --FILE--
 
Date: Tue, 18 Nov 2014 22:12:37 +0100
Subject: [PATCH 063/102] Minor fix: Missing quotes in openssl test case for
 bug bug64802

---
 ext/openssl/tests/bug64802.phpt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ext/openssl/tests/bug64802.phpt b/ext/openssl/tests/bug64802.phpt
index be0b5f9b5b0..3a1e4fb03ce 100644
--- a/ext/openssl/tests/bug64802.phpt
+++ b/ext/openssl/tests/bug64802.phpt
@@ -3,7 +3,7 @@ Bug #64802: openssl_x509_parse fails to parse subject properly in some cases
 --SKIPIF--
 
 --FILE--
 
Date: Wed, 5 Nov 2014 19:38:23 +0100
Subject: [PATCH 064/102] Minor: typo fix in filter_var comment

---
 ext/filter/filter.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ext/filter/filter.c b/ext/filter/filter.c
index 4d3899e089e..a408ee30dc8 100644
--- a/ext/filter/filter.c
+++ b/ext/filter/filter.c
@@ -791,7 +791,7 @@ PHP_FUNCTION(filter_input)
 /* }}} */
 
 /* {{{ proto mixed filter_var(mixed variable [, long filter [, mixed options]])
- * Returns the filtered version of the vriable.
+ * Returns the filtered version of the variable.
  */
 PHP_FUNCTION(filter_var)
 {

From 7386b74b075c2a96ef788f0518d8b7aafad91ef5 Mon Sep 17 00:00:00 2001
From: Reeze Xia 
Date: Wed, 8 Oct 2014 23:27:52 +0800
Subject: [PATCH 065/102] Fix php.ini-*'s comment about directive:
 request_order

request_order directive only support register G,P,C but not all of
the EGPCS global variables.

The doc 
is ok.
---
 php.ini-development | 14 +++++++-------
 php.ini-production  | 14 +++++++-------
 2 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/php.ini-development b/php.ini-development
index d29cc808d2a..e0571e567f7 100644
--- a/php.ini-development
+++ b/php.ini-development
@@ -611,13 +611,13 @@ html_errors = On
 ; http://php.net/variables-order
 variables_order = "GPCS"
 
-; This directive determines which super global data (G,P,C,E & S) should
-; be registered into the super global array REQUEST. If so, it also determines
-; the order in which that data is registered. The values for this directive are
-; specified in the same manner as the variables_order directive, EXCEPT one.
-; Leaving this value empty will cause PHP to use the value set in the
-; variables_order directive. It does not mean it will leave the super globals
-; array REQUEST empty.
+; This directive determines which super global data (G,P & C) should be
+; registered into the super global array REQUEST. If so, it also determines
+; the order in which that data is registered. The values for this directive
+; are specified in the same manner as the variables_order directive,
+; EXCEPT one. Leaving this value empty will cause PHP to use the value set
+; in the variables_order directive. It does not mean it will leave the super
+; globals array REQUEST empty.
 ; Default Value: None
 ; Development Value: "GP"
 ; Production Value: "GP"
diff --git a/php.ini-production b/php.ini-production
index d886985b859..c069756f963 100644
--- a/php.ini-production
+++ b/php.ini-production
@@ -611,13 +611,13 @@ html_errors = On
 ; http://php.net/variables-order
 variables_order = "GPCS"
 
-; This directive determines which super global data (G,P,C,E & S) should
-; be registered into the super global array REQUEST. If so, it also determines
-; the order in which that data is registered. The values for this directive are
-; specified in the same manner as the variables_order directive, EXCEPT one.
-; Leaving this value empty will cause PHP to use the value set in the
-; variables_order directive. It does not mean it will leave the super globals
-; array REQUEST empty.
+; This directive determines which super global data (G,P & C) should be
+; registered into the super global array REQUEST. If so, it also determines
+; the order in which that data is registered. The values for this directive
+; are specified in the same manner as the variables_order directive,
+; EXCEPT one. Leaving this value empty will cause PHP to use the value set
+; in the variables_order directive. It does not mean it will leave the super
+; globals array REQUEST empty.
 ; Default Value: None
 ; Development Value: "GP"
 ; Production Value: "GP"

From c7248e6359b4d0a23f4e9210f69258a6443a718b Mon Sep 17 00:00:00 2001
From: Sebastian Brandt 
Date: Mon, 29 Sep 2014 09:53:26 +0200
Subject: [PATCH 066/102] added missing INSTALL_ROOT

---
 ext/phar/Makefile.frag | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ext/phar/Makefile.frag b/ext/phar/Makefile.frag
index faa9db0c706..6516ddfabdd 100644
--- a/ext/phar/Makefile.frag
+++ b/ext/phar/Makefile.frag
@@ -39,7 +39,7 @@ install-pharcmd: pharcmd
 	-@$(mkinstalldirs) $(INSTALL_ROOT)$(bindir)
 	$(INSTALL) $(builddir)/phar.phar $(INSTALL_ROOT)$(bindir)
 	-@rm -f $(INSTALL_ROOT)$(bindir)/phar
-	$(LN_S) -f $(bindir)/phar.phar $(INSTALL_ROOT)$(bindir)/phar
+	$(LN_S) -f $(INSTALL_ROOT)$(bindir)/phar.phar $(INSTALL_ROOT)$(bindir)/phar
 	@$(mkinstalldirs) $(INSTALL_ROOT)$(mandir)/man1
 	@$(INSTALL_DATA) $(builddir)/phar.1 $(INSTALL_ROOT)$(mandir)/man1/phar.1
 	@$(INSTALL_DATA) $(builddir)/phar.phar.1 $(INSTALL_ROOT)$(mandir)/man1/phar.phar.1

From 6d148f7ed97ec55439c378577c4373e03842414e Mon Sep 17 00:00:00 2001
From: Sobak 
Date: Sun, 28 Sep 2014 12:44:40 +0200
Subject: [PATCH 067/102] Update comments in php.ini

---
 php.ini-development | 11 ++++-------
 php.ini-production  | 11 ++++-------
 2 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/php.ini-development b/php.ini-development
index 7e640ad7a9c..726e3025aa5 100644
--- a/php.ini-development
+++ b/php.ini-development
@@ -293,20 +293,17 @@ serialize_precision = 17
 
 ; open_basedir, if set, limits all file operations to the defined directory
 ; and below.  This directive makes most sense if used in a per-directory
-; or per-virtualhost web server configuration file. This directive is
-; *NOT* affected by whether Safe Mode is turned On or Off.
+; or per-virtualhost web server configuration file.
 ; http://php.net/open-basedir
 ;open_basedir =
 
 ; This directive allows you to disable certain functions for security reasons.
-; It receives a comma-delimited list of function names. This directive is
-; *NOT* affected by whether Safe Mode is turned On or Off.
+; It receives a comma-delimited list of function names.
 ; http://php.net/disable-functions
 disable_functions =
 
 ; This directive allows you to disable certain classes for security reasons.
-; It receives a comma-delimited list of class names. This directive is
-; *NOT* affected by whether Safe Mode is turned On or Off.
+; It receives a comma-delimited list of class names.
 ; http://php.net/disable-classes
 disable_classes =
 
@@ -1005,7 +1002,7 @@ smtp_port = 25
 
 ; Force the addition of the specified parameters to be passed as extra parameters
 ; to the sendmail binary. These parameters will always replace the value of
-; the 5th parameter to mail(), even in safe mode.
+; the 5th parameter to mail().
 ;mail.force_extra_parameters =
 
 ; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename
diff --git a/php.ini-production b/php.ini-production
index 74e7ceb761d..7cdd069c446 100644
--- a/php.ini-production
+++ b/php.ini-production
@@ -293,20 +293,17 @@ serialize_precision = 17
 
 ; open_basedir, if set, limits all file operations to the defined directory
 ; and below.  This directive makes most sense if used in a per-directory
-; or per-virtualhost web server configuration file. This directive is
-; *NOT* affected by whether Safe Mode is turned On or Off.
+; or per-virtualhost web server configuration file.
 ; http://php.net/open-basedir
 ;open_basedir =
 
 ; This directive allows you to disable certain functions for security reasons.
-; It receives a comma-delimited list of function names. This directive is
-; *NOT* affected by whether Safe Mode is turned On or Off.
+; It receives a comma-delimited list of function names.
 ; http://php.net/disable-functions
 disable_functions =
 
 ; This directive allows you to disable certain classes for security reasons.
-; It receives a comma-delimited list of class names. This directive is
-; *NOT* affected by whether Safe Mode is turned On or Off.
+; It receives a comma-delimited list of class names.
 ; http://php.net/disable-classes
 disable_classes =
 
@@ -1005,7 +1002,7 @@ smtp_port = 25
 
 ; Force the addition of the specified parameters to be passed as extra parameters
 ; to the sendmail binary. These parameters will always replace the value of
-; the 5th parameter to mail(), even in safe mode.
+; the 5th parameter to mail().
 ;mail.force_extra_parameters =
 
 ; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename

From 05394d6056d0798d8b34f90a4a043572e18b470f Mon Sep 17 00:00:00 2001
From: Stanislav Malyshev 
Date: Sun, 23 Nov 2014 16:18:04 -0800
Subject: [PATCH 068/102] update NEWS

---
 NEWS | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index 8f8fff0b912..275de4dc0ce 100644
--- a/NEWS
+++ b/NEWS
@@ -4,7 +4,10 @@ PHP                                                                        NEWS
 
 - Core:
   . Fixed bug #68370 ("unset($this)" can make the program crash). (Laruence)
-  . Fixed bug #68185 ("Inconsistent insteadof definition."- incorrectly triggered). (Julien)
+  . Fixed bug #68185 ("Inconsistent insteadof definition."- incorrectly 
+    triggered). (Julien)
+  . Fixed bug #68091 (Some Zend headers lack appropriate extern "C" blocks).
+    (Adam)
 
 - FPM:
   . Fixed bug #68420 (listen=9000 listens to ipv6 localhost instead of all

From 03dcf66f9a204a2158a266f5bb739295dfb73ee5 Mon Sep 17 00:00:00 2001
From: Stanislav Malyshev 
Date: Sun, 23 Nov 2014 16:21:53 -0800
Subject: [PATCH 069/102] fix NEWS order

---
 NEWS | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/NEWS b/NEWS
index 275de4dc0ce..1f83b03a4d8 100644
--- a/NEWS
+++ b/NEWS
@@ -3,20 +3,20 @@ PHP                                                                        NEWS
 ?? ??? 2014, PHP 5.5.20
 
 - Core:
-  . Fixed bug #68370 ("unset($this)" can make the program crash). (Laruence)
-  . Fixed bug #68185 ("Inconsistent insteadof definition."- incorrectly 
-    triggered). (Julien)
   . Fixed bug #68091 (Some Zend headers lack appropriate extern "C" blocks).
     (Adam)
+  . Fixed bug #68185 ("Inconsistent insteadof definition."- incorrectly 
+    triggered). (Julien)
+  . Fixed bug #68370 ("unset($this)" can make the program crash). (Laruence)
 
 - FPM:
+  . Fixed bug #68381 (fpm_unix_init_main ignores log_level).
+    (David Zuelke, Remi)
   . Fixed bug #68420 (listen=9000 listens to ipv6 localhost instead of all
     addresses). (Remi)
   . Fixed bug #68421 (access.format='%R' doesn't log ipv6 address). (Remi)
   . Fixed bug #68423 (PHP-FPM will no longer load all pools). (Remi)
   . Fixed bug #68428 (listen.allowed_clients is IPv4 only). (Remi)
-  . Fixed bug #68381 (fpm_unix_init_main ignores log_level).
-    (David Zuelke, Remi)
   . Fixed bug #68452 (php-fpm man page is oudated). (Remi)
   . Fixed request #68458 (Change pm.start_servers default warning to
     notice). (David Zuelke, Remi)

From a023e032b952ad464bc994f3a68b6273ff26bf28 Mon Sep 17 00:00:00 2001
From: Alexander Lisachenko 
Date: Fri, 14 Nov 2014 15:36:56 +0300
Subject: [PATCH 070/102] Fix incorrect argument reflection info for
 array_multisort()

---
 ext/standard/basic_functions.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index 694ce5be27f..c6fe61dd55f 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -549,12 +549,9 @@ ZEND_END_ARG_INFO()
 
 ZEND_BEGIN_ARG_INFO_EX(arginfo_array_multisort, 0, 0, 1)
 	ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, arr1) /* ARRAY_INFO(0, arg1, 0) */
-	ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, SORT_ASC_or_SORT_DESC)
-	ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, SORT_REGULAR_or_SORT_NUMERIC_or_SORT_STRING)
-	ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, arr2)
-	ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, SORT_ASC_or_SORT_DESC)
-	ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, SORT_REGULAR_or_SORT_NUMERIC_or_SORT_STRING)
-	ZEND_ARG_VARIADIC_INFO(ZEND_SEND_PREFER_REF, more_array_and_sort_options)
+	ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, sort_order)
+	ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, sort_flags)
+	ZEND_ARG_VARIADIC_INFO(ZEND_SEND_PREFER_REF, arr2)
 ZEND_END_ARG_INFO()
 
 ZEND_BEGIN_ARG_INFO_EX(arginfo_array_rand, 0, 0, 1)

From a5aae1b66cc11433a8b55cb04a9e9857a98a6b62 Mon Sep 17 00:00:00 2001
From: Alexander Lisachenko 
Date: Fri, 14 Nov 2014 15:36:56 +0300
Subject: [PATCH 071/102] Fix incorrect argument reflection info for
 array_multisort()

---
 .../ReflectionParameter_canBePassedByValue.phpt  | 16 ++--------------
 ext/standard/basic_functions.c                   |  9 +++------
 2 files changed, 5 insertions(+), 20 deletions(-)

diff --git a/ext/reflection/tests/ReflectionParameter_canBePassedByValue.phpt b/ext/reflection/tests/ReflectionParameter_canBePassedByValue.phpt
index 4772f6548dc..5655d19972a 100644
--- a/ext/reflection/tests/ReflectionParameter_canBePassedByValue.phpt
+++ b/ext/reflection/tests/ReflectionParameter_canBePassedByValue.phpt
@@ -41,11 +41,11 @@ Name: arr1
 Is passed by reference: yes
 Can be passed by value: yes
 
-Name: SORT_ASC_or_SORT_DESC
+Name: sort_order
 Is passed by reference: yes
 Can be passed by value: yes
 
-Name: SORT_REGULAR_or_SORT_NUMERIC_or_SORT_STRING
+Name: sort_flags
 Is passed by reference: yes
 Can be passed by value: yes
 
@@ -53,18 +53,6 @@ Name: arr2
 Is passed by reference: yes
 Can be passed by value: yes
 
-Name: SORT_ASC_or_SORT_DESC
-Is passed by reference: yes
-Can be passed by value: yes
-
-Name: SORT_REGULAR_or_SORT_NUMERIC_or_SORT_STRING
-Is passed by reference: yes
-Can be passed by value: yes
-
-Name: more_array_and_sort_options
-Is passed by reference: yes
-Can be passed by value: yes
-
 => sort:
 
 Name: arg
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index 694ce5be27f..c6fe61dd55f 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -549,12 +549,9 @@ ZEND_END_ARG_INFO()
 
 ZEND_BEGIN_ARG_INFO_EX(arginfo_array_multisort, 0, 0, 1)
 	ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, arr1) /* ARRAY_INFO(0, arg1, 0) */
-	ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, SORT_ASC_or_SORT_DESC)
-	ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, SORT_REGULAR_or_SORT_NUMERIC_or_SORT_STRING)
-	ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, arr2)
-	ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, SORT_ASC_or_SORT_DESC)
-	ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, SORT_REGULAR_or_SORT_NUMERIC_or_SORT_STRING)
-	ZEND_ARG_VARIADIC_INFO(ZEND_SEND_PREFER_REF, more_array_and_sort_options)
+	ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, sort_order)
+	ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, sort_flags)
+	ZEND_ARG_VARIADIC_INFO(ZEND_SEND_PREFER_REF, arr2)
 ZEND_END_ARG_INFO()
 
 ZEND_BEGIN_ARG_INFO_EX(arginfo_array_rand, 0, 0, 1)

From de075d172c1fe218e1a7a5c2dbd5fa84f9af0e1d Mon Sep 17 00:00:00 2001
From: Stanislav Malyshev 
Date: Sun, 23 Nov 2014 16:39:52 -0800
Subject: [PATCH 072/102] update NEWS

---
 NEWS | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index 3f888916896..90c67fe29f5 100644
--- a/NEWS
+++ b/NEWS
@@ -7,10 +7,13 @@ PHP                                                                        NEWS
     (Adam)
   . Fixed bug #68104 (Segfault while pre-evaluating a disabled function).
     (Laruence)
-  . Fixed bug #68185 ("Inconsistent insteadof definition."- incorrectly triggered). (Julien)
+  . Fixed bug #68185 ("Inconsistent insteadof definition."- incorrectly 
+    triggered). (Julien)
   . Fixed bug #68355 (Inconsistency in example php.ini comments).
     (Chris McCafferty)
   . Fixed bug #68370 ("unset($this)" can make the program crash). (Laruence)
+  . Fixed bug #68422 (Incorrect argument reflection info for array_multisort()).
+    (Alexander Lisachenko)
   . Fixed bug #68446 (Array constant not accepted for array parameter default). (Bob)
 
 - FPM:

From 5351ecbfca18a86b44e5cadef67a2d6fc153a907 Mon Sep 17 00:00:00 2001
From: Tim Siebels 
Date: Fri, 12 Sep 2014 15:04:32 +0200
Subject: [PATCH 073/102] Correct two zlib tests to use a string, not a const

---
 ext/zlib/tests/gzfile_variation4.phpt     | 2 +-
 ext/zlib/tests/readgzfile_variation4.phpt | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/ext/zlib/tests/gzfile_variation4.phpt b/ext/zlib/tests/gzfile_variation4.phpt
index 3310231566a..9b3128125a5 100644
--- a/ext/zlib/tests/gzfile_variation4.phpt
+++ b/ext/zlib/tests/gzfile_variation4.phpt
@@ -2,7 +2,7 @@
 Test function gzfile() by substituting argument 1 with float values.
 --SKIPIF--
 
 --FILE--
 
 --FILE--
 
Date: Mon, 8 Sep 2014 13:13:34 +0400
Subject: [PATCH 074/102] Update CODING_STANDARDS

---
 CODING_STANDARDS | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/CODING_STANDARDS b/CODING_STANDARDS
index 27fff07f60f..2664d12bd5f 100644
--- a/CODING_STANDARDS
+++ b/CODING_STANDARDS
@@ -42,7 +42,7 @@ Exceptions:
 
 4.  When writing functions that deal with strings, be sure to remember
     that PHP holds the length property of each string, and that it
-    shouldn't be calculated with strlen().  Write your functions in a such
+    shouldn't be calculated with strlen().  Write your functions in such
     a way so that they'll take advantage of the length property, both
     for efficiency and in order for them to be binary-safe.
     Functions that change strings and obtain their new lengths while

From 2917c702523910ace15a78f9646bd95700239528 Mon Sep 17 00:00:00 2001
From: marcosptf 
Date: Fri, 24 Oct 2014 15:08:27 -0200
Subject: [PATCH 075/102] test

---
 tests/func/012.phpt | 12 ++++++++++++
 1 file changed, 12 insertions(+)
 create mode 100644 tests/func/012.phpt

diff --git a/tests/func/012.phpt b/tests/func/012.phpt
new file mode 100644
index 00000000000..3b0d8ea7b32
--- /dev/null
+++ b/tests/func/012.phpt
@@ -0,0 +1,12 @@
+--TEST--
+addcslashes(); function test
+--CREDITS--
+ marcosptf - 
+#phptestfest PHPSP on Google - Sao Paulo - Brazil - 2014-06-05
+--FILE--
+
+--EXPECTF--
+Warning: addcslashes(): Invalid '..'-range, '..'-range needs to be incrementing in %s on line %d
+\zoo['\.']

From 49a133dd0b08c52fd7565c313117fca1b9382f84 Mon Sep 17 00:00:00 2001
From: marcosptf 
Date: Fri, 24 Oct 2014 15:11:17 -0200
Subject: [PATCH 076/102] test to function addcslashes

test to function bin2hex
---
 .../standard/tests/strings/addcslashes_005.phpt       |  2 +-
 ext/standard/tests/strings/bin2hex_001.phpt           | 11 +++++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)
 rename tests/func/012.phpt => ext/standard/tests/strings/addcslashes_005.phpt (87%)
 create mode 100644 ext/standard/tests/strings/bin2hex_001.phpt

diff --git a/tests/func/012.phpt b/ext/standard/tests/strings/addcslashes_005.phpt
similarity index 87%
rename from tests/func/012.phpt
rename to ext/standard/tests/strings/addcslashes_005.phpt
index 3b0d8ea7b32..f0b2fbcecb2 100644
--- a/tests/func/012.phpt
+++ b/ext/standard/tests/strings/addcslashes_005.phpt
@@ -1,5 +1,5 @@
 --TEST--
-addcslashes(); function test
+addcslashes(); function test with warning
 --CREDITS--
  marcosptf - 
 #phptestfest PHPSP on Google - Sao Paulo - Brazil - 2014-06-05
diff --git a/ext/standard/tests/strings/bin2hex_001.phpt b/ext/standard/tests/strings/bin2hex_001.phpt
new file mode 100644
index 00000000000..e73500a30e1
--- /dev/null
+++ b/ext/standard/tests/strings/bin2hex_001.phpt
@@ -0,0 +1,11 @@
+--TEST--
+bin2hex(); function test
+--CREDITS--
+marcosptf - 
+#phptestfest PHPSP on Google - Sao Paulo - Brazil - 2014-06-05
+--FILE--
+
+--EXPECT--
+313233343536

From 4469049b7b0438ffc6cce576b2bb52de8840c889 Mon Sep 17 00:00:00 2001
From: Stanislav Malyshev 
Date: Sun, 23 Nov 2014 18:03:07 -0800
Subject: [PATCH 077/102] update for LiteSpeed

---
 NEWS | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/NEWS b/NEWS
index 1f83b03a4d8..fd082766a59 100644
--- a/NEWS
+++ b/NEWS
@@ -279,6 +279,9 @@ PHP                                                                        NEWS
   . Fixed bug #67413 (fileinfo: cdf_read_property_info insufficient boundary
     check). (Francisco Alonso, Jan Kaluza, Remi)
 
+- LiteSpeed:
+  . Updated LiteSpeed SAPI code from V5.5 to V6.6 (George Wang)
+
 - Network:
   . Fixed bug #67432 (Fix potential segfault in dns_get_record()).
     (CVE-2014-4049). (Sara)

From 7dbc5e5c695da43241426392523a2b409eceb8ff Mon Sep 17 00:00:00 2001
From: Stanislav Malyshev 
Date: Sun, 23 Nov 2014 18:05:26 -0800
Subject: [PATCH 078/102] update for LiteSpeed

---
 NEWS | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/NEWS b/NEWS
index 7ea06aa7b65..f1bef3cdfa2 100644
--- a/NEWS
+++ b/NEWS
@@ -90,6 +90,9 @@ PHP                                                                        NEWS
   . Fixed bug #67730 (Null byte injection possible with imagexxx functions).
     (CVE-2014-5120) (Ryan Mauger)
 
+- LiteSpeed:
+  . Updated LiteSpeed SAPI code from V5.5 to V6.6 (George Wang)
+
 - Network:
   . Fixed bug #67717 (segfault in dns_get_record). (CVE-2014-3597) (Remi)
 

From d8fbcca725264cbca3ea88375bfb7879f81175d7 Mon Sep 17 00:00:00 2001
From: Sobak 
Date: Mon, 28 Jul 2014 15:18:48 +0200
Subject: [PATCH 079/102] Remove no longer used scripts

---
 scripts/apache/apconf-conv.sh     | 24 ------------------------
 scripts/apache/aphtaccess-conv.sh | 24 ------------------------
 scripts/apache/conffix.awk        | 23 -----------------------
 scripts/apache/htaccessfix.awk    | 23 -----------------------
 4 files changed, 94 deletions(-)
 delete mode 100755 scripts/apache/apconf-conv.sh
 delete mode 100755 scripts/apache/aphtaccess-conv.sh
 delete mode 100644 scripts/apache/conffix.awk
 delete mode 100644 scripts/apache/htaccessfix.awk

diff --git a/scripts/apache/apconf-conv.sh b/scripts/apache/apconf-conv.sh
deleted file mode 100755
index 6126bdc27d9..00000000000
--- a/scripts/apache/apconf-conv.sh
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/sh
-
-if [ "$1" = "" ]; then
-	echo "Usage: $0 /somewhere/httpd.conf"
-	exit 1
-fi
-
-if [ ! -w $1 ]; then
-	echo "You cannot write to $1"
-	exit 1
-fi
-
-TMPFILE=tmpfile.$$
-
-awk -f conffix.awk <$1 >$TMPFILE
-
-if [ "$?" != 0 ]; then
-	exit 1
-fi
-
-mv -f $1 $1.orig
-mv -f $TMPFILE $1
-exit 0
-
diff --git a/scripts/apache/aphtaccess-conv.sh b/scripts/apache/aphtaccess-conv.sh
deleted file mode 100755
index 1af59d28436..00000000000
--- a/scripts/apache/aphtaccess-conv.sh
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/sh
-
-if [ "$1" = "" ]; then
-	echo "Usage: $0 /somewhere/.htaccess"
-	exit 1
-fi
-
-if [ ! -w $1 ]; then
-	echo "You cannot write to $1"
-	exit 1
-fi
-
-TMPFILE=tmpfile.$$
-
-awk -f htaccessfix.awk <$1 >$TMPFILE
-
-if [ "$?" != 0 ]; then
-	exit 1
-fi
-
-mv -f $1 $1.orig
-mv -f $TMPFILE $1
-exit 0
-
diff --git a/scripts/apache/conffix.awk b/scripts/apache/conffix.awk
deleted file mode 100644
index 88be6fade70..00000000000
--- a/scripts/apache/conffix.awk
+++ /dev/null
@@ -1,23 +0,0 @@
-# $Id$
-
-/^[ \t]*php3_*/ {
-	phpcommand=substr($1,6)
-	phpvalue=tolower($2)
-	print ""
-	print $0
-	print ""
-	print ""
-	if (phpvalue=="on") {
-		print "php_admin_flag " phpcommand " on"
-	} else  if (phpvalue=="off") {
-		print "php_admin_flag " phpcommand " off"
-	} else {
-		print "php_admin_value " phpcommand " " substr($0,index($0,$1)+length($1)+1)
-	}
-	print ""
-}
-
-! /^[ \t]*php3_*/ {
-	print $0
-}
-
diff --git a/scripts/apache/htaccessfix.awk b/scripts/apache/htaccessfix.awk
deleted file mode 100644
index 3c784cd3359..00000000000
--- a/scripts/apache/htaccessfix.awk
+++ /dev/null
@@ -1,23 +0,0 @@
-# $Id$
-
-/^[ \t]*php3_*/ {
-	phpcommand=substr($1,6)
-	phpvalue=tolower($2)
-	print ""
-	print $0
-	print ""
-	print ""
-	if (phpvalue=="on") {
-		print "php_flag " phpcommand " on"
-	} else  if (phpvalue=="off") {
-		print "php_flag " phpcommand " off"
-	} else {
-		print "php_value " phpcommand " " substr($0,index($0,$1)+length($1)+1)
-	}
-	print ""
-}
-
-! /^[ \t]*php3_*/ {
-	print $0
-}
-

From 95a609c5d14a2c5295886065a24db8344844ca8b Mon Sep 17 00:00:00 2001
From: Remi Collet 
Date: Mon, 24 Nov 2014 09:38:36 +0100
Subject: [PATCH 080/102] FPM: change "listen = port" behavior from IPv4
 catch-all to IPv6 catch-all (+ IPv4-mapped)

---
 UPGRADING                  |  1 +
 sapi/fpm/fpm/fpm_sockets.c | 18 ++++--------------
 sapi/fpm/php-fpm.conf.in   |  4 +---
 3 files changed, 6 insertions(+), 17 deletions(-)

diff --git a/UPGRADING b/UPGRADING
index fe282138d10..9d5d8e72284 100644
--- a/UPGRADING
+++ b/UPGRADING
@@ -63,6 +63,7 @@ PHP X.Y UPGRADE NOTES
 
 - FPM
   . Fixed bug #65933 (Cannot specify config lines longer than 1024 bytes).
+  . Listen = port now listen on all addresses (IPv6 and IPv4-mapped).
 
 ========================================
 4. Deprecated Functionality
diff --git a/sapi/fpm/fpm/fpm_sockets.c b/sapi/fpm/fpm/fpm_sockets.c
index 0286f0eee8d..e4e494876f5 100644
--- a/sapi/fpm/fpm/fpm_sockets.c
+++ b/sapi/fpm/fpm/fpm_sockets.c
@@ -268,6 +268,8 @@ static int fpm_socket_af_inet_listening_socket(struct fpm_worker_pool_s *wp) /*
 	} else if (strlen(dup_address) == strspn(dup_address, "0123456789")) { /* this is port */
 		port = atoi(dup_address);
 		port_str = dup_address;
+		/* IPv6 catch-all + IPv4-mapped */
+		addr = "::";
 	}
 
 	if (port == 0) {
@@ -275,18 +277,6 @@ static int fpm_socket_af_inet_listening_socket(struct fpm_worker_pool_s *wp) /*
 		return -1;
 	}
 
-	if (!addr) {
-		/* no address: default documented behavior, all IPv4 addresses */
-		struct sockaddr_in sa_in;
-
-		memset(&sa_in, 0, sizeof(sa_in));
-		sa_in.sin_family = AF_INET;
-		sa_in.sin_port = htons(port);
-		sa_in.sin_addr.s_addr = htonl(INADDR_ANY);
-		free(dup_address);
-		return fpm_sockets_get_listening_socket(wp, (struct sockaddr *) &sa_in, sizeof(struct sockaddr_in));
-	}
-
 	/* strip brackets from address for getaddrinfo */
 	addr_len = strlen(addr);
 	if (addr[0] == '[' && addr[addr_len - 1] == ']') {
@@ -307,10 +297,10 @@ static int fpm_socket_af_inet_listening_socket(struct fpm_worker_pool_s *wp) /*
 		inet_ntop(p->ai_family, fpm_get_in_addr(p->ai_addr), tmpbuf, INET6_ADDRSTRLEN);
 		if (sock < 0) {
 			if ((sock = fpm_sockets_get_listening_socket(wp, p->ai_addr, p->ai_addrlen)) != -1) {
-				zlog(ZLOG_DEBUG, "Found address for %s, socket opened on %s", dup_address, tmpbuf);
+				zlog(ZLOG_DEBUG, "Found address for %s, socket opened on %s", addr, tmpbuf);
 			}
 		} else {
-			zlog(ZLOG_WARNING, "Found multiple addresses for %s, %s ignored", dup_address, tmpbuf);
+			zlog(ZLOG_WARNING, "Found multiple addresses for %s, %s ignored", addr, tmpbuf);
 		}
 	}
 
diff --git a/sapi/fpm/php-fpm.conf.in b/sapi/fpm/php-fpm.conf.in
index b2d8a225364..850a3690024 100644
--- a/sapi/fpm/php-fpm.conf.in
+++ b/sapi/fpm/php-fpm.conf.in
@@ -155,9 +155,7 @@ group = @php_fpm_group@
 ;                            a specific port;
 ;   '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on
 ;                            a specific port;
-;   'port'                 - to listen on a TCP socket to all IPv4 addresses on a
-;                            specific port;
-;   '[::]:port'            - to listen on a TCP socket to all addresses
+;   'port'                 - to listen on a TCP socket to all addresses
 ;                            (IPv6 and IPv4-mapped) on a specific port;
 ;   '/path/to/unix/socket' - to listen on a unix socket.
 ; Note: This value is mandatory.

From e45dbba5602b7bbd8c97b4aa3bae6b00602a8110 Mon Sep 17 00:00:00 2001
From: Dmitry Stogov 
Date: Mon, 24 Nov 2014 15:46:34 +0300
Subject: [PATCH 081/102] Micro optimization

---
 Zend/zend_vm_def.h     | 59 +++++++++++++++++++++---------------------
 Zend/zend_vm_execute.h | 59 +++++++++++++++++++++---------------------
 2 files changed, 58 insertions(+), 60 deletions(-)

diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h
index 78ef315ec77..cd748b73f0b 100644
--- a/Zend/zend_vm_def.h
+++ b/Zend/zend_vm_def.h
@@ -5907,23 +5907,39 @@ ZEND_VM_HANDLER(168, ZEND_BIND_GLOBAL, CV, CONST)
 	zval *varname;
 	zval *value;
 	zval *variable_ptr;
-	Bucket *p;
 	uint32_t idx;
 
 	SAVE_OPLINE();
 	varname = GET_OP2_ZVAL_PTR(BP_VAR_R);
-	idx = (uint32_t)(uintptr_t)CACHED_PTR(Z_CACHE_SLOT_P(varname));
-	/* index 0 can't be cached (NULL is a mark of uninitialized cache slot) */
-	p = EG(symbol_table).ht.arData + idx; 
-	if (EXPECTED(idx > 0) &&
-	    EXPECTED(idx < EG(symbol_table).ht.nNumUsed) &&
-	    EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
-        (EXPECTED(p->key == Z_STR_P(varname)) ||
-         (EXPECTED(p->h == Z_STR_P(varname)->h) &&
-          EXPECTED(p->key != NULL) &&
-          EXPECTED(p->key->len == Z_STRLEN_P(varname)) &&
-          EXPECTED(memcmp(p->key->val, Z_STRVAL_P(varname), Z_STRLEN_P(varname)) == 0)))) {
-		value = &EG(symbol_table).ht.arData[idx].val;
+	
+	/* We store "hash slot index" + 1 (NULL is a mark of uninitialized cache slot) */
+	idx = (uint32_t)(uintptr_t)CACHED_PTR(Z_CACHE_SLOT_P(varname)) - 1;
+	if (EXPECTED(idx < EG(symbol_table).ht.nNumUsed)) {
+		Bucket *p = EG(symbol_table).ht.arData + idx; 
+
+		if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
+	        (EXPECTED(p->key == Z_STR_P(varname)) ||
+	         (EXPECTED(p->h == Z_STR_P(varname)->h) &&
+	          EXPECTED(p->key != NULL) &&
+	          EXPECTED(p->key->len == Z_STRLEN_P(varname)) &&
+	          EXPECTED(memcmp(p->key->val, Z_STRVAL_P(varname), Z_STRLEN_P(varname)) == 0)))) {
+	
+			value = &EG(symbol_table).ht.arData[idx].val;
+			ZEND_VM_C_GOTO(check_indirect);
+		}
+	}
+
+	value = zend_hash_find(&EG(symbol_table).ht, Z_STR_P(varname));
+	if (UNEXPECTED(value == NULL)) {
+		value = zend_hash_add_new(&EG(symbol_table).ht, Z_STR_P(varname), &EG(uninitialized_zval));
+		idx = ((char*)value - (char*)EG(symbol_table).ht.arData) / sizeof(Bucket);
+		/* Store "hash slot index" + 1 (NULL is a mark of uninitialized cache slot) */
+		CACHE_PTR(Z_CACHE_SLOT_P(varname), (void*)(uintptr_t)(idx + 1));
+	} else {
+		idx = ((char*)value - (char*)EG(symbol_table).ht.arData) / sizeof(Bucket);
+		/* Store "hash slot index" + 1 (NULL is a mark of uninitialized cache slot) */
+		CACHE_PTR(Z_CACHE_SLOT_P(varname), (void*)(uintptr_t)(idx + 1));
+ZEND_VM_C_LABEL(check_indirect):
 		/* GLOBAL variable may be an INDIRECT pointer to CV */
 		if (UNEXPECTED(Z_TYPE_P(value) == IS_INDIRECT)) {
 			value = Z_INDIRECT_P(value);
@@ -5931,23 +5947,6 @@ ZEND_VM_HANDLER(168, ZEND_BIND_GLOBAL, CV, CONST)
 				ZVAL_NULL(value);
 			}
 		}
-	} else {
-		value = zend_hash_find(&EG(symbol_table).ht, Z_STR_P(varname));
-		if (UNEXPECTED(value == NULL)) {
-			value = zend_hash_add_new(&EG(symbol_table).ht, Z_STR_P(varname), &EG(uninitialized_zval));
-			idx = ((char*)value - (char*)EG(symbol_table).ht.arData) / sizeof(Bucket);
-			CACHE_PTR(Z_CACHE_SLOT_P(varname), (void*)(uintptr_t)idx);
-		} else {
-			idx = ((char*)value - (char*)EG(symbol_table).ht.arData) / sizeof(Bucket);
-			CACHE_PTR(Z_CACHE_SLOT_P(varname), (void*)(uintptr_t)idx);
-			/* GLOBAL variable may be an INDIRECT pointer to CV */
-			if (UNEXPECTED(Z_TYPE_P(value) == IS_INDIRECT)) {
-				value = Z_INDIRECT_P(value);
-				if (UNEXPECTED(Z_TYPE_P(value) == IS_UNDEF)) {
-					ZVAL_NULL(value);
-				}
-			}
-		}
 	}
 
 	variable_ptr = GET_OP1_ZVAL_PTR_PTR_UNDEF(BP_VAR_W);
diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h
index 074dbc2965a..a1f7a3ffc28 100644
--- a/Zend/zend_vm_execute.h
+++ b/Zend/zend_vm_execute.h
@@ -37393,23 +37393,39 @@ static int ZEND_FASTCALL  ZEND_BIND_GLOBAL_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HAN
 	zval *varname;
 	zval *value;
 	zval *variable_ptr;
-	Bucket *p;
 	uint32_t idx;
 
 	SAVE_OPLINE();
 	varname = opline->op2.zv;
-	idx = (uint32_t)(uintptr_t)CACHED_PTR(Z_CACHE_SLOT_P(varname));
-	/* index 0 can't be cached (NULL is a mark of uninitialized cache slot) */
-	p = EG(symbol_table).ht.arData + idx;
-	if (EXPECTED(idx > 0) &&
-	    EXPECTED(idx < EG(symbol_table).ht.nNumUsed) &&
-	    EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
-        (EXPECTED(p->key == Z_STR_P(varname)) ||
-         (EXPECTED(p->h == Z_STR_P(varname)->h) &&
-          EXPECTED(p->key != NULL) &&
-          EXPECTED(p->key->len == Z_STRLEN_P(varname)) &&
-          EXPECTED(memcmp(p->key->val, Z_STRVAL_P(varname), Z_STRLEN_P(varname)) == 0)))) {
-		value = &EG(symbol_table).ht.arData[idx].val;
+
+	/* We store "hash slot index" + 1 (NULL is a mark of uninitialized cache slot) */
+	idx = (uint32_t)(uintptr_t)CACHED_PTR(Z_CACHE_SLOT_P(varname)) - 1;
+	if (EXPECTED(idx < EG(symbol_table).ht.nNumUsed)) {
+		Bucket *p = EG(symbol_table).ht.arData + idx;
+
+		if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
+	        (EXPECTED(p->key == Z_STR_P(varname)) ||
+	         (EXPECTED(p->h == Z_STR_P(varname)->h) &&
+	          EXPECTED(p->key != NULL) &&
+	          EXPECTED(p->key->len == Z_STRLEN_P(varname)) &&
+	          EXPECTED(memcmp(p->key->val, Z_STRVAL_P(varname), Z_STRLEN_P(varname)) == 0)))) {
+
+			value = &EG(symbol_table).ht.arData[idx].val;
+			goto check_indirect;
+		}
+	}
+
+	value = zend_hash_find(&EG(symbol_table).ht, Z_STR_P(varname));
+	if (UNEXPECTED(value == NULL)) {
+		value = zend_hash_add_new(&EG(symbol_table).ht, Z_STR_P(varname), &EG(uninitialized_zval));
+		idx = ((char*)value - (char*)EG(symbol_table).ht.arData) / sizeof(Bucket);
+		/* Store "hash slot index" + 1 (NULL is a mark of uninitialized cache slot) */
+		CACHE_PTR(Z_CACHE_SLOT_P(varname), (void*)(uintptr_t)(idx + 1));
+	} else {
+		idx = ((char*)value - (char*)EG(symbol_table).ht.arData) / sizeof(Bucket);
+		/* Store "hash slot index" + 1 (NULL is a mark of uninitialized cache slot) */
+		CACHE_PTR(Z_CACHE_SLOT_P(varname), (void*)(uintptr_t)(idx + 1));
+check_indirect:
 		/* GLOBAL variable may be an INDIRECT pointer to CV */
 		if (UNEXPECTED(Z_TYPE_P(value) == IS_INDIRECT)) {
 			value = Z_INDIRECT_P(value);
@@ -37417,23 +37433,6 @@ static int ZEND_FASTCALL  ZEND_BIND_GLOBAL_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HAN
 				ZVAL_NULL(value);
 			}
 		}
-	} else {
-		value = zend_hash_find(&EG(symbol_table).ht, Z_STR_P(varname));
-		if (UNEXPECTED(value == NULL)) {
-			value = zend_hash_add_new(&EG(symbol_table).ht, Z_STR_P(varname), &EG(uninitialized_zval));
-			idx = ((char*)value - (char*)EG(symbol_table).ht.arData) / sizeof(Bucket);
-			CACHE_PTR(Z_CACHE_SLOT_P(varname), (void*)(uintptr_t)idx);
-		} else {
-			idx = ((char*)value - (char*)EG(symbol_table).ht.arData) / sizeof(Bucket);
-			CACHE_PTR(Z_CACHE_SLOT_P(varname), (void*)(uintptr_t)idx);
-			/* GLOBAL variable may be an INDIRECT pointer to CV */
-			if (UNEXPECTED(Z_TYPE_P(value) == IS_INDIRECT)) {
-				value = Z_INDIRECT_P(value);
-				if (UNEXPECTED(Z_TYPE_P(value) == IS_UNDEF)) {
-					ZVAL_NULL(value);
-				}
-			}
-		}
 	}
 
 	variable_ptr = _get_zval_ptr_cv_undef_BP_VAR_W(execute_data, opline->op1.var TSRMLS_CC);

From 99818a576f0dd7fd5ef2869a27b62e1c3e5f48bd Mon Sep 17 00:00:00 2001
From: Dmitry Stogov 
Date: Mon, 24 Nov 2014 17:20:49 +0300
Subject: [PATCH 082/102] Use inline version of the function in the loop

---
 Zend/zend_objects.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/Zend/zend_objects.c b/Zend/zend_objects.c
index 58c034163e7..9068dceb8b1 100644
--- a/Zend/zend_objects.c
+++ b/Zend/zend_objects.c
@@ -47,7 +47,7 @@ ZEND_API void zend_object_std_init(zend_object *object, zend_class_entry *ce TSR
 
 ZEND_API void zend_object_std_dtor(zend_object *object TSRMLS_DC)
 {
-	int i;
+	int i, count;
 
 	if (object->guards) {
 		zend_hash_destroy(object->guards);
@@ -57,8 +57,9 @@ ZEND_API void zend_object_std_dtor(zend_object *object TSRMLS_DC)
 		zend_hash_destroy(object->properties);
 		FREE_HASHTABLE(object->properties);
 	}
-	for (i = 0; i < object->ce->default_properties_count; i++) {
-		zval_ptr_dtor(&object->properties_table[i]);
+	count = object->ce->default_properties_count;
+	for (i = 0; i < count; i++) {
+		i_zval_ptr_dtor(&object->properties_table[i] ZEND_FILE_LINE_CC TSRMLS_CC);
 	}
 }
 

From ac8b1a9de17bff14812189b23fe8471993ac1900 Mon Sep 17 00:00:00 2001
From: Anatol Belski 
Date: Mon, 24 Nov 2014 16:09:26 +0100
Subject: [PATCH 083/102] fork test for windows

---
 ext/iconv/tests/iconv_basic_001-win32.phpt | 19 +++++++++++++++++++
 ext/iconv/tests/iconv_basic_001.phpt       |  3 ++-
 2 files changed, 21 insertions(+), 1 deletion(-)
 create mode 100644 ext/iconv/tests/iconv_basic_001-win32.phpt

diff --git a/ext/iconv/tests/iconv_basic_001-win32.phpt b/ext/iconv/tests/iconv_basic_001-win32.phpt
new file mode 100644
index 00000000000..59a3dbd8630
--- /dev/null
+++ b/ext/iconv/tests/iconv_basic_001-win32.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Test the basics to function iconv.
+--CREDITS--
+Rodrigo Prado de Jesus 
+--SKIPIF--
+
+
+--FILE--
+
+--EXPECT--
+string(16) "Zlutouck'y kun\n"
diff --git a/ext/iconv/tests/iconv_basic_001.phpt b/ext/iconv/tests/iconv_basic_001.phpt
index e5c5ddc4283..6fcb5dbe8a3 100644
--- a/ext/iconv/tests/iconv_basic_001.phpt
+++ b/ext/iconv/tests/iconv_basic_001.phpt
@@ -4,6 +4,7 @@ Test the basics to function iconv.
 Rodrigo Prado de Jesus 
 --SKIPIF--
 
+
 --FILE--
 
 --EXPECT--
-string(15) "Zlutoucky kun\n"
\ No newline at end of file
+string(15) "Zlutoucky kun\n"

From 09f2355eec0b800905d59f9e96ae09d242ba7673 Mon Sep 17 00:00:00 2001
From: Anatol Belski 
Date: Mon, 24 Nov 2014 16:14:17 +0100
Subject: [PATCH 084/102] fix dir separator in test

---
 ext/exif/tests/bug68113.phpt | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/ext/exif/tests/bug68113.phpt b/ext/exif/tests/bug68113.phpt
index 0fa4c4aca86..e4a1cbf53bd 100644
--- a/ext/exif/tests/bug68113.phpt
+++ b/ext/exif/tests/bug68113.phpt
@@ -10,8 +10,8 @@ var_dump(exif_thumbnail(__DIR__."/bug68113.jpg"));
 ?>
 Done
 --EXPECTF--
-Warning: exif_thumbnail(bug68113.jpg): File structure corrupted in %s/bug68113.php on line 2
+Warning: exif_thumbnail(bug68113.jpg): File structure corrupted in %s%ebug68113.php on line 2
 
-Warning: exif_thumbnail(bug68113.jpg): Invalid JPEG file in %s/bug68113.php on line 2
+Warning: exif_thumbnail(bug68113.jpg): Invalid JPEG file in %s%ebug68113.php on line 2
 bool(false)
-Done
\ No newline at end of file
+Done

From 899c24a8c1ae5a010fc02c77c37386129d190216 Mon Sep 17 00:00:00 2001
From: Popa Adrian Marius 
Date: Mon, 24 Nov 2014 18:40:20 +0200
Subject: [PATCH 085/102] cleanup comments from svn/cvs era

---
 ext/interbase/tests/002.phpt | 2 +-
 ext/interbase/tests/003.phpt | 2 +-
 ext/interbase/tests/004.phpt | 2 +-
 ext/interbase/tests/005.phpt | 2 +-
 ext/interbase/tests/006.phpt | 2 +-
 ext/interbase/tests/007.phpt | 2 +-
 ext/interbase/tests/008.phpt | 2 +-
 7 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/ext/interbase/tests/002.phpt b/ext/interbase/tests/002.phpt
index 070a6f00690..37b0a4f344d 100644
--- a/ext/interbase/tests/002.phpt
+++ b/ext/interbase/tests/002.phpt
@@ -3,7 +3,7 @@ InterBase: connect, close and pconnect
 --SKIPIF--
 
 --FILE--
-
 --FILE--
-
 --FILE--
-
 --FILE--
-
 --FILE--
-
 --FILE--
-
 --FILE--
-
Date: Mon, 24 Nov 2014 20:33:27 +0300
Subject: [PATCH 086/102] Reuse zend_assign_to_variable() in
 zend_std_write_property()

---
 Zend/zend_execute.c         | 61 +------------------------------------
 Zend/zend_execute.h         | 59 +++++++++++++++++++++++++++++++++++
 Zend/zend_object_handlers.c | 46 +---------------------------
 3 files changed, 61 insertions(+), 105 deletions(-)

diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index 00e72a0e618..b56f5d40861 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -692,7 +692,7 @@ static void zend_verify_missing_arg(zend_execute_data *execute_data, uint32_t ar
 static zend_always_inline void zend_assign_to_object(zval *retval, zval *object, uint32_t object_op_type, zval *property_name, int value_type, const znode_op *value_op, const zend_execute_data *execute_data, int opcode, void **cache_slot TSRMLS_DC)
 {
 	zend_free_op free_value;
- 	zval *value = get_zval_ptr(value_type, value_op, execute_data, &free_value, BP_VAR_R);
+ 	zval *value = get_zval_ptr_deref(value_type, value_op, execute_data, &free_value, BP_VAR_R);
  	zval tmp;
 
  	if (object_op_type != IS_UNUSED) {
@@ -830,65 +830,6 @@ static void zend_assign_to_string_offset(zval *str, zend_long offset, zval *valu
 	}
 }
 
-static zend_always_inline zval* zend_assign_to_variable(zval *variable_ptr, zval *value, zend_uchar value_type TSRMLS_DC)
-{
-	do {
-		if (UNEXPECTED(Z_REFCOUNTED_P(variable_ptr))) {	
-			zend_refcounted *garbage;
-
-			if (Z_ISREF_P(variable_ptr)) {
-				variable_ptr = Z_REFVAL_P(variable_ptr);
-				if (EXPECTED(!Z_REFCOUNTED_P(variable_ptr))) {
-					break;
-				}
-			}
-			if (Z_TYPE_P(variable_ptr) == IS_OBJECT &&
-	    		UNEXPECTED(Z_OBJ_HANDLER_P(variable_ptr, set) != NULL)) {
-				Z_OBJ_HANDLER_P(variable_ptr, set)(variable_ptr, value TSRMLS_CC);
-				return variable_ptr;
-			}
-			if ((value_type & (IS_VAR|IS_CV)) && variable_ptr == value) {
-				return variable_ptr;
-			}
-			garbage = Z_COUNTED_P(variable_ptr);
-			if (--GC_REFCOUNT(garbage) == 0) {
-				ZVAL_COPY_VALUE(variable_ptr, value);
-				if (value_type == IS_CONST) {
-					/* IS_CONST can't be IS_OBJECT, IS_RESOURCE or IS_REFERENCE */
-					if (UNEXPECTED(Z_OPT_COPYABLE_P(variable_ptr))) {
-						zval_copy_ctor_func(variable_ptr);
-					}
-				} else if (value_type != IS_TMP_VAR) {
-					if (UNEXPECTED(Z_OPT_REFCOUNTED_P(variable_ptr))) {
-						Z_ADDREF_P(variable_ptr);
-					}
-				}
-				_zval_dtor_func_for_ptr(garbage ZEND_FILE_LINE_CC);
-				return variable_ptr;
-			} else { /* we need to split */
-				/* optimized version of GC_ZVAL_CHECK_POSSIBLE_ROOT(variable_ptr) */
-				if ((Z_COLLECTABLE_P(variable_ptr)) &&
-		    		UNEXPECTED(!GC_INFO(garbage))) {
-					gc_possible_root(garbage TSRMLS_CC);
-				}
-			}
-		}
-	} while (0);
-
-	ZVAL_COPY_VALUE(variable_ptr, value);
-	if (value_type == IS_CONST) {
-		/* IS_CONST can't be IS_OBJECT, IS_RESOURCE or IS_REFERENCE */
-		if (UNEXPECTED(Z_OPT_COPYABLE_P(variable_ptr))) {
-			zval_copy_ctor_func(variable_ptr);
-		}
-	} else if (value_type != IS_TMP_VAR) {
-		if (UNEXPECTED(Z_OPT_REFCOUNTED_P(variable_ptr))) {
-			Z_ADDREF_P(variable_ptr);
-		}
-	}
-	return variable_ptr;
-}
-
 /* Utility Functions for Extensions */
 static void zend_extension_statement_handler(const zend_extension *extension, zend_op_array *op_array TSRMLS_DC)
 {
diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h
index bfa3394e0db..298a125e056 100644
--- a/Zend/zend_execute.h
+++ b/Zend/zend_execute.h
@@ -129,6 +129,65 @@ again:
 	return result;
 }
 
+static zend_always_inline zval* zend_assign_to_variable(zval *variable_ptr, zval *value, zend_uchar value_type TSRMLS_DC)
+{
+	do {
+		if (UNEXPECTED(Z_REFCOUNTED_P(variable_ptr))) {	
+			zend_refcounted *garbage;
+
+			if (Z_ISREF_P(variable_ptr)) {
+				variable_ptr = Z_REFVAL_P(variable_ptr);
+				if (EXPECTED(!Z_REFCOUNTED_P(variable_ptr))) {
+					break;
+				}
+			}
+			if (Z_TYPE_P(variable_ptr) == IS_OBJECT &&
+	    		UNEXPECTED(Z_OBJ_HANDLER_P(variable_ptr, set) != NULL)) {
+				Z_OBJ_HANDLER_P(variable_ptr, set)(variable_ptr, value TSRMLS_CC);
+				return variable_ptr;
+			}
+			if ((value_type & (IS_VAR|IS_CV)) && variable_ptr == value) {
+				return variable_ptr;
+			}
+			garbage = Z_COUNTED_P(variable_ptr);
+			if (--GC_REFCOUNT(garbage) == 0) {
+				ZVAL_COPY_VALUE(variable_ptr, value);
+				if (value_type == IS_CONST) {
+					/* IS_CONST can't be IS_OBJECT, IS_RESOURCE or IS_REFERENCE */
+					if (UNEXPECTED(Z_OPT_COPYABLE_P(variable_ptr))) {
+						zval_copy_ctor_func(variable_ptr);
+					}
+				} else if (value_type != IS_TMP_VAR) {
+					if (UNEXPECTED(Z_OPT_REFCOUNTED_P(variable_ptr))) {
+						Z_ADDREF_P(variable_ptr);
+					}
+				}
+				_zval_dtor_func_for_ptr(garbage ZEND_FILE_LINE_CC);
+				return variable_ptr;
+			} else { /* we need to split */
+				/* optimized version of GC_ZVAL_CHECK_POSSIBLE_ROOT(variable_ptr) */
+				if ((Z_COLLECTABLE_P(variable_ptr)) &&
+		    		UNEXPECTED(!GC_INFO(garbage))) {
+					gc_possible_root(garbage TSRMLS_CC);
+				}
+			}
+		}
+	} while (0);
+
+	ZVAL_COPY_VALUE(variable_ptr, value);
+	if (value_type == IS_CONST) {
+		/* IS_CONST can't be IS_OBJECT, IS_RESOURCE or IS_REFERENCE */
+		if (UNEXPECTED(Z_OPT_COPYABLE_P(variable_ptr))) {
+			zval_copy_ctor_func(variable_ptr);
+		}
+	} else if (value_type != IS_TMP_VAR) {
+		if (UNEXPECTED(Z_OPT_REFCOUNTED_P(variable_ptr))) {
+			Z_ADDREF_P(variable_ptr);
+		}
+	}
+	return variable_ptr;
+}
+
 ZEND_API int zval_update_constant(zval *pp, zend_bool inline_change TSRMLS_DC);
 ZEND_API int zval_update_constant_inline_change(zval *pp, zend_class_entry *scope TSRMLS_DC);
 ZEND_API int zval_update_constant_no_inline_change(zval *pp, zend_class_entry *scope TSRMLS_DC);
diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c
index af2ba2d7080..c474fa8662a 100644
--- a/Zend/zend_object_handlers.c
+++ b/Zend/zend_object_handlers.c
@@ -545,51 +545,7 @@ ZEND_API void zend_std_write_property(zval *object, zval *member, zval *value, v
 		} else if (EXPECTED(zobj->properties != NULL)) {
 			if ((variable_ptr = zend_hash_find(zobj->properties, Z_STR_P(member))) != NULL) {
 found:
-				/* if we already have this value there, we don't actually need to do anything */
-				if (EXPECTED(variable_ptr != value)) {
-					/* if we are assigning reference, we shouldn't move it, but instead assign variable
-					   to the same pointer */
-					if (Z_ISREF_P(variable_ptr)) {
-						zval garbage;
-
-						ZVAL_COPY_VALUE(&garbage, Z_REFVAL_P(variable_ptr)); /* old value should be destroyed */
-
-						/* To check: can't *variable_ptr be some system variable like error_zval here? */
-						if (UNEXPECTED(Z_REFCOUNTED_P(value))) {
-							if (EXPECTED(!Z_ISREF_P(value))) {
-								Z_ADDREF_P(value);
-							} else {
-								if (Z_REFCOUNT_P(value) == 1) {
-									ZVAL_UNREF(value);
-								} else {
-									value = Z_REFVAL_P(value);
-								}
-								if (Z_REFCOUNTED_P(value)) {
-									if (UNEXPECTED(Z_REFVAL_P(variable_ptr) == value)) {
-										goto exit;
-									}
-									Z_ADDREF_P(value);
-								}
-							}
-						}
-						ZVAL_COPY_VALUE(Z_REFVAL_P(variable_ptr), value);
-						zval_ptr_dtor(&garbage);
-					} else {
-						zval garbage;
-
-						ZVAL_COPY_VALUE(&garbage, variable_ptr);
-
-						/* if we assign referenced variable, we should separate it */
-						ZVAL_COPY_VALUE(variable_ptr, value);
-						if (Z_REFCOUNTED_P(variable_ptr)) {
-							Z_ADDREF_P(variable_ptr);
-							if (Z_ISREF_P(variable_ptr)) {
-								SEPARATE_ZVAL(variable_ptr);
-							}
-						}
-						zval_ptr_dtor(&garbage);
-					}
-				}
+				zend_assign_to_variable(variable_ptr, value, (IS_VAR|IS_TMP_VAR) TSRMLS_CC);
 				goto exit;
 			}
 		}

From 85d04a48d9ff508b7363cc06de070493b5c02605 Mon Sep 17 00:00:00 2001
From: Dmitry Stogov 
Date: Mon, 24 Nov 2014 23:19:24 +0300
Subject: [PATCH 087/102] Improved assignment to object property

---
 Zend/zend_execute.c | 97 +++++++++++++++++++++++++++++++++++++--------
 1 file changed, 80 insertions(+), 17 deletions(-)

diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index b56f5d40861..9ef06d25c18 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -736,38 +736,101 @@ static zend_always_inline void zend_assign_to_object(zval *retval, zval *object,
 		}
 	}
 
-	/* separate our value if necessary */
-	if (value_type == IS_TMP_VAR) {
-		ZVAL_COPY_VALUE(&tmp, value);
-		value = &tmp;
-	} else if (value_type == IS_CONST) {
-		if (UNEXPECTED(Z_OPT_COPYABLE_P(value))) {
-			ZVAL_COPY_VALUE(&tmp, value);
-			zval_copy_ctor_func(&tmp);
-			value = &tmp;
-		}
-	} else if (Z_REFCOUNTED_P(value)) {
-		Z_ADDREF_P(value);
-	}
-
 	if (opcode == ZEND_ASSIGN_OBJ) {
 		if (!Z_OBJ_HT_P(object)->write_property) {
 			zend_error(E_WARNING, "Attempt to assign property of non-object");
 			if (retval) {
 				ZVAL_NULL(retval);
 			}
-			if (value_type == IS_CONST) {
-				zval_ptr_dtor(value);
-			}
 			FREE_OP(free_value);
 			return;
 		}
+
+		if (cache_slot &&
+			EXPECTED(Z_OBJCE_P(object) == CACHED_PTR_EX(cache_slot))) {
+			zend_property_info *prop_info = CACHED_PTR_EX(cache_slot + 1);
+			zend_object *zobj = Z_OBJ_P(object);
+			zval *property;
+
+			if (EXPECTED(prop_info)) {
+				property = OBJ_PROP(zobj, prop_info->offset);
+				if (Z_TYPE_P(property) != IS_UNDEF) {
+fast_assign:
+					value = zend_assign_to_variable(property, value, value_type TSRMLS_CC);
+					if (retval && !EG(exception)) {
+						ZVAL_COPY(retval, value);
+					}
+					if (value_type == IS_VAR) {
+						FREE_OP(free_value);
+					}
+					return;
+				}
+			} else {
+				if (EXPECTED(zobj->properties != NULL)) {
+					property = zend_hash_find(zobj->properties, Z_STR_P(property_name));
+					if (property) {
+						goto fast_assign;
+					}
+				}
+
+				if (!zobj->ce->__set) {
+					if (EXPECTED(zobj->properties == NULL)) {
+						rebuild_object_properties(zobj);				
+					}
+					/* separate our value if necessary */
+					if (value_type == IS_CONST) {
+						if (UNEXPECTED(Z_OPT_COPYABLE_P(value))) {
+							ZVAL_COPY_VALUE(&tmp, value);
+							zval_copy_ctor_func(&tmp);
+							value = &tmp;
+						}
+					} else if (value_type != IS_TMP_VAR &&
+					           Z_REFCOUNTED_P(value)) {
+						Z_ADDREF_P(value);
+					}
+					zend_hash_add_new(zobj->properties, Z_STR_P(property_name), value);
+					if (retval && !EG(exception)) {
+						ZVAL_COPY(retval, value);
+					}
+					if (value_type == IS_VAR) {
+						FREE_OP(free_value);
+					}
+					return;
+				}
+	    	}
+		}
+
+		/* separate our value if necessary */
+		if (value_type == IS_CONST) {
+			if (UNEXPECTED(Z_OPT_COPYABLE_P(value))) {
+				ZVAL_COPY_VALUE(&tmp, value);
+				zval_copy_ctor_func(&tmp);
+				value = &tmp;
+			}
+		} else if (value_type != IS_TMP_VAR &&
+		           Z_REFCOUNTED_P(value)) {
+			Z_ADDREF_P(value);
+		}
+
 		Z_OBJ_HT_P(object)->write_property(object, property_name, value, cache_slot TSRMLS_CC);
 	} else {
 		/* Note:  property_name in this case is really the array index! */
 		if (!Z_OBJ_HT_P(object)->write_dimension) {
 			zend_error_noreturn(E_ERROR, "Cannot use object as array");
 		}
+
+		/* separate our value if necessary */
+		if (value_type == IS_CONST) {
+			if (UNEXPECTED(Z_OPT_COPYABLE_P(value))) {
+				ZVAL_COPY_VALUE(&tmp, value);
+				zval_copy_ctor_func(&tmp);
+				value = &tmp;
+			}
+		} else if (value_type != IS_TMP_VAR &&
+		           Z_REFCOUNTED_P(value)) {
+			Z_ADDREF_P(value);
+		}
+
 		Z_OBJ_HT_P(object)->write_dimension(object, property_name, value TSRMLS_CC);
 	}
 

From f86aa349eb068b6865c6d423054afe7f781f979e Mon Sep 17 00:00:00 2001
From: Stanislav Malyshev 
Date: Mon, 24 Nov 2014 12:26:20 -0800
Subject: [PATCH 088/102] move tests into proper place

---
 {tests/marcelod => ext/gd/tests}/imagealphablending_error1.phpt   | 0
 .../marcelod => ext/gd/tests}/imagecolorresolvealpha_error3.phpt  | 0
 {tests/marcelod => ext/gd/tests}/imagesavealpha_error2.phpt       | 0
 3 files changed, 0 insertions(+), 0 deletions(-)
 rename {tests/marcelod => ext/gd/tests}/imagealphablending_error1.phpt (100%)
 rename {tests/marcelod => ext/gd/tests}/imagecolorresolvealpha_error3.phpt (100%)
 rename {tests/marcelod => ext/gd/tests}/imagesavealpha_error2.phpt (100%)

diff --git a/tests/marcelod/imagealphablending_error1.phpt b/ext/gd/tests/imagealphablending_error1.phpt
similarity index 100%
rename from tests/marcelod/imagealphablending_error1.phpt
rename to ext/gd/tests/imagealphablending_error1.phpt
diff --git a/tests/marcelod/imagecolorresolvealpha_error3.phpt b/ext/gd/tests/imagecolorresolvealpha_error3.phpt
similarity index 100%
rename from tests/marcelod/imagecolorresolvealpha_error3.phpt
rename to ext/gd/tests/imagecolorresolvealpha_error3.phpt
diff --git a/tests/marcelod/imagesavealpha_error2.phpt b/ext/gd/tests/imagesavealpha_error2.phpt
similarity index 100%
rename from tests/marcelod/imagesavealpha_error2.phpt
rename to ext/gd/tests/imagesavealpha_error2.phpt

From a271c7a5cf77b83e54dbecb9d86099bb88d537e5 Mon Sep 17 00:00:00 2001
From: Dmitry Stogov 
Date: Tue, 25 Nov 2014 01:22:59 +0300
Subject: [PATCH 089/102] Use specialized destructors when types of zvals are
 known.

---
 Zend/zend_vm_def.h     |  33 +++--
 Zend/zend_vm_execute.h | 274 +++++++++++++++++++++--------------------
 2 files changed, 158 insertions(+), 149 deletions(-)

diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h
index cd748b73f0b..95968d8ac60 100644
--- a/Zend/zend_vm_def.h
+++ b/Zend/zend_vm_def.h
@@ -385,7 +385,7 @@ ZEND_VM_HELPER_EX(zend_binary_assign_op_obj_helper, VAR|UNUSED|CV, CONST|TMP|VAR
 					zval *value = Z_OBJ_HT_P(z)->get(z, &rv TSRMLS_CC);
 
 					if (Z_REFCOUNT_P(z) == 0) {
-						zval_dtor(z);
+						zend_objects_store_del(Z_OBJ_P(z) TSRMLS_CC);
 					}
 					ZVAL_COPY_VALUE(z, value);
 				}
@@ -711,7 +711,7 @@ ZEND_VM_HELPER_EX(zend_pre_incdec_property_helper, VAR|UNUSED|CV, CONST|TMP|VAR|
 				zval *value = Z_OBJ_HT_P(z)->get(z, &rv TSRMLS_CC);
 
 				if (Z_REFCOUNT_P(z) == 0) {
-					zval_dtor(z);
+					zend_objects_store_del(Z_OBJ_P(z) TSRMLS_CC);
 				}
 				ZVAL_COPY_VALUE(z, value);
 			}
@@ -798,7 +798,7 @@ ZEND_VM_HELPER_EX(zend_post_incdec_property_helper, VAR|UNUSED|CV, CONST|TMP|VAR
 				zval *value = Z_OBJ_HT_P(z)->get(z, &rv TSRMLS_CC);
 
 				if (Z_REFCOUNT_P(z) == 0) {
-					zval_dtor(z);
+					zend_objects_store_del(Z_OBJ_P(z) TSRMLS_CC);
 				}
 				ZVAL_COPY_VALUE(z, value);
 			}
@@ -2080,7 +2080,7 @@ ZEND_VM_HANDLER(56, ZEND_ADD_VAR, TMP|UNUSED, TMP|VAR|CV)
 	add_string_to_string(str, str, var);
 
 	if (use_copy) {
-		zval_dtor(var);
+		zend_string_release(Z_STR_P(var));
 	}
 	/* original comment, possibly problematic:
 	 * FREE_OP is missing intentionally here - we're always working on the same temporary variable
@@ -2980,9 +2980,7 @@ ZEND_VM_HANDLER(107, ZEND_CATCH, CONST, CV)
 	}
 
 	exception = EG(exception);
-	if (Z_REFCOUNTED_P(EX_VAR(opline->op2.var))) {
-		zval_ptr_dtor(EX_VAR(opline->op2.var));
-	}
+	zval_ptr_dtor(EX_VAR(opline->op2.var));
 	ZVAL_OBJ(EX_VAR(opline->op2.var), EG(exception));
 	if (UNEXPECTED(EG(exception) != exception)) {
 		GC_REFCOUNT(EG(exception))++;
@@ -3269,7 +3267,7 @@ ZEND_VM_C_LABEL(send_again):
 					if (Z_TYPE(key) == IS_STRING) {
 						zend_error(E_RECOVERABLE_ERROR,
 							"Cannot unpack Traversable with string keys");
-						zval_dtor(&key);
+						zend_string_release(Z_STR(key));
 						ZEND_VM_C_GOTO(unpack_iter_dtor);
 					}
 
@@ -3721,7 +3719,7 @@ ZEND_VM_HANDLER(68, ZEND_NEW, CONST|VAR, ANY)
 		if (RETURN_VALUE_USED(opline)) {
 			ZVAL_COPY_VALUE(EX_VAR(opline->result.var), &object_zval);
 		} else {
-			zval_ptr_dtor(&object_zval);
+			OBJ_RELEASE(Z_OBJ(object_zval));
 		}
 		ZEND_VM_JMP(opline->op2.jmp_addr);
 	} else {
@@ -3799,7 +3797,7 @@ ZEND_VM_HANDLER(110, ZEND_CLONE, CONST|TMP|VAR|UNUSED|CV, ANY)
 	if (EXPECTED(EG(exception) == NULL)) {
 		ZVAL_OBJ(EX_VAR(opline->result.var), clone_call(obj TSRMLS_CC));
 		if (!RETURN_VALUE_USED(opline) || UNEXPECTED(EG(exception) != NULL)) {
-			zval_ptr_dtor(EX_VAR(opline->result.var));
+			OBJ_RELEASE(Z_OBJ_P(EX_VAR(opline->result.var)));
 		}
 	}
 	FREE_OP1_IF_VAR();
@@ -4206,7 +4204,7 @@ ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VAR|CV, ANY)
 		}
 	}
 	if (Z_TYPE(tmp_inc_filename) != IS_UNDEF) {
-		zval_ptr_dtor(&tmp_inc_filename);
+		zend_string_release(Z_STR(tmp_inc_filename));
 	}
 	FREE_OP1();
 	if (UNEXPECTED(EG(exception) != NULL)) {
@@ -4297,8 +4295,8 @@ ZEND_VM_HANDLER(74, ZEND_UNSET_VAR, CONST|TMP|VAR|CV, UNUSED|CONST|VAR)
 			} else {
 				ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
 				if (UNEXPECTED(EG(exception) != NULL)) {
-					if (OP1_TYPE != IS_CONST) {
-						zval_dtor(&tmp);
+					if (OP1_TYPE != IS_CONST && Z_TYPE(tmp) != IS_UNDEF) {
+						zend_string_release(Z_STR(tmp));
 					}
 					FREE_OP1();
 					HANDLE_EXCEPTION();
@@ -4317,8 +4315,8 @@ ZEND_VM_HANDLER(74, ZEND_UNSET_VAR, CONST|TMP|VAR|CV, UNUSED|CONST|VAR)
 		zend_hash_del_ind(target_symbol_table, Z_STR_P(varname));
 	}
 
-	if (OP1_TYPE != IS_CONST) {
-		zval_dtor(&tmp);
+	if (OP1_TYPE != IS_CONST && Z_TYPE(tmp) != IS_UNDEF) {
+		zend_string_release(Z_STR(tmp));
 	}
 	FREE_OP1();
 	CHECK_EXCEPTION();
@@ -4901,6 +4899,7 @@ ZEND_VM_HANDLER(114, ZEND_ISSET_ISEMPTY_VAR, CONST|TMP|VAR|CV, UNUSED|CONST|VAR)
 		zend_free_op free_op1;
 		zval tmp, *varname = GET_OP1_ZVAL_PTR(BP_VAR_IS);
 
+		ZVAL_UNDEF(&tmp);
 		if (OP1_TYPE != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
 			ZVAL_STR(&tmp, zval_get_string(varname));
 			varname = &tmp;
@@ -4929,8 +4928,8 @@ ZEND_VM_HANDLER(114, ZEND_ISSET_ISEMPTY_VAR, CONST|TMP|VAR|CV, UNUSED|CONST|VAR)
 			value = zend_hash_find_ind(target_symbol_table, Z_STR_P(varname));
 		}
 
-		if (OP1_TYPE != IS_CONST && varname == &tmp) {
-			zval_dtor(&tmp);
+		if (OP1_TYPE != IS_CONST && Z_TYPE(tmp) != IS_UNDEF) {
+			zend_string_release(Z_STR(tmp));
 		}
 		FREE_OP1();
 
diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h
index a1f7a3ffc28..cd4a91f27ac 100644
--- a/Zend/zend_vm_execute.h
+++ b/Zend/zend_vm_execute.h
@@ -798,7 +798,7 @@ send_again:
 					if (Z_TYPE(key) == IS_STRING) {
 						zend_error(E_RECOVERABLE_ERROR,
 							"Cannot unpack Traversable with string keys");
-						zval_dtor(&key);
+						zend_string_release(Z_STR(key));
 						goto unpack_iter_dtor;
 					}
 
@@ -2766,7 +2766,7 @@ static int ZEND_FASTCALL  ZEND_NEW_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
 		if (RETURN_VALUE_USED(opline)) {
 			ZVAL_COPY_VALUE(EX_VAR(opline->result.var), &object_zval);
 		} else {
-			zval_ptr_dtor(&object_zval);
+			OBJ_RELEASE(Z_OBJ(object_zval));
 		}
 		ZEND_VM_JMP(opline->op2.jmp_addr);
 	} else {
@@ -2844,7 +2844,7 @@ static int ZEND_FASTCALL  ZEND_CLONE_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS
 	if (EXPECTED(EG(exception) == NULL)) {
 		ZVAL_OBJ(EX_VAR(opline->result.var), clone_call(obj TSRMLS_CC));
 		if (!RETURN_VALUE_USED(opline) || UNEXPECTED(EG(exception) != NULL)) {
-			zval_ptr_dtor(EX_VAR(opline->result.var));
+			OBJ_RELEASE(Z_OBJ_P(EX_VAR(opline->result.var)));
 		}
 	}
 
@@ -3032,7 +3032,7 @@ static int ZEND_FASTCALL  ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER(ZEND_OPCODE_HA
 		}
 	}
 	if (Z_TYPE(tmp_inc_filename) != IS_UNDEF) {
-		zval_ptr_dtor(&tmp_inc_filename);
+		zend_string_release(Z_STR(tmp_inc_filename));
 	}
 
 	if (UNEXPECTED(EG(exception) != NULL)) {
@@ -4602,8 +4602,8 @@ static int ZEND_FASTCALL  ZEND_UNSET_VAR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HA
 			} else {
 				ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
 				if (UNEXPECTED(EG(exception) != NULL)) {
-					if (IS_CONST != IS_CONST) {
-						zval_dtor(&tmp);
+					if (IS_CONST != IS_CONST && Z_TYPE(tmp) != IS_UNDEF) {
+						zend_string_release(Z_STR(tmp));
 					}
 
 					HANDLE_EXCEPTION();
@@ -4622,8 +4622,8 @@ static int ZEND_FASTCALL  ZEND_UNSET_VAR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HA
 		zend_hash_del_ind(target_symbol_table, Z_STR_P(varname));
 	}
 
-	if (IS_CONST != IS_CONST) {
-		zval_dtor(&tmp);
+	if (IS_CONST != IS_CONST && Z_TYPE(tmp) != IS_UNDEF) {
+		zend_string_release(Z_STR(tmp));
 	}
 
 	CHECK_EXCEPTION();
@@ -4654,6 +4654,7 @@ static int ZEND_FASTCALL  ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_CONST_HANDLER(ZEND_O
 
 		zval tmp, *varname = opline->op1.zv;
 
+		ZVAL_UNDEF(&tmp);
 		if (IS_CONST != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
 			ZVAL_STR(&tmp, zval_get_string(varname));
 			varname = &tmp;
@@ -4682,8 +4683,8 @@ static int ZEND_FASTCALL  ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_CONST_HANDLER(ZEND_O
 			value = zend_hash_find_ind(target_symbol_table, Z_STR_P(varname));
 		}
 
-		if (IS_CONST != IS_CONST && varname == &tmp) {
-			zval_dtor(&tmp);
+		if (IS_CONST != IS_CONST && Z_TYPE(tmp) != IS_UNDEF) {
+			zend_string_release(Z_STR(tmp));
 		}
 
 		if (opline->extended_value & ZEND_ISSET) {
@@ -7104,8 +7105,8 @@ static int ZEND_FASTCALL  ZEND_UNSET_VAR_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HAND
 			} else {
 				ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
 				if (UNEXPECTED(EG(exception) != NULL)) {
-					if (IS_CONST != IS_CONST) {
-						zval_dtor(&tmp);
+					if (IS_CONST != IS_CONST && Z_TYPE(tmp) != IS_UNDEF) {
+						zend_string_release(Z_STR(tmp));
 					}
 
 					HANDLE_EXCEPTION();
@@ -7124,8 +7125,8 @@ static int ZEND_FASTCALL  ZEND_UNSET_VAR_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HAND
 		zend_hash_del_ind(target_symbol_table, Z_STR_P(varname));
 	}
 
-	if (IS_CONST != IS_CONST) {
-		zval_dtor(&tmp);
+	if (IS_CONST != IS_CONST && Z_TYPE(tmp) != IS_UNDEF) {
+		zend_string_release(Z_STR(tmp));
 	}
 
 	CHECK_EXCEPTION();
@@ -7156,6 +7157,7 @@ static int ZEND_FASTCALL  ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_VAR_HANDLER(ZEND_OPC
 
 		zval tmp, *varname = opline->op1.zv;
 
+		ZVAL_UNDEF(&tmp);
 		if (IS_CONST != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
 			ZVAL_STR(&tmp, zval_get_string(varname));
 			varname = &tmp;
@@ -7184,8 +7186,8 @@ static int ZEND_FASTCALL  ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_VAR_HANDLER(ZEND_OPC
 			value = zend_hash_find_ind(target_symbol_table, Z_STR_P(varname));
 		}
 
-		if (IS_CONST != IS_CONST && varname == &tmp) {
-			zval_dtor(&tmp);
+		if (IS_CONST != IS_CONST && Z_TYPE(tmp) != IS_UNDEF) {
+			zend_string_release(Z_STR(tmp));
 		}
 
 		if (opline->extended_value & ZEND_ISSET) {
@@ -7969,8 +7971,8 @@ static int ZEND_FASTCALL  ZEND_UNSET_VAR_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_H
 			} else {
 				ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
 				if (UNEXPECTED(EG(exception) != NULL)) {
-					if (IS_CONST != IS_CONST) {
-						zval_dtor(&tmp);
+					if (IS_CONST != IS_CONST && Z_TYPE(tmp) != IS_UNDEF) {
+						zend_string_release(Z_STR(tmp));
 					}
 
 					HANDLE_EXCEPTION();
@@ -7989,8 +7991,8 @@ static int ZEND_FASTCALL  ZEND_UNSET_VAR_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_H
 		zend_hash_del_ind(target_symbol_table, Z_STR_P(varname));
 	}
 
-	if (IS_CONST != IS_CONST) {
-		zval_dtor(&tmp);
+	if (IS_CONST != IS_CONST && Z_TYPE(tmp) != IS_UNDEF) {
+		zend_string_release(Z_STR(tmp));
 	}
 
 	CHECK_EXCEPTION();
@@ -8021,6 +8023,7 @@ static int ZEND_FASTCALL  ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_UNUSED_HANDLER(ZEND_
 
 		zval tmp, *varname = opline->op1.zv;
 
+		ZVAL_UNDEF(&tmp);
 		if (IS_CONST != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
 			ZVAL_STR(&tmp, zval_get_string(varname));
 			varname = &tmp;
@@ -8049,8 +8052,8 @@ static int ZEND_FASTCALL  ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_UNUSED_HANDLER(ZEND_
 			value = zend_hash_find_ind(target_symbol_table, Z_STR_P(varname));
 		}
 
-		if (IS_CONST != IS_CONST && varname == &tmp) {
-			zval_dtor(&tmp);
+		if (IS_CONST != IS_CONST && Z_TYPE(tmp) != IS_UNDEF) {
+			zend_string_release(Z_STR(tmp));
 		}
 
 		if (opline->extended_value & ZEND_ISSET) {
@@ -8921,9 +8924,7 @@ static int ZEND_FASTCALL  ZEND_CATCH_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_A
 	}
 
 	exception = EG(exception);
-	if (Z_REFCOUNTED_P(EX_VAR(opline->op2.var))) {
-		zval_ptr_dtor(EX_VAR(opline->op2.var));
-	}
+	zval_ptr_dtor(EX_VAR(opline->op2.var));
 	ZVAL_OBJ(EX_VAR(opline->op2.var), EG(exception));
 	if (UNEXPECTED(EG(exception) != exception)) {
 		GC_REFCOUNT(EG(exception))++;
@@ -9807,7 +9808,7 @@ static int ZEND_FASTCALL  ZEND_CLONE_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
 	if (EXPECTED(EG(exception) == NULL)) {
 		ZVAL_OBJ(EX_VAR(opline->result.var), clone_call(obj TSRMLS_CC));
 		if (!RETURN_VALUE_USED(opline) || UNEXPECTED(EG(exception) != NULL)) {
-			zval_ptr_dtor(EX_VAR(opline->result.var));
+			OBJ_RELEASE(Z_OBJ_P(EX_VAR(opline->result.var)));
 		}
 	}
 
@@ -9996,7 +9997,7 @@ static int ZEND_FASTCALL  ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER(ZEND_OPCODE_HAND
 		}
 	}
 	if (Z_TYPE(tmp_inc_filename) != IS_UNDEF) {
-		zval_ptr_dtor(&tmp_inc_filename);
+		zend_string_release(Z_STR(tmp_inc_filename));
 	}
 	zval_ptr_dtor_nogc(free_op1);
 	if (UNEXPECTED(EG(exception) != NULL)) {
@@ -11433,8 +11434,8 @@ static int ZEND_FASTCALL  ZEND_UNSET_VAR_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HAND
 			} else {
 				ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
 				if (UNEXPECTED(EG(exception) != NULL)) {
-					if (IS_TMP_VAR != IS_CONST) {
-						zval_dtor(&tmp);
+					if (IS_TMP_VAR != IS_CONST && Z_TYPE(tmp) != IS_UNDEF) {
+						zend_string_release(Z_STR(tmp));
 					}
 					zval_ptr_dtor_nogc(free_op1);
 					HANDLE_EXCEPTION();
@@ -11453,8 +11454,8 @@ static int ZEND_FASTCALL  ZEND_UNSET_VAR_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HAND
 		zend_hash_del_ind(target_symbol_table, Z_STR_P(varname));
 	}
 
-	if (IS_TMP_VAR != IS_CONST) {
-		zval_dtor(&tmp);
+	if (IS_TMP_VAR != IS_CONST && Z_TYPE(tmp) != IS_UNDEF) {
+		zend_string_release(Z_STR(tmp));
 	}
 	zval_ptr_dtor_nogc(free_op1);
 	CHECK_EXCEPTION();
@@ -11485,6 +11486,7 @@ static int ZEND_FASTCALL  ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_CONST_HANDLER(ZEND_OPC
 		zend_free_op free_op1;
 		zval tmp, *varname = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1);
 
+		ZVAL_UNDEF(&tmp);
 		if (IS_TMP_VAR != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
 			ZVAL_STR(&tmp, zval_get_string(varname));
 			varname = &tmp;
@@ -11513,8 +11515,8 @@ static int ZEND_FASTCALL  ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_CONST_HANDLER(ZEND_OPC
 			value = zend_hash_find_ind(target_symbol_table, Z_STR_P(varname));
 		}
 
-		if (IS_TMP_VAR != IS_CONST && varname == &tmp) {
-			zval_dtor(&tmp);
+		if (IS_TMP_VAR != IS_CONST && Z_TYPE(tmp) != IS_UNDEF) {
+			zend_string_release(Z_STR(tmp));
 		}
 		zval_ptr_dtor_nogc(free_op1);
 
@@ -12375,7 +12377,7 @@ static int ZEND_FASTCALL  ZEND_ADD_VAR_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HANDLER_
 	add_string_to_string(str, str, var);
 
 	if (use_copy) {
-		zval_dtor(var);
+		zend_string_release(Z_STR_P(var));
 	}
 	/* original comment, possibly problematic:
 	 * FREE_OP is missing intentionally here - we're always working on the same temporary variable
@@ -13585,7 +13587,7 @@ static int ZEND_FASTCALL  ZEND_ADD_VAR_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLER_
 	add_string_to_string(str, str, var);
 
 	if (use_copy) {
-		zval_dtor(var);
+		zend_string_release(Z_STR_P(var));
 	}
 	/* original comment, possibly problematic:
 	 * FREE_OP is missing intentionally here - we're always working on the same temporary variable
@@ -13888,8 +13890,8 @@ static int ZEND_FASTCALL  ZEND_UNSET_VAR_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLE
 			} else {
 				ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
 				if (UNEXPECTED(EG(exception) != NULL)) {
-					if (IS_TMP_VAR != IS_CONST) {
-						zval_dtor(&tmp);
+					if (IS_TMP_VAR != IS_CONST && Z_TYPE(tmp) != IS_UNDEF) {
+						zend_string_release(Z_STR(tmp));
 					}
 					zval_ptr_dtor_nogc(free_op1);
 					HANDLE_EXCEPTION();
@@ -13908,8 +13910,8 @@ static int ZEND_FASTCALL  ZEND_UNSET_VAR_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HANDLE
 		zend_hash_del_ind(target_symbol_table, Z_STR_P(varname));
 	}
 
-	if (IS_TMP_VAR != IS_CONST) {
-		zval_dtor(&tmp);
+	if (IS_TMP_VAR != IS_CONST && Z_TYPE(tmp) != IS_UNDEF) {
+		zend_string_release(Z_STR(tmp));
 	}
 	zval_ptr_dtor_nogc(free_op1);
 	CHECK_EXCEPTION();
@@ -13940,6 +13942,7 @@ static int ZEND_FASTCALL  ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_VAR_HANDLER(ZEND_OPCOD
 		zend_free_op free_op1;
 		zval tmp, *varname = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1);
 
+		ZVAL_UNDEF(&tmp);
 		if (IS_TMP_VAR != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
 			ZVAL_STR(&tmp, zval_get_string(varname));
 			varname = &tmp;
@@ -13968,8 +13971,8 @@ static int ZEND_FASTCALL  ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_VAR_HANDLER(ZEND_OPCOD
 			value = zend_hash_find_ind(target_symbol_table, Z_STR_P(varname));
 		}
 
-		if (IS_TMP_VAR != IS_CONST && varname == &tmp) {
-			zval_dtor(&tmp);
+		if (IS_TMP_VAR != IS_CONST && Z_TYPE(tmp) != IS_UNDEF) {
+			zend_string_release(Z_STR(tmp));
 		}
 		zval_ptr_dtor_nogc(free_op1);
 
@@ -14669,8 +14672,8 @@ static int ZEND_FASTCALL  ZEND_UNSET_VAR_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HAN
 			} else {
 				ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
 				if (UNEXPECTED(EG(exception) != NULL)) {
-					if (IS_TMP_VAR != IS_CONST) {
-						zval_dtor(&tmp);
+					if (IS_TMP_VAR != IS_CONST && Z_TYPE(tmp) != IS_UNDEF) {
+						zend_string_release(Z_STR(tmp));
 					}
 					zval_ptr_dtor_nogc(free_op1);
 					HANDLE_EXCEPTION();
@@ -14689,8 +14692,8 @@ static int ZEND_FASTCALL  ZEND_UNSET_VAR_SPEC_TMP_UNUSED_HANDLER(ZEND_OPCODE_HAN
 		zend_hash_del_ind(target_symbol_table, Z_STR_P(varname));
 	}
 
-	if (IS_TMP_VAR != IS_CONST) {
-		zval_dtor(&tmp);
+	if (IS_TMP_VAR != IS_CONST && Z_TYPE(tmp) != IS_UNDEF) {
+		zend_string_release(Z_STR(tmp));
 	}
 	zval_ptr_dtor_nogc(free_op1);
 	CHECK_EXCEPTION();
@@ -14721,6 +14724,7 @@ static int ZEND_FASTCALL  ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_UNUSED_HANDLER(ZEND_OP
 		zend_free_op free_op1;
 		zval tmp, *varname = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1);
 
+		ZVAL_UNDEF(&tmp);
 		if (IS_TMP_VAR != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
 			ZVAL_STR(&tmp, zval_get_string(varname));
 			varname = &tmp;
@@ -14749,8 +14753,8 @@ static int ZEND_FASTCALL  ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_UNUSED_HANDLER(ZEND_OP
 			value = zend_hash_find_ind(target_symbol_table, Z_STR_P(varname));
 		}
 
-		if (IS_TMP_VAR != IS_CONST && varname == &tmp) {
-			zval_dtor(&tmp);
+		if (IS_TMP_VAR != IS_CONST && Z_TYPE(tmp) != IS_UNDEF) {
+			zend_string_release(Z_STR(tmp));
 		}
 		zval_ptr_dtor_nogc(free_op1);
 
@@ -15410,7 +15414,7 @@ static int ZEND_FASTCALL  ZEND_ADD_VAR_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDLER_A
 	add_string_to_string(str, str, var);
 
 	if (use_copy) {
-		zval_dtor(var);
+		zend_string_release(Z_STR_P(var));
 	}
 	/* original comment, possibly problematic:
 	 * FREE_OP is missing intentionally here - we're always working on the same temporary variable
@@ -16715,7 +16719,7 @@ static int ZEND_FASTCALL  ZEND_NEW_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
 		if (RETURN_VALUE_USED(opline)) {
 			ZVAL_COPY_VALUE(EX_VAR(opline->result.var), &object_zval);
 		} else {
-			zval_ptr_dtor(&object_zval);
+			OBJ_RELEASE(Z_OBJ(object_zval));
 		}
 		ZEND_VM_JMP(opline->op2.jmp_addr);
 	} else {
@@ -16793,7 +16797,7 @@ static int ZEND_FASTCALL  ZEND_CLONE_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
 	if (EXPECTED(EG(exception) == NULL)) {
 		ZVAL_OBJ(EX_VAR(opline->result.var), clone_call(obj TSRMLS_CC));
 		if (!RETURN_VALUE_USED(opline) || UNEXPECTED(EG(exception) != NULL)) {
-			zval_ptr_dtor(EX_VAR(opline->result.var));
+			OBJ_RELEASE(Z_OBJ_P(EX_VAR(opline->result.var)));
 		}
 	}
 	zval_ptr_dtor_nogc(free_op1);
@@ -16983,7 +16987,7 @@ static int ZEND_FASTCALL  ZEND_INCLUDE_OR_EVAL_SPEC_VAR_HANDLER(ZEND_OPCODE_HAND
 		}
 	}
 	if (Z_TYPE(tmp_inc_filename) != IS_UNDEF) {
-		zval_ptr_dtor(&tmp_inc_filename);
+		zend_string_release(Z_STR(tmp_inc_filename));
 	}
 	zval_ptr_dtor_nogc(free_op1);
 	if (UNEXPECTED(EG(exception) != NULL)) {
@@ -18003,7 +18007,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_CONST(int (*b
 					zval *value = Z_OBJ_HT_P(z)->get(z, &rv TSRMLS_CC);
 
 					if (Z_REFCOUNT_P(z) == 0) {
-						zval_dtor(z);
+						zend_objects_store_del(Z_OBJ_P(z) TSRMLS_CC);
 					}
 					ZVAL_COPY_VALUE(z, value);
 				}
@@ -18326,7 +18330,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_VAR_CONST(incdec_t
 				zval *value = Z_OBJ_HT_P(z)->get(z, &rv TSRMLS_CC);
 
 				if (Z_REFCOUNT_P(z) == 0) {
-					zval_dtor(z);
+					zend_objects_store_del(Z_OBJ_P(z) TSRMLS_CC);
 				}
 				ZVAL_COPY_VALUE(z, value);
 			}
@@ -18412,7 +18416,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_CONST(incdec_
 				zval *value = Z_OBJ_HT_P(z)->get(z, &rv TSRMLS_CC);
 
 				if (Z_REFCOUNT_P(z) == 0) {
-					zval_dtor(z);
+					zend_objects_store_del(Z_OBJ_P(z) TSRMLS_CC);
 				}
 				ZVAL_COPY_VALUE(z, value);
 			}
@@ -19600,8 +19604,8 @@ static int ZEND_FASTCALL  ZEND_UNSET_VAR_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HAND
 			} else {
 				ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
 				if (UNEXPECTED(EG(exception) != NULL)) {
-					if (IS_VAR != IS_CONST) {
-						zval_dtor(&tmp);
+					if (IS_VAR != IS_CONST && Z_TYPE(tmp) != IS_UNDEF) {
+						zend_string_release(Z_STR(tmp));
 					}
 					zval_ptr_dtor_nogc(free_op1);
 					HANDLE_EXCEPTION();
@@ -19620,8 +19624,8 @@ static int ZEND_FASTCALL  ZEND_UNSET_VAR_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HAND
 		zend_hash_del_ind(target_symbol_table, Z_STR_P(varname));
 	}
 
-	if (IS_VAR != IS_CONST) {
-		zval_dtor(&tmp);
+	if (IS_VAR != IS_CONST && Z_TYPE(tmp) != IS_UNDEF) {
+		zend_string_release(Z_STR(tmp));
 	}
 	zval_ptr_dtor_nogc(free_op1);
 	CHECK_EXCEPTION();
@@ -19765,6 +19769,7 @@ static int ZEND_FASTCALL  ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_CONST_HANDLER(ZEND_OPC
 		zend_free_op free_op1;
 		zval tmp, *varname = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1);
 
+		ZVAL_UNDEF(&tmp);
 		if (IS_VAR != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
 			ZVAL_STR(&tmp, zval_get_string(varname));
 			varname = &tmp;
@@ -19793,8 +19798,8 @@ static int ZEND_FASTCALL  ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_CONST_HANDLER(ZEND_OPC
 			value = zend_hash_find_ind(target_symbol_table, Z_STR_P(varname));
 		}
 
-		if (IS_VAR != IS_CONST && varname == &tmp) {
-			zval_dtor(&tmp);
+		if (IS_VAR != IS_CONST && Z_TYPE(tmp) != IS_UNDEF) {
+			zend_string_release(Z_STR(tmp));
 		}
 		zval_ptr_dtor_nogc(free_op1);
 
@@ -20482,7 +20487,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_TMP(int (*bin
 					zval *value = Z_OBJ_HT_P(z)->get(z, &rv TSRMLS_CC);
 
 					if (Z_REFCOUNT_P(z) == 0) {
-						zval_dtor(z);
+						zend_objects_store_del(Z_OBJ_P(z) TSRMLS_CC);
 					}
 					ZVAL_COPY_VALUE(z, value);
 				}
@@ -20808,7 +20813,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_VAR_TMP(incdec_t i
 				zval *value = Z_OBJ_HT_P(z)->get(z, &rv TSRMLS_CC);
 
 				if (Z_REFCOUNT_P(z) == 0) {
-					zval_dtor(z);
+					zend_objects_store_del(Z_OBJ_P(z) TSRMLS_CC);
 				}
 				ZVAL_COPY_VALUE(z, value);
 			}
@@ -20895,7 +20900,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_TMP(incdec_t
 				zval *value = Z_OBJ_HT_P(z)->get(z, &rv TSRMLS_CC);
 
 				if (Z_REFCOUNT_P(z) == 0) {
-					zval_dtor(z);
+					zend_objects_store_del(Z_OBJ_P(z) TSRMLS_CC);
 				}
 				ZVAL_COPY_VALUE(z, value);
 			}
@@ -22508,7 +22513,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_VAR(int (*bin
 					zval *value = Z_OBJ_HT_P(z)->get(z, &rv TSRMLS_CC);
 
 					if (Z_REFCOUNT_P(z) == 0) {
-						zval_dtor(z);
+						zend_objects_store_del(Z_OBJ_P(z) TSRMLS_CC);
 					}
 					ZVAL_COPY_VALUE(z, value);
 				}
@@ -22834,7 +22839,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_VAR_VAR(incdec_t i
 				zval *value = Z_OBJ_HT_P(z)->get(z, &rv TSRMLS_CC);
 
 				if (Z_REFCOUNT_P(z) == 0) {
-					zval_dtor(z);
+					zend_objects_store_del(Z_OBJ_P(z) TSRMLS_CC);
 				}
 				ZVAL_COPY_VALUE(z, value);
 			}
@@ -22921,7 +22926,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_VAR(incdec_t
 				zval *value = Z_OBJ_HT_P(z)->get(z, &rv TSRMLS_CC);
 
 				if (Z_REFCOUNT_P(z) == 0) {
-					zval_dtor(z);
+					zend_objects_store_del(Z_OBJ_P(z) TSRMLS_CC);
 				}
 				ZVAL_COPY_VALUE(z, value);
 			}
@@ -24049,8 +24054,8 @@ static int ZEND_FASTCALL  ZEND_UNSET_VAR_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLE
 			} else {
 				ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
 				if (UNEXPECTED(EG(exception) != NULL)) {
-					if (IS_VAR != IS_CONST) {
-						zval_dtor(&tmp);
+					if (IS_VAR != IS_CONST && Z_TYPE(tmp) != IS_UNDEF) {
+						zend_string_release(Z_STR(tmp));
 					}
 					zval_ptr_dtor_nogc(free_op1);
 					HANDLE_EXCEPTION();
@@ -24069,8 +24074,8 @@ static int ZEND_FASTCALL  ZEND_UNSET_VAR_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HANDLE
 		zend_hash_del_ind(target_symbol_table, Z_STR_P(varname));
 	}
 
-	if (IS_VAR != IS_CONST) {
-		zval_dtor(&tmp);
+	if (IS_VAR != IS_CONST && Z_TYPE(tmp) != IS_UNDEF) {
+		zend_string_release(Z_STR(tmp));
 	}
 	zval_ptr_dtor_nogc(free_op1);
 	CHECK_EXCEPTION();
@@ -24214,6 +24219,7 @@ static int ZEND_FASTCALL  ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_VAR_HANDLER(ZEND_OPCOD
 		zend_free_op free_op1;
 		zval tmp, *varname = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1);
 
+		ZVAL_UNDEF(&tmp);
 		if (IS_VAR != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
 			ZVAL_STR(&tmp, zval_get_string(varname));
 			varname = &tmp;
@@ -24242,8 +24248,8 @@ static int ZEND_FASTCALL  ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_VAR_HANDLER(ZEND_OPCOD
 			value = zend_hash_find_ind(target_symbol_table, Z_STR_P(varname));
 		}
 
-		if (IS_VAR != IS_CONST && varname == &tmp) {
-			zval_dtor(&tmp);
+		if (IS_VAR != IS_CONST && Z_TYPE(tmp) != IS_UNDEF) {
+			zend_string_release(Z_STR(tmp));
 		}
 		zval_ptr_dtor_nogc(free_op1);
 
@@ -24658,7 +24664,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_UNUSED(int (*
 					zval *value = Z_OBJ_HT_P(z)->get(z, &rv TSRMLS_CC);
 
 					if (Z_REFCOUNT_P(z) == 0) {
-						zval_dtor(z);
+						zend_objects_store_del(Z_OBJ_P(z) TSRMLS_CC);
 					}
 					ZVAL_COPY_VALUE(z, value);
 				}
@@ -25507,8 +25513,8 @@ static int ZEND_FASTCALL  ZEND_UNSET_VAR_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HAN
 			} else {
 				ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
 				if (UNEXPECTED(EG(exception) != NULL)) {
-					if (IS_VAR != IS_CONST) {
-						zval_dtor(&tmp);
+					if (IS_VAR != IS_CONST && Z_TYPE(tmp) != IS_UNDEF) {
+						zend_string_release(Z_STR(tmp));
 					}
 					zval_ptr_dtor_nogc(free_op1);
 					HANDLE_EXCEPTION();
@@ -25527,8 +25533,8 @@ static int ZEND_FASTCALL  ZEND_UNSET_VAR_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HAN
 		zend_hash_del_ind(target_symbol_table, Z_STR_P(varname));
 	}
 
-	if (IS_VAR != IS_CONST) {
-		zval_dtor(&tmp);
+	if (IS_VAR != IS_CONST && Z_TYPE(tmp) != IS_UNDEF) {
+		zend_string_release(Z_STR(tmp));
 	}
 	zval_ptr_dtor_nogc(free_op1);
 	CHECK_EXCEPTION();
@@ -25559,6 +25565,7 @@ static int ZEND_FASTCALL  ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_UNUSED_HANDLER(ZEND_OP
 		zend_free_op free_op1;
 		zval tmp, *varname = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1);
 
+		ZVAL_UNDEF(&tmp);
 		if (IS_VAR != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
 			ZVAL_STR(&tmp, zval_get_string(varname));
 			varname = &tmp;
@@ -25587,8 +25594,8 @@ static int ZEND_FASTCALL  ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_UNUSED_HANDLER(ZEND_OP
 			value = zend_hash_find_ind(target_symbol_table, Z_STR_P(varname));
 		}
 
-		if (IS_VAR != IS_CONST && varname == &tmp) {
-			zval_dtor(&tmp);
+		if (IS_VAR != IS_CONST && Z_TYPE(tmp) != IS_UNDEF) {
+			zend_string_release(Z_STR(tmp));
 		}
 		zval_ptr_dtor_nogc(free_op1);
 
@@ -26095,7 +26102,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_VAR_CV(int (*bina
 					zval *value = Z_OBJ_HT_P(z)->get(z, &rv TSRMLS_CC);
 
 					if (Z_REFCOUNT_P(z) == 0) {
-						zval_dtor(z);
+						zend_objects_store_del(Z_OBJ_P(z) TSRMLS_CC);
 					}
 					ZVAL_COPY_VALUE(z, value);
 				}
@@ -26418,7 +26425,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_VAR_CV(incdec_t in
 				zval *value = Z_OBJ_HT_P(z)->get(z, &rv TSRMLS_CC);
 
 				if (Z_REFCOUNT_P(z) == 0) {
-					zval_dtor(z);
+					zend_objects_store_del(Z_OBJ_P(z) TSRMLS_CC);
 				}
 				ZVAL_COPY_VALUE(z, value);
 			}
@@ -26504,7 +26511,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_CV(incdec_t i
 				zval *value = Z_OBJ_HT_P(z)->get(z, &rv TSRMLS_CC);
 
 				if (Z_REFCOUNT_P(z) == 0) {
-					zval_dtor(z);
+					zend_objects_store_del(Z_OBJ_P(z) TSRMLS_CC);
 				}
 				ZVAL_COPY_VALUE(z, value);
 			}
@@ -27890,7 +27897,7 @@ static int ZEND_FASTCALL  ZEND_CLONE_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARG
 	if (EXPECTED(EG(exception) == NULL)) {
 		ZVAL_OBJ(EX_VAR(opline->result.var), clone_call(obj TSRMLS_CC));
 		if (!RETURN_VALUE_USED(opline) || UNEXPECTED(EG(exception) != NULL)) {
-			zval_ptr_dtor(EX_VAR(opline->result.var));
+			OBJ_RELEASE(Z_OBJ_P(EX_VAR(opline->result.var)));
 		}
 	}
 
@@ -27979,7 +27986,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_CONST(int
 					zval *value = Z_OBJ_HT_P(z)->get(z, &rv TSRMLS_CC);
 
 					if (Z_REFCOUNT_P(z) == 0) {
-						zval_dtor(z);
+						zend_objects_store_del(Z_OBJ_P(z) TSRMLS_CC);
 					}
 					ZVAL_COPY_VALUE(z, value);
 				}
@@ -28301,7 +28308,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_UNUSED_CONST(incde
 				zval *value = Z_OBJ_HT_P(z)->get(z, &rv TSRMLS_CC);
 
 				if (Z_REFCOUNT_P(z) == 0) {
-					zval_dtor(z);
+					zend_objects_store_del(Z_OBJ_P(z) TSRMLS_CC);
 				}
 				ZVAL_COPY_VALUE(z, value);
 			}
@@ -28387,7 +28394,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_CONST(incd
 				zval *value = Z_OBJ_HT_P(z)->get(z, &rv TSRMLS_CC);
 
 				if (Z_REFCOUNT_P(z) == 0) {
-					zval_dtor(z);
+					zend_objects_store_del(Z_OBJ_P(z) TSRMLS_CC);
 				}
 				ZVAL_COPY_VALUE(z, value);
 			}
@@ -29380,7 +29387,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_TMP(int (*
 					zval *value = Z_OBJ_HT_P(z)->get(z, &rv TSRMLS_CC);
 
 					if (Z_REFCOUNT_P(z) == 0) {
-						zval_dtor(z);
+						zend_objects_store_del(Z_OBJ_P(z) TSRMLS_CC);
 					}
 					ZVAL_COPY_VALUE(z, value);
 				}
@@ -29705,7 +29712,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_UNUSED_TMP(incdec_
 				zval *value = Z_OBJ_HT_P(z)->get(z, &rv TSRMLS_CC);
 
 				if (Z_REFCOUNT_P(z) == 0) {
-					zval_dtor(z);
+					zend_objects_store_del(Z_OBJ_P(z) TSRMLS_CC);
 				}
 				ZVAL_COPY_VALUE(z, value);
 			}
@@ -29792,7 +29799,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_TMP(incdec
 				zval *value = Z_OBJ_HT_P(z)->get(z, &rv TSRMLS_CC);
 
 				if (Z_REFCOUNT_P(z) == 0) {
-					zval_dtor(z);
+					zend_objects_store_del(Z_OBJ_P(z) TSRMLS_CC);
 				}
 				ZVAL_COPY_VALUE(z, value);
 			}
@@ -30092,7 +30099,7 @@ static int ZEND_FASTCALL  ZEND_ADD_VAR_SPEC_UNUSED_TMP_HANDLER(ZEND_OPCODE_HANDL
 	add_string_to_string(str, str, var);
 
 	if (use_copy) {
-		zval_dtor(var);
+		zend_string_release(Z_STR_P(var));
 	}
 	/* original comment, possibly problematic:
 	 * FREE_OP is missing intentionally here - we're always working on the same temporary variable
@@ -30699,7 +30706,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_VAR(int (*
 					zval *value = Z_OBJ_HT_P(z)->get(z, &rv TSRMLS_CC);
 
 					if (Z_REFCOUNT_P(z) == 0) {
-						zval_dtor(z);
+						zend_objects_store_del(Z_OBJ_P(z) TSRMLS_CC);
 					}
 					ZVAL_COPY_VALUE(z, value);
 				}
@@ -31024,7 +31031,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_UNUSED_VAR(incdec_
 				zval *value = Z_OBJ_HT_P(z)->get(z, &rv TSRMLS_CC);
 
 				if (Z_REFCOUNT_P(z) == 0) {
-					zval_dtor(z);
+					zend_objects_store_del(Z_OBJ_P(z) TSRMLS_CC);
 				}
 				ZVAL_COPY_VALUE(z, value);
 			}
@@ -31111,7 +31118,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_VAR(incdec
 				zval *value = Z_OBJ_HT_P(z)->get(z, &rv TSRMLS_CC);
 
 				if (Z_REFCOUNT_P(z) == 0) {
-					zval_dtor(z);
+					zend_objects_store_del(Z_OBJ_P(z) TSRMLS_CC);
 				}
 				ZVAL_COPY_VALUE(z, value);
 			}
@@ -31411,7 +31418,7 @@ static int ZEND_FASTCALL  ZEND_ADD_VAR_SPEC_UNUSED_VAR_HANDLER(ZEND_OPCODE_HANDL
 	add_string_to_string(str, str, var);
 
 	if (use_copy) {
-		zval_dtor(var);
+		zend_string_release(Z_STR_P(var));
 	}
 	/* original comment, possibly problematic:
 	 * FREE_OP is missing intentionally here - we're always working on the same temporary variable
@@ -32018,7 +32025,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_UNUSED(int
 					zval *value = Z_OBJ_HT_P(z)->get(z, &rv TSRMLS_CC);
 
 					if (Z_REFCOUNT_P(z) == 0) {
-						zval_dtor(z);
+						zend_objects_store_del(Z_OBJ_P(z) TSRMLS_CC);
 					}
 					ZVAL_COPY_VALUE(z, value);
 				}
@@ -32510,7 +32517,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_UNUSED_CV(int (*b
 					zval *value = Z_OBJ_HT_P(z)->get(z, &rv TSRMLS_CC);
 
 					if (Z_REFCOUNT_P(z) == 0) {
-						zval_dtor(z);
+						zend_objects_store_del(Z_OBJ_P(z) TSRMLS_CC);
 					}
 					ZVAL_COPY_VALUE(z, value);
 				}
@@ -32832,7 +32839,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_UNUSED_CV(incdec_t
 				zval *value = Z_OBJ_HT_P(z)->get(z, &rv TSRMLS_CC);
 
 				if (Z_REFCOUNT_P(z) == 0) {
-					zval_dtor(z);
+					zend_objects_store_del(Z_OBJ_P(z) TSRMLS_CC);
 				}
 				ZVAL_COPY_VALUE(z, value);
 			}
@@ -32918,7 +32925,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_CV(incdec_
 				zval *value = Z_OBJ_HT_P(z)->get(z, &rv TSRMLS_CC);
 
 				if (Z_REFCOUNT_P(z) == 0) {
-					zval_dtor(z);
+					zend_objects_store_del(Z_OBJ_P(z) TSRMLS_CC);
 				}
 				ZVAL_COPY_VALUE(z, value);
 			}
@@ -33215,7 +33222,7 @@ static int ZEND_FASTCALL  ZEND_ADD_VAR_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLE
 	add_string_to_string(str, str, var);
 
 	if (use_copy) {
-		zval_dtor(var);
+		zend_string_release(Z_STR_P(var));
 	}
 	/* original comment, possibly problematic:
 	 * FREE_OP is missing intentionally here - we're always working on the same temporary variable
@@ -34512,7 +34519,7 @@ static int ZEND_FASTCALL  ZEND_CLONE_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
 	if (EXPECTED(EG(exception) == NULL)) {
 		ZVAL_OBJ(EX_VAR(opline->result.var), clone_call(obj TSRMLS_CC));
 		if (!RETURN_VALUE_USED(opline) || UNEXPECTED(EG(exception) != NULL)) {
-			zval_ptr_dtor(EX_VAR(opline->result.var));
+			OBJ_RELEASE(Z_OBJ_P(EX_VAR(opline->result.var)));
 		}
 	}
 
@@ -34700,7 +34707,7 @@ static int ZEND_FASTCALL  ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDL
 		}
 	}
 	if (Z_TYPE(tmp_inc_filename) != IS_UNDEF) {
-		zval_ptr_dtor(&tmp_inc_filename);
+		zend_string_release(Z_STR(tmp_inc_filename));
 	}
 
 	if (UNEXPECTED(EG(exception) != NULL)) {
@@ -35468,7 +35475,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_CONST(int (*bi
 					zval *value = Z_OBJ_HT_P(z)->get(z, &rv TSRMLS_CC);
 
 					if (Z_REFCOUNT_P(z) == 0) {
-						zval_dtor(z);
+						zend_objects_store_del(Z_OBJ_P(z) TSRMLS_CC);
 					}
 					ZVAL_COPY_VALUE(z, value);
 				}
@@ -35790,7 +35797,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_CV_CONST(incdec_t
 				zval *value = Z_OBJ_HT_P(z)->get(z, &rv TSRMLS_CC);
 
 				if (Z_REFCOUNT_P(z) == 0) {
-					zval_dtor(z);
+					zend_objects_store_del(Z_OBJ_P(z) TSRMLS_CC);
 				}
 				ZVAL_COPY_VALUE(z, value);
 			}
@@ -35876,7 +35883,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_CONST(incdec_t
 				zval *value = Z_OBJ_HT_P(z)->get(z, &rv TSRMLS_CC);
 
 				if (Z_REFCOUNT_P(z) == 0) {
-					zval_dtor(z);
+					zend_objects_store_del(Z_OBJ_P(z) TSRMLS_CC);
 				}
 				ZVAL_COPY_VALUE(z, value);
 			}
@@ -36840,8 +36847,8 @@ static int ZEND_FASTCALL  ZEND_UNSET_VAR_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDL
 			} else {
 				ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
 				if (UNEXPECTED(EG(exception) != NULL)) {
-					if (IS_CV != IS_CONST) {
-						zval_dtor(&tmp);
+					if (IS_CV != IS_CONST && Z_TYPE(tmp) != IS_UNDEF) {
+						zend_string_release(Z_STR(tmp));
 					}
 
 					HANDLE_EXCEPTION();
@@ -36860,8 +36867,8 @@ static int ZEND_FASTCALL  ZEND_UNSET_VAR_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDL
 		zend_hash_del_ind(target_symbol_table, Z_STR_P(varname));
 	}
 
-	if (IS_CV != IS_CONST) {
-		zval_dtor(&tmp);
+	if (IS_CV != IS_CONST && Z_TYPE(tmp) != IS_UNDEF) {
+		zend_string_release(Z_STR(tmp));
 	}
 
 	CHECK_EXCEPTION();
@@ -37005,6 +37012,7 @@ static int ZEND_FASTCALL  ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_CONST_HANDLER(ZEND_OPCO
 
 		zval tmp, *varname = _get_zval_ptr_cv_BP_VAR_IS(execute_data, opline->op1.var TSRMLS_CC);
 
+		ZVAL_UNDEF(&tmp);
 		if (IS_CV != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
 			ZVAL_STR(&tmp, zval_get_string(varname));
 			varname = &tmp;
@@ -37033,8 +37041,8 @@ static int ZEND_FASTCALL  ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_CONST_HANDLER(ZEND_OPCO
 			value = zend_hash_find_ind(target_symbol_table, Z_STR_P(varname));
 		}
 
-		if (IS_CV != IS_CONST && varname == &tmp) {
-			zval_dtor(&tmp);
+		if (IS_CV != IS_CONST && Z_TYPE(tmp) != IS_UNDEF) {
+			zend_string_release(Z_STR(tmp));
 		}
 
 		if (opline->extended_value & ZEND_ISSET) {
@@ -37776,7 +37784,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_TMP(int (*bina
 					zval *value = Z_OBJ_HT_P(z)->get(z, &rv TSRMLS_CC);
 
 					if (Z_REFCOUNT_P(z) == 0) {
-						zval_dtor(z);
+						zend_objects_store_del(Z_OBJ_P(z) TSRMLS_CC);
 					}
 					ZVAL_COPY_VALUE(z, value);
 				}
@@ -38101,7 +38109,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_CV_TMP(incdec_t in
 				zval *value = Z_OBJ_HT_P(z)->get(z, &rv TSRMLS_CC);
 
 				if (Z_REFCOUNT_P(z) == 0) {
-					zval_dtor(z);
+					zend_objects_store_del(Z_OBJ_P(z) TSRMLS_CC);
 				}
 				ZVAL_COPY_VALUE(z, value);
 			}
@@ -38188,7 +38196,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_TMP(incdec_t i
 				zval *value = Z_OBJ_HT_P(z)->get(z, &rv TSRMLS_CC);
 
 				if (Z_REFCOUNT_P(z) == 0) {
-					zval_dtor(z);
+					zend_objects_store_del(Z_OBJ_P(z) TSRMLS_CC);
 				}
 				ZVAL_COPY_VALUE(z, value);
 			}
@@ -39674,7 +39682,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_VAR(int (*bina
 					zval *value = Z_OBJ_HT_P(z)->get(z, &rv TSRMLS_CC);
 
 					if (Z_REFCOUNT_P(z) == 0) {
-						zval_dtor(z);
+						zend_objects_store_del(Z_OBJ_P(z) TSRMLS_CC);
 					}
 					ZVAL_COPY_VALUE(z, value);
 				}
@@ -39999,7 +40007,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_CV_VAR(incdec_t in
 				zval *value = Z_OBJ_HT_P(z)->get(z, &rv TSRMLS_CC);
 
 				if (Z_REFCOUNT_P(z) == 0) {
-					zval_dtor(z);
+					zend_objects_store_del(Z_OBJ_P(z) TSRMLS_CC);
 				}
 				ZVAL_COPY_VALUE(z, value);
 			}
@@ -40086,7 +40094,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_VAR(incdec_t i
 				zval *value = Z_OBJ_HT_P(z)->get(z, &rv TSRMLS_CC);
 
 				if (Z_REFCOUNT_P(z) == 0) {
-					zval_dtor(z);
+					zend_objects_store_del(Z_OBJ_P(z) TSRMLS_CC);
 				}
 				ZVAL_COPY_VALUE(z, value);
 			}
@@ -41087,8 +41095,8 @@ static int ZEND_FASTCALL  ZEND_UNSET_VAR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER
 			} else {
 				ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
 				if (UNEXPECTED(EG(exception) != NULL)) {
-					if (IS_CV != IS_CONST) {
-						zval_dtor(&tmp);
+					if (IS_CV != IS_CONST && Z_TYPE(tmp) != IS_UNDEF) {
+						zend_string_release(Z_STR(tmp));
 					}
 
 					HANDLE_EXCEPTION();
@@ -41107,8 +41115,8 @@ static int ZEND_FASTCALL  ZEND_UNSET_VAR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDLER
 		zend_hash_del_ind(target_symbol_table, Z_STR_P(varname));
 	}
 
-	if (IS_CV != IS_CONST) {
-		zval_dtor(&tmp);
+	if (IS_CV != IS_CONST && Z_TYPE(tmp) != IS_UNDEF) {
+		zend_string_release(Z_STR(tmp));
 	}
 
 	CHECK_EXCEPTION();
@@ -41252,6 +41260,7 @@ static int ZEND_FASTCALL  ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE
 
 		zval tmp, *varname = _get_zval_ptr_cv_BP_VAR_IS(execute_data, opline->op1.var TSRMLS_CC);
 
+		ZVAL_UNDEF(&tmp);
 		if (IS_CV != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
 			ZVAL_STR(&tmp, zval_get_string(varname));
 			varname = &tmp;
@@ -41280,8 +41289,8 @@ static int ZEND_FASTCALL  ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_VAR_HANDLER(ZEND_OPCODE
 			value = zend_hash_find_ind(target_symbol_table, Z_STR_P(varname));
 		}
 
-		if (IS_CV != IS_CONST && varname == &tmp) {
-			zval_dtor(&tmp);
+		if (IS_CV != IS_CONST && Z_TYPE(tmp) != IS_UNDEF) {
+			zend_string_release(Z_STR(tmp));
 		}
 
 		if (opline->extended_value & ZEND_ISSET) {
@@ -41694,7 +41703,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_UNUSED(int (*b
 					zval *value = Z_OBJ_HT_P(z)->get(z, &rv TSRMLS_CC);
 
 					if (Z_REFCOUNT_P(z) == 0) {
-						zval_dtor(z);
+						zend_objects_store_del(Z_OBJ_P(z) TSRMLS_CC);
 					}
 					ZVAL_COPY_VALUE(z, value);
 				}
@@ -42418,8 +42427,8 @@ static int ZEND_FASTCALL  ZEND_UNSET_VAR_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HAND
 			} else {
 				ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
 				if (UNEXPECTED(EG(exception) != NULL)) {
-					if (IS_CV != IS_CONST) {
-						zval_dtor(&tmp);
+					if (IS_CV != IS_CONST && Z_TYPE(tmp) != IS_UNDEF) {
+						zend_string_release(Z_STR(tmp));
 					}
 
 					HANDLE_EXCEPTION();
@@ -42438,8 +42447,8 @@ static int ZEND_FASTCALL  ZEND_UNSET_VAR_SPEC_CV_UNUSED_HANDLER(ZEND_OPCODE_HAND
 		zend_hash_del_ind(target_symbol_table, Z_STR_P(varname));
 	}
 
-	if (IS_CV != IS_CONST) {
-		zval_dtor(&tmp);
+	if (IS_CV != IS_CONST && Z_TYPE(tmp) != IS_UNDEF) {
+		zend_string_release(Z_STR(tmp));
 	}
 
 	CHECK_EXCEPTION();
@@ -42470,6 +42479,7 @@ static int ZEND_FASTCALL  ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_UNUSED_HANDLER(ZEND_OPC
 
 		zval tmp, *varname = _get_zval_ptr_cv_BP_VAR_IS(execute_data, opline->op1.var TSRMLS_CC);
 
+		ZVAL_UNDEF(&tmp);
 		if (IS_CV != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
 			ZVAL_STR(&tmp, zval_get_string(varname));
 			varname = &tmp;
@@ -42498,8 +42508,8 @@ static int ZEND_FASTCALL  ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_UNUSED_HANDLER(ZEND_OPC
 			value = zend_hash_find_ind(target_symbol_table, Z_STR_P(varname));
 		}
 
-		if (IS_CV != IS_CONST && varname == &tmp) {
-			zval_dtor(&tmp);
+		if (IS_CV != IS_CONST && Z_TYPE(tmp) != IS_UNDEF) {
+			zend_string_release(Z_STR(tmp));
 		}
 
 		if (opline->extended_value & ZEND_ISSET) {
@@ -42986,7 +42996,7 @@ static int ZEND_FASTCALL zend_binary_assign_op_obj_helper_SPEC_CV_CV(int (*binar
 					zval *value = Z_OBJ_HT_P(z)->get(z, &rv TSRMLS_CC);
 
 					if (Z_REFCOUNT_P(z) == 0) {
-						zval_dtor(z);
+						zend_objects_store_del(Z_OBJ_P(z) TSRMLS_CC);
 					}
 					ZVAL_COPY_VALUE(z, value);
 				}
@@ -43308,7 +43318,7 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_CV_CV(incdec_t inc
 				zval *value = Z_OBJ_HT_P(z)->get(z, &rv TSRMLS_CC);
 
 				if (Z_REFCOUNT_P(z) == 0) {
-					zval_dtor(z);
+					zend_objects_store_del(Z_OBJ_P(z) TSRMLS_CC);
 				}
 				ZVAL_COPY_VALUE(z, value);
 			}
@@ -43394,7 +43404,7 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_CV(incdec_t in
 				zval *value = Z_OBJ_HT_P(z)->get(z, &rv TSRMLS_CC);
 
 				if (Z_REFCOUNT_P(z) == 0) {
-					zval_dtor(z);
+					zend_objects_store_del(Z_OBJ_P(z) TSRMLS_CC);
 				}
 				ZVAL_COPY_VALUE(z, value);
 			}

From d4f42289ddde002cb4d3ed9d1a4f2219f68df48e Mon Sep 17 00:00:00 2001
From: Dmitry Stogov 
Date: Tue, 25 Nov 2014 11:33:57 +0300
Subject: [PATCH 090/102] Removed useless assert. EG(uninitialized_zval) can't
 be refcounted.

---
 Zend/zend_execute.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h
index 298a125e056..38b52820b5e 100644
--- a/Zend/zend_execute.h
+++ b/Zend/zend_execute.h
@@ -55,7 +55,6 @@ static zend_always_inline void i_zval_ptr_dtor(zval *zval_ptr ZEND_FILE_LINE_DC
 {
 	if (Z_REFCOUNTED_P(zval_ptr)) {
 		if (!Z_DELREF_P(zval_ptr)) {
-			ZEND_ASSERT(zval_ptr != &EG(uninitialized_zval));
 			_zval_dtor_func_for_ptr(Z_COUNTED_P(zval_ptr) ZEND_FILE_LINE_RELAY_CC);
 		} else {
 			GC_ZVAL_CHECK_POSSIBLE_ROOT(zval_ptr);

From 9b6836ebd36eccc9e81ca51e2efe172e1d334f0b Mon Sep 17 00:00:00 2001
From: krakjoe 
Date: Tue, 25 Nov 2014 08:36:30 +0000
Subject: [PATCH 091/102] fix REGISTER_NS_*_CONSTANT macros

---
 Zend/zend_constants.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/Zend/zend_constants.h b/Zend/zend_constants.h
index 6d5542e1ec8..058e0135c76 100644
--- a/Zend/zend_constants.h
+++ b/Zend/zend_constants.h
@@ -44,12 +44,12 @@ typedef struct _zend_constant {
 #define REGISTER_STRING_CONSTANT(name, str, flags)  zend_register_string_constant((name), sizeof(name)-1, (str), (flags), module_number TSRMLS_CC)
 #define REGISTER_STRINGL_CONSTANT(name, str, len, flags)  zend_register_stringl_constant((name), sizeof(name)-1, (str), (len), (flags), module_number TSRMLS_CC)
 
-#define REGISTER_NS_NULL_CONSTANT(ns, name, flags)  zend_register_null_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name)), (flags), module_number TSRMLS_CC)
-#define REGISTER_NS_BOOL_CONSTANT(ns, name, bval, flags)  zend_register_bool_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name)), (bval), (flags), module_number TSRMLS_CC)
-#define REGISTER_NS_LONG_CONSTANT(ns, name, lval, flags)  zend_register_long_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name)), (lval), (flags), module_number TSRMLS_CC)
-#define REGISTER_NS_DOUBLE_CONSTANT(ns, name, dval, flags)  zend_register_double_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name)), (dval), (flags), module_number TSRMLS_CC)
-#define REGISTER_NS_STRING_CONSTANT(ns, name, str, flags)  zend_register_string_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name)), (str), (flags), module_number TSRMLS_CC)
-#define REGISTER_NS_STRINGL_CONSTANT(ns, name, str, len, flags)  zend_register_stringl_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name)), (str), (len), (flags), module_number TSRMLS_CC)
+#define REGISTER_NS_NULL_CONSTANT(ns, name, flags)  zend_register_null_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, (flags), module_number TSRMLS_CC)
+#define REGISTER_NS_BOOL_CONSTANT(ns, name, bval, flags)  zend_register_bool_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, (bval), (flags), module_number TSRMLS_CC)
+#define REGISTER_NS_LONG_CONSTANT(ns, name, lval, flags)  zend_register_long_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, (lval), (flags), module_number TSRMLS_CC)
+#define REGISTER_NS_DOUBLE_CONSTANT(ns, name, dval, flags)  zend_register_double_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, (dval), (flags), module_number TSRMLS_CC)
+#define REGISTER_NS_STRING_CONSTANT(ns, name, str, flags)  zend_register_string_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, (str), (flags), module_number TSRMLS_CC)
+#define REGISTER_NS_STRINGL_CONSTANT(ns, name, str, len, flags)  zend_register_stringl_constant(ZEND_NS_NAME(ns, name), sizeof(ZEND_NS_NAME(ns, name))-1, (str), (len), (flags), module_number TSRMLS_CC)
 
 #define REGISTER_MAIN_NULL_CONSTANT(name, flags)  zend_register_null_constant((name), sizeof(name)-1, (flags), 0 TSRMLS_CC)
 #define REGISTER_MAIN_BOOL_CONSTANT(name, bval, flags)  zend_register_bool_constant((name), sizeof(name)-1, (bval), (flags), 0 TSRMLS_CC)

From 8319f597229bee1d01e1c88a3a1f08de70cd8900 Mon Sep 17 00:00:00 2001
From: Dmitry Stogov 
Date: Tue, 25 Nov 2014 12:37:46 +0300
Subject: [PATCH 092/102] Moved i_zval_ptr_dtor() from zend_execute.h to
 zend_variables.h

---
 Zend/zend_execute.h   | 11 -----------
 Zend/zend_variables.h | 13 +++++++++++++
 2 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h
index 38b52820b5e..8a621cf3482 100644
--- a/Zend/zend_execute.h
+++ b/Zend/zend_execute.h
@@ -51,17 +51,6 @@ ZEND_API int zend_eval_stringl_ex(char *str, size_t str_len, zval *retval_ptr, c
 ZEND_API char * zend_verify_arg_class_kind(const zend_arg_info *cur_arg_info, char **class_name, zend_class_entry **pce TSRMLS_DC);
 ZEND_API void zend_verify_arg_error(int error_type, const zend_function *zf, uint32_t arg_num, const char *need_msg, const char *need_kind, const char *given_msg, const char *given_kind, zval *arg TSRMLS_DC);
 
-static zend_always_inline void i_zval_ptr_dtor(zval *zval_ptr ZEND_FILE_LINE_DC TSRMLS_DC)
-{
-	if (Z_REFCOUNTED_P(zval_ptr)) {
-		if (!Z_DELREF_P(zval_ptr)) {
-			_zval_dtor_func_for_ptr(Z_COUNTED_P(zval_ptr) ZEND_FILE_LINE_RELAY_CC);
-		} else {
-			GC_ZVAL_CHECK_POSSIBLE_ROOT(zval_ptr);
-		}
-	}
-}
-
 static zend_always_inline int i_zend_is_true(zval *op TSRMLS_DC)
 {
 	int result;
diff --git a/Zend/zend_variables.h b/Zend/zend_variables.h
index 4f840bdd8a4..ea0434dc0ba 100644
--- a/Zend/zend_variables.h
+++ b/Zend/zend_variables.h
@@ -22,6 +22,8 @@
 #ifndef ZEND_VARIABLES_H
 #define ZEND_VARIABLES_H
 
+#include "zend_types.h"
+#include "zend_gc.h"
 
 BEGIN_EXTERN_C()
 
@@ -43,6 +45,17 @@ static zend_always_inline void _zval_ptr_dtor_nogc(zval *zval_ptr ZEND_FILE_LINE
 	}
 }
 
+static zend_always_inline void i_zval_ptr_dtor(zval *zval_ptr ZEND_FILE_LINE_DC TSRMLS_DC)
+{
+	if (Z_REFCOUNTED_P(zval_ptr)) {
+		if (!Z_DELREF_P(zval_ptr)) {
+			_zval_dtor_func_for_ptr(Z_COUNTED_P(zval_ptr) ZEND_FILE_LINE_RELAY_CC);
+		} else {
+			GC_ZVAL_CHECK_POSSIBLE_ROOT(zval_ptr);
+		}
+	}
+}
+
 ZEND_API void _zval_copy_ctor_func(zval *zvalue ZEND_FILE_LINE_DC);
 
 #define zval_copy_ctor_func(zv) _zval_copy_ctor_func(zv ZEND_FILE_LINE_CC)

From ab7b38e33617c1364529b600f5ea74a2004c497f Mon Sep 17 00:00:00 2001
From: Dmitry Stogov 
Date: Tue, 25 Nov 2014 12:58:29 +0300
Subject: [PATCH 093/102] Added new optimized zend_array_destroy() function

---
 Zend/zend_hash.c      | 42 ++++++++++++++++++++++++++++++++++++++++++
 Zend/zend_hash.h      |  1 +
 Zend/zend_objects.c   |  2 +-
 Zend/zend_variables.c |  4 ++--
 4 files changed, 46 insertions(+), 3 deletions(-)

diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c
index 24be94f0d98..2a7cb5a4b86 100644
--- a/Zend/zend_hash.c
+++ b/Zend/zend_hash.c
@@ -21,6 +21,7 @@
 
 #include "zend.h"
 #include "zend_globals.h"
+#include "zend_variables.h"
 
 #if ZEND_DEBUG
 /*
@@ -944,6 +945,47 @@ ZEND_API void zend_hash_destroy(HashTable *ht)
 	pefree(ht->arData, ht->u.flags & HASH_FLAG_PERSISTENT);
 }
 
+ZEND_API void zend_array_destroy(HashTable *ht TSRMLS_DC)
+{
+	Bucket *p, *end;
+
+	IS_CONSISTENT(ht);
+
+	if (ht->nNumUsed) {
+		
+		/* In some rare cases destructors of regular arrays may be changed */
+		if (UNEXPECTED(ht->pDestructor != ZVAL_PTR_DTOR)) {
+			zend_hash_destroy(ht);
+			return;
+		}
+	
+		p = ht->arData;
+		end = p + ht->nNumUsed;
+		SET_INCONSISTENT(HT_IS_DESTROYING);
+
+		if (ht->u.flags & HASH_FLAG_PACKED) {
+			do {
+				if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF)) {
+					i_zval_ptr_dtor(&p->val ZEND_FILE_LINE_CC TSRMLS_CC);
+				}
+			} while (++p != end);
+		} else {
+			do {
+				if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF)) {
+					i_zval_ptr_dtor(&p->val ZEND_FILE_LINE_CC TSRMLS_CC);
+					if (EXPECTED(p->key)) {
+						zend_string_release(p->key);
+					}
+				}
+			} while (++p != end);
+		}
+		
+		SET_INCONSISTENT(HT_DESTROYED);
+	} else if (EXPECTED(!ht->nTableMask)) {
+		return;
+	}
+	pefree(ht->arData, ht->u.flags & HASH_FLAG_PERSISTENT);
+}
 
 ZEND_API void zend_hash_clean(HashTable *ht)
 {
diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h
index 0ed47b424d5..435e92494c4 100644
--- a/Zend/zend_hash.h
+++ b/Zend/zend_hash.h
@@ -216,6 +216,7 @@ ZEND_API zval *zend_hash_minmax(const HashTable *ht, compare_func_t compar, uint
 ZEND_API int zend_hash_rehash(HashTable *ht);
 
 ZEND_API void zend_array_dup(HashTable *target, HashTable *source);
+ZEND_API void zend_array_destroy(HashTable *ht TSRMLS_DC);
 
 #if ZEND_DEBUG
 /* debug */
diff --git a/Zend/zend_objects.c b/Zend/zend_objects.c
index 9068dceb8b1..2778b168ee6 100644
--- a/Zend/zend_objects.c
+++ b/Zend/zend_objects.c
@@ -54,7 +54,7 @@ ZEND_API void zend_object_std_dtor(zend_object *object TSRMLS_DC)
 		FREE_HASHTABLE(object->guards);
 	}
 	if (object->properties) {
-		zend_hash_destroy(object->properties);
+		zend_array_destroy(object->properties TSRMLS_CC);
 		FREE_HASHTABLE(object->properties);
 	}
 	count = object->ce->default_properties_count;
diff --git a/Zend/zend_variables.c b/Zend/zend_variables.c
index aae84657914..11d035e85c2 100644
--- a/Zend/zend_variables.c
+++ b/Zend/zend_variables.c
@@ -45,7 +45,7 @@ ZEND_API void _zval_dtor_func(zend_refcounted *p ZEND_FILE_LINE_DC)
 					/* break possible cycles */
 					GC_TYPE(arr) = IS_NULL;
 					GC_REMOVE_FROM_BUFFER(arr);
-					zend_hash_destroy(&arr->ht);
+					zend_array_destroy(&arr->ht TSRMLS_CC);
 					efree_size(arr, sizeof(zend_array));
 				}
 				break;
@@ -105,7 +105,7 @@ ZEND_API void _zval_dtor_func_for_ptr(zend_refcounted *p ZEND_FILE_LINE_DC)
 					/* break possible cycles */
 					GC_TYPE(arr) = IS_NULL;
 					GC_REMOVE_FROM_BUFFER(arr);
-					zend_hash_destroy(&arr->ht);
+					zend_array_destroy(&arr->ht TSRMLS_CC);
 					efree_size(arr, sizeof(zend_array));
 				}
 				break;

From fb42d9d46ef66507f31ff08aae2bb6f7d115100e Mon Sep 17 00:00:00 2001
From: Dmitry Stogov 
Date: Tue, 25 Nov 2014 13:05:35 +0300
Subject: [PATCH 094/102] Use inline version of zval_ptr_dtor()

---
 Zend/zend_variables.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/Zend/zend_variables.c b/Zend/zend_variables.c
index 11d035e85c2..1d3c0d2dcb2 100644
--- a/Zend/zend_variables.c
+++ b/Zend/zend_variables.c
@@ -77,7 +77,9 @@ ZEND_API void _zval_dtor_func(zend_refcounted *p ZEND_FILE_LINE_DC)
 		case IS_REFERENCE: {
 				zend_reference *ref = (zend_reference*)p;
 				if (--GC_REFCOUNT(ref) == 0) {
-					zval_ptr_dtor(&ref->val);
+					TSRMLS_FETCH();
+
+					i_zval_ptr_dtor(&ref->val ZEND_FILE_LINE_RELAY_CC TSRMLS_CC);
 					efree_size(ref, sizeof(zend_reference));
 				}
 				break;
@@ -134,8 +136,9 @@ ZEND_API void _zval_dtor_func_for_ptr(zend_refcounted *p ZEND_FILE_LINE_DC)
 			}
 		case IS_REFERENCE: {
 				zend_reference *ref = (zend_reference*)p;
+				TSRMLS_FETCH();
 
-				zval_ptr_dtor(&ref->val);
+				i_zval_ptr_dtor(&ref->val ZEND_FILE_LINE_RELAY_CC TSRMLS_CC);
 				efree_size(ref, sizeof(zend_reference));
 				break;
 			}
@@ -293,7 +296,9 @@ ZEND_API void _zval_internal_dtor_wrapper(zval *zvalue)
 
 ZEND_API void _zval_ptr_dtor_wrapper(zval *zval_ptr)
 {
-	zval_ptr_dtor(zval_ptr);
+	TSRMLS_FETCH();
+
+	i_zval_ptr_dtor(zval_ptr ZEND_FILE_LINE_RELAY_CC TSRMLS_CC);
 }
 
 

From 3727e2645652b61d47fbae987675032eff7d398f Mon Sep 17 00:00:00 2001
From: Dmitry Stogov 
Date: Tue, 25 Nov 2014 14:17:21 +0300
Subject: [PATCH 095/102] Improved zend_hash_clean() and added new optimized
 zend_symtable_clean()

---
 Zend/zend_execute.c   |  4 +--
 Zend/zend_hash.c      | 66 +++++++++++++++++++++++++++++++++++++------
 Zend/zend_hash.h      |  1 +
 Zend/zend_variables.c |  2 +-
 4 files changed, 62 insertions(+), 11 deletions(-)

diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index 9ef06d25c18..5274f100e1c 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -1421,12 +1421,12 @@ ZEND_API void execute_internal(zend_execute_data *execute_data, zval *return_val
 ZEND_API void zend_clean_and_cache_symbol_table(zend_array *symbol_table TSRMLS_DC) /* {{{ */
 {
 	if (EG(symtable_cache_ptr) >= EG(symtable_cache_limit)) {
-		zend_hash_destroy(&symbol_table->ht);
+		zend_array_destroy(&symbol_table->ht TSRMLS_CC);
 		efree_size(symbol_table, sizeof(zend_array));
 	} else {
 		/* clean before putting into the cache, since clean
 		   could call dtors, which could use cached hash */
-		zend_hash_clean(&symbol_table->ht);
+		zend_symtable_clean(&symbol_table->ht TSRMLS_CC);
 		*(++EG(symtable_cache_ptr)) = symbol_table;
 	}
 }
diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c
index 2a7cb5a4b86..0f77ca6048b 100644
--- a/Zend/zend_hash.c
+++ b/Zend/zend_hash.c
@@ -989,21 +989,71 @@ ZEND_API void zend_array_destroy(HashTable *ht TSRMLS_DC)
 
 ZEND_API void zend_hash_clean(HashTable *ht)
 {
-	uint32_t idx;
-	Bucket *p;
+	Bucket *p, *end;
 
 	IS_CONSISTENT(ht);
 
-	for (idx = 0; idx < ht->nNumUsed; idx++) {
-		p = ht->arData + idx;
-		if (Z_TYPE(p->val) == IS_UNDEF) continue;
+	if (ht->nNumUsed) {
+		p = ht->arData;
+		end = p + ht->nNumUsed;
 		if (ht->pDestructor) {
-			ht->pDestructor(&p->val);
+			if (ht->u.flags & HASH_FLAG_PACKED) {
+				do {
+					if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF)) {
+						ht->pDestructor(&p->val);
+					}
+				} while (++p != end);
+			} else {
+				do {
+					if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF)) {
+						ht->pDestructor(&p->val);
+						if (EXPECTED(p->key)) {
+							zend_string_release(p->key);
+						}
+					}
+				} while (++p != end);
+			}
+		} else {
+			if (!(ht->u.flags & HASH_FLAG_PACKED)) {
+				do {
+					if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF)) {
+						if (EXPECTED(p->key)) {
+							zend_string_release(p->key);
+						}
+					}
+				} while (++p != end);
+			}
 		}
-		if (p->key) {
-			zend_string_release(p->key);
+	}
+	ht->nNumUsed = 0;
+	ht->nNumOfElements = 0;
+	ht->nNextFreeElement = 0;
+	ht->nInternalPointer = INVALID_IDX;
+	if (ht->nTableMask) {
+		if (!(ht->u.flags & HASH_FLAG_PACKED)) {
+			memset(ht->arHash, INVALID_IDX, ht->nTableSize * sizeof(uint32_t));	
 		}
 	}
+}
+
+ZEND_API void zend_symtable_clean(HashTable *ht TSRMLS_DC)
+{
+	Bucket *p, *end;
+
+	IS_CONSISTENT(ht);
+
+	if (ht->nNumUsed) {
+		p = ht->arData;
+		end = p + ht->nNumUsed;
+		do {
+			if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF)) {
+				i_zval_ptr_dtor(&p->val ZEND_FILE_LINE_CC TSRMLS_CC);
+				if (EXPECTED(p->key)) {
+					zend_string_release(p->key);
+				}
+			}
+		} while (++p != end);
+	}
 	ht->nNumUsed = 0;
 	ht->nNumOfElements = 0;
 	ht->nNextFreeElement = 0;
diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h
index 435e92494c4..8f12b0e66e1 100644
--- a/Zend/zend_hash.h
+++ b/Zend/zend_hash.h
@@ -217,6 +217,7 @@ ZEND_API int zend_hash_rehash(HashTable *ht);
 
 ZEND_API void zend_array_dup(HashTable *target, HashTable *source);
 ZEND_API void zend_array_destroy(HashTable *ht TSRMLS_DC);
+ZEND_API void zend_symtable_clean(HashTable *ht TSRMLS_DC);
 
 #if ZEND_DEBUG
 /* debug */
diff --git a/Zend/zend_variables.c b/Zend/zend_variables.c
index 1d3c0d2dcb2..548d191cfd4 100644
--- a/Zend/zend_variables.c
+++ b/Zend/zend_variables.c
@@ -298,7 +298,7 @@ ZEND_API void _zval_ptr_dtor_wrapper(zval *zval_ptr)
 {
 	TSRMLS_FETCH();
 
-	i_zval_ptr_dtor(zval_ptr ZEND_FILE_LINE_RELAY_CC TSRMLS_CC);
+	i_zval_ptr_dtor(zval_ptr ZEND_FILE_LINE_CC TSRMLS_CC);
 }
 
 

From aba95c239986e05bbae87cc1b7195fcf6da094bc Mon Sep 17 00:00:00 2001
From: Bob Weinand 
Date: Tue, 25 Nov 2014 12:24:29 +0100
Subject: [PATCH 096/102] Revert "Fix bug #68446 (bug with constant defaults
 and type hints)"

This reverts commit 5ef138b0c7c4e9532e205f45c18a72aa1d279c24.
---
 Zend/tests/class_constants_002.phpt |  1 +
 Zend/zend_compile.c                 |  8 ++---
 Zend/zend_execute.c                 | 18 +++--------
 Zend/zend_vm_def.h                  | 50 +++++++++++------------------
 Zend/zend_vm_execute.h              | 50 +++++++++++------------------
 5 files changed, 47 insertions(+), 80 deletions(-)

diff --git a/Zend/tests/class_constants_002.phpt b/Zend/tests/class_constants_002.phpt
index 75d1032e545..9aad8088da8 100644
--- a/Zend/tests/class_constants_002.phpt
+++ b/Zend/tests/class_constants_002.phpt
@@ -26,5 +26,6 @@ echo "Done\n";
 --EXPECTF--	
 int(1)
 int(5)
+int(10)
 
 Fatal error: Class 'NoSuchClass' not found in %s on line %d
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index e023b24a8eb..8e416ea0a59 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -1931,8 +1931,8 @@ void zend_do_receive_param(zend_uchar op, znode *varname, const znode *initializ
 			if (class_type->u.constant.type == IS_ARRAY) {
 				cur_arg_info->type_hint = IS_ARRAY;
 				if (op == ZEND_RECV_INIT) {
-					if (Z_TYPE(initialization->u.constant) == IS_NULL || (Z_TYPE(initialization->u.constant) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT || (Z_TYPE(initialization->u.constant) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT_AST) {
-						cur_arg_info->allow_null = (Z_TYPE(initialization->u.constant) != IS_NULL) + 1;
+					if (Z_TYPE(initialization->u.constant) == IS_NULL || (Z_TYPE(initialization->u.constant) == IS_CONSTANT && !strcasecmp(Z_STRVAL(initialization->u.constant), "NULL")) || Z_TYPE(initialization->u.constant) == IS_CONSTANT_AST) {
+						cur_arg_info->allow_null = 1;
 					} else if (Z_TYPE(initialization->u.constant) != IS_ARRAY) {
 						zend_error_noreturn(E_COMPILE_ERROR, "Default value for parameters with array type hint can only be an array or NULL");
 					}
@@ -1940,8 +1940,8 @@ void zend_do_receive_param(zend_uchar op, znode *varname, const znode *initializ
 			} else if (class_type->u.constant.type == IS_CALLABLE) {
 				cur_arg_info->type_hint = IS_CALLABLE;
 				if (op == ZEND_RECV_INIT) {
-					if (Z_TYPE(initialization->u.constant) == IS_NULL || (Z_TYPE(initialization->u.constant) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT || (Z_TYPE(initialization->u.constant) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT_AST) {
-						cur_arg_info->allow_null = (Z_TYPE(initialization->u.constant) != IS_NULL) + 1;
+					if (Z_TYPE(initialization->u.constant) == IS_NULL || (Z_TYPE(initialization->u.constant) == IS_CONSTANT && !strcasecmp(Z_STRVAL(initialization->u.constant), "NULL")) || Z_TYPE(initialization->u.constant) == IS_CONSTANT_AST) {
+						cur_arg_info->allow_null = 1;
 					} else {
 						zend_error_noreturn(E_COMPILE_ERROR, "Default value for parameters with callable type hint can only be NULL");
 					}
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index 081af81d507..6ada04e1cb5 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -608,17 +608,7 @@ ZEND_API int zend_verify_arg_error(int error_type, const zend_function *zf, zend
 	return 0;
 }
 
-static inline int zend_arg_allows_null(zend_bool allow_null, zval *default_value TSRMLS_DC)
-{
-	if (allow_null < 2 || !default_value) {
-		return allow_null;
-	}
-
-	/* assuming update_constant_ex done before */
-	return Z_TYPE_P(default_value) == IS_NULL;
-}
-
-static inline int zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zval *arg, zval *defaultval, ulong fetch_type TSRMLS_DC)
+static inline int zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zval *arg, ulong fetch_type TSRMLS_DC)
 {
 	zend_arg_info *cur_arg_info;
 	char *need_msg;
@@ -648,7 +638,7 @@ static inline int zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zva
 			if (!ce || !instanceof_function(Z_OBJCE_P(arg), ce TSRMLS_CC)) {
 				return zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, need_msg, class_name, "instance of ", Z_OBJCE_P(arg)->name TSRMLS_CC);
 			}
-		} else if (Z_TYPE_P(arg) != IS_NULL || !zend_arg_allows_null(cur_arg_info->allow_null, defaultval TSRMLS_CC)) {
+		} else if (Z_TYPE_P(arg) != IS_NULL || !cur_arg_info->allow_null) {
 			need_msg = zend_verify_arg_class_kind(cur_arg_info, fetch_type, &class_name, &ce TSRMLS_CC);
 			return zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, need_msg, class_name, zend_zval_type_name(arg), "" TSRMLS_CC);
 		}
@@ -659,7 +649,7 @@ static inline int zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zva
 					return zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be of the type array", "", "none", "" TSRMLS_CC);
 				}
 
-				if (Z_TYPE_P(arg) != IS_ARRAY && (Z_TYPE_P(arg) != IS_NULL || !zend_arg_allows_null(cur_arg_info->allow_null, defaultval TSRMLS_CC))) {
+				if (Z_TYPE_P(arg) != IS_ARRAY && (Z_TYPE_P(arg) != IS_NULL || !cur_arg_info->allow_null)) {
 					return zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be of the type array", "", zend_zval_type_name(arg), "" TSRMLS_CC);
 				}
 				break;
@@ -668,7 +658,7 @@ static inline int zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zva
 				if (!arg) {
 					return zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be callable", "", "none", "" TSRMLS_CC);
 				}
-				if (!zend_is_callable(arg, IS_CALLABLE_CHECK_SILENT, NULL TSRMLS_CC) && (Z_TYPE_P(arg) != IS_NULL || !zend_arg_allows_null(cur_arg_info->allow_null, defaultval TSRMLS_CC))) {
+				if (!zend_is_callable(arg, IS_CALLABLE_CHECK_SILENT, NULL TSRMLS_CC) && (Z_TYPE_P(arg) != IS_NULL || !cur_arg_info->allow_null)) {
 					return zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be callable", "", zend_zval_type_name(arg), "" TSRMLS_CC);
 				}
 				break;
diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h
index 65981f6f6f2..705e46e7d33 100644
--- a/Zend/zend_vm_def.h
+++ b/Zend/zend_vm_def.h
@@ -1961,7 +1961,7 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
 			void **p = EX(function_state).arguments - num_args;
 
 			for (i = 0; i < num_args; ++i, ++p) {
-				zend_verify_arg_type(fbc, i + 1, (zval *) *p, NULL, 0 TSRMLS_CC);
+				zend_verify_arg_type(fbc, i + 1, (zval *) *p, 0 TSRMLS_CC);
 			}
 		}
 
@@ -3374,7 +3374,7 @@ ZEND_VM_HANDLER(63, ZEND_RECV, ANY, ANY)
 
 	SAVE_OPLINE();
 	if (UNEXPECTED(param == NULL)) {
-		if (zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, NULL, NULL, opline->extended_value TSRMLS_CC)) {
+		if (zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, NULL, opline->extended_value TSRMLS_CC)) {
 			const char *space;
 			const char *class_name;
 			zend_execute_data *ptr;
@@ -3396,7 +3396,7 @@ ZEND_VM_HANDLER(63, ZEND_RECV, ANY, ANY)
 	} else {
 		zval **var_ptr;
 
-		zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, *param, NULL, opline->extended_value TSRMLS_CC);
+		zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, *param, opline->extended_value TSRMLS_CC);
 		var_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->result.var TSRMLS_CC);
 		Z_DELREF_PP(var_ptr);
 		*var_ptr = *param;
@@ -3410,34 +3410,27 @@ ZEND_VM_HANDLER(63, ZEND_RECV, ANY, ANY)
 ZEND_VM_HANDLER(64, ZEND_RECV_INIT, ANY, CONST)
 {
 	USE_OPLINE
-	zval *assignment_value, *default_val = NULL;
+	zval *assignment_value;
 	zend_uint arg_num = opline->op1.num;
 	zval **param = zend_vm_stack_get_arg(arg_num TSRMLS_CC);
 	zval **var_ptr;
 
 	SAVE_OPLINE();
-	if (IS_CONSTANT_TYPE(Z_TYPE_P(opline->op2.zv))) {
-		ALLOC_ZVAL(default_val);
-		*default_val = *opline->op2.zv;
-		Z_SET_REFCOUNT_P(default_val, 1);
-		zval_update_constant(&default_val, 0 TSRMLS_CC);
-	}
 	if (param == NULL) {
-		if (default_val) {
-			assignment_value = default_val;
-		} else {
-			ALLOC_ZVAL(assignment_value);
-			*assignment_value = *opline->op2.zv;
-			if (Z_TYPE_P(assignment_value) == IS_ARRAY) {
-				HashTable *ht;
+		ALLOC_ZVAL(assignment_value);
+		*assignment_value = *opline->op2.zv;
+		if (IS_CONSTANT_TYPE(Z_TYPE_P(assignment_value))) {
+			Z_SET_REFCOUNT_P(assignment_value, 1);
+			zval_update_constant(&assignment_value, 0 TSRMLS_CC);
+		} else if (Z_TYPE_P(assignment_value) == IS_ARRAY) {
+			HashTable *ht;
 
-				ALLOC_HASHTABLE(ht);
-				zend_hash_init(ht, zend_hash_num_elements(Z_ARRVAL_P(assignment_value)), NULL, ZVAL_PTR_DTOR, 0);
-				zend_hash_copy(ht, Z_ARRVAL_P(assignment_value), (copy_ctor_func_t) zval_deep_copy, NULL, sizeof(zval *));
-				Z_ARRVAL_P(assignment_value) = ht;
-			} else {
-				zval_copy_ctor(assignment_value);
-			}
+			ALLOC_HASHTABLE(ht);
+			zend_hash_init(ht, zend_hash_num_elements(Z_ARRVAL_P(assignment_value)), NULL, ZVAL_PTR_DTOR, 0);
+			zend_hash_copy(ht, Z_ARRVAL_P(assignment_value), (copy_ctor_func_t) zval_deep_copy, NULL, sizeof(zval *));
+			Z_ARRVAL_P(assignment_value) = ht;
+		} else {
+			zval_copy_ctor(assignment_value);
 		}
 		INIT_PZVAL(assignment_value);
 	} else {
@@ -3445,16 +3438,11 @@ ZEND_VM_HANDLER(64, ZEND_RECV_INIT, ANY, CONST)
 		Z_ADDREF_P(assignment_value);
 	}
 
-	zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, assignment_value, default_val, opline->extended_value TSRMLS_CC);
+	zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, assignment_value, opline->extended_value TSRMLS_CC);
 	var_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->result.var TSRMLS_CC);
 	zval_ptr_dtor(var_ptr);
 	*var_ptr = assignment_value;
 
-	if (default_val && assignment_value != default_val) {
-		zval_dtor(default_val);
-		efree(default_val);
-	}
-
 	CHECK_EXCEPTION();
 	ZEND_VM_NEXT_OPCODE();
 }
@@ -3481,7 +3469,7 @@ ZEND_VM_HANDLER(164, ZEND_RECV_VARIADIC, ANY, ANY)
 
 	for (; arg_num <= arg_count; ++arg_num) {
 		zval **param = zend_vm_stack_get_arg(arg_num TSRMLS_CC);
-		zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, *param, NULL, opline->extended_value TSRMLS_CC);
+		zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, *param, opline->extended_value TSRMLS_CC);
 		zend_hash_next_index_insert(Z_ARRVAL_P(params), param, sizeof(zval *), NULL);
 		Z_ADDREF_PP(param);
 	}
diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h
index 318f903f776..993aaee7474 100644
--- a/Zend/zend_vm_execute.h
+++ b/Zend/zend_vm_execute.h
@@ -541,7 +541,7 @@ static int ZEND_FASTCALL zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_AR
 			void **p = EX(function_state).arguments - num_args;
 
 			for (i = 0; i < num_args; ++i, ++p) {
-				zend_verify_arg_type(fbc, i + 1, (zval *) *p, NULL, 0 TSRMLS_CC);
+				zend_verify_arg_type(fbc, i + 1, (zval *) *p, 0 TSRMLS_CC);
 			}
 		}
 
@@ -861,7 +861,7 @@ static int ZEND_FASTCALL  ZEND_RECV_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
 
 	SAVE_OPLINE();
 	if (UNEXPECTED(param == NULL)) {
-		if (zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, NULL, NULL, opline->extended_value TSRMLS_CC)) {
+		if (zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, NULL, opline->extended_value TSRMLS_CC)) {
 			const char *space;
 			const char *class_name;
 			zend_execute_data *ptr;
@@ -883,7 +883,7 @@ static int ZEND_FASTCALL  ZEND_RECV_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
 	} else {
 		zval **var_ptr;
 
-		zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, *param, NULL, opline->extended_value TSRMLS_CC);
+		zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, *param, opline->extended_value TSRMLS_CC);
 		var_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->result.var TSRMLS_CC);
 		Z_DELREF_PP(var_ptr);
 		*var_ptr = *param;
@@ -916,7 +916,7 @@ static int ZEND_FASTCALL  ZEND_RECV_VARIADIC_SPEC_HANDLER(ZEND_OPCODE_HANDLER_AR
 
 	for (; arg_num <= arg_count; ++arg_num) {
 		zval **param = zend_vm_stack_get_arg(arg_num TSRMLS_CC);
-		zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, *param, NULL, opline->extended_value TSRMLS_CC);
+		zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, *param, opline->extended_value TSRMLS_CC);
 		zend_hash_next_index_insert(Z_ARRVAL_P(params), param, sizeof(zval *), NULL);
 		Z_ADDREF_PP(param);
 	}
@@ -1615,34 +1615,27 @@ static int ZEND_FASTCALL  ZEND_INIT_NS_FCALL_BY_NAME_SPEC_CONST_HANDLER(ZEND_OPC
 static int ZEND_FASTCALL  ZEND_RECV_INIT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
 {
 	USE_OPLINE
-	zval *assignment_value, *default_val = NULL;
+	zval *assignment_value;
 	zend_uint arg_num = opline->op1.num;
 	zval **param = zend_vm_stack_get_arg(arg_num TSRMLS_CC);
 	zval **var_ptr;
 
 	SAVE_OPLINE();
-	if (IS_CONSTANT_TYPE(Z_TYPE_P(opline->op2.zv))) {
-		ALLOC_ZVAL(default_val);
-		*default_val = *opline->op2.zv;
-		Z_SET_REFCOUNT_P(default_val, 1);
-		zval_update_constant(&default_val, 0 TSRMLS_CC);
-	}
 	if (param == NULL) {
-		if (default_val) {
-			assignment_value = default_val;
-		} else {
-			ALLOC_ZVAL(assignment_value);
-			*assignment_value = *opline->op2.zv;
-			if (Z_TYPE_P(assignment_value) == IS_ARRAY) {
-				HashTable *ht;
+		ALLOC_ZVAL(assignment_value);
+		*assignment_value = *opline->op2.zv;
+		if (IS_CONSTANT_TYPE(Z_TYPE_P(assignment_value))) {
+			Z_SET_REFCOUNT_P(assignment_value, 1);
+			zval_update_constant(&assignment_value, 0 TSRMLS_CC);
+		} else if (Z_TYPE_P(assignment_value) == IS_ARRAY) {
+			HashTable *ht;
 
-				ALLOC_HASHTABLE(ht);
-				zend_hash_init(ht, zend_hash_num_elements(Z_ARRVAL_P(assignment_value)), NULL, ZVAL_PTR_DTOR, 0);
-				zend_hash_copy(ht, Z_ARRVAL_P(assignment_value), (copy_ctor_func_t) zval_deep_copy, NULL, sizeof(zval *));
-				Z_ARRVAL_P(assignment_value) = ht;
-			} else {
-				zval_copy_ctor(assignment_value);
-			}
+			ALLOC_HASHTABLE(ht);
+			zend_hash_init(ht, zend_hash_num_elements(Z_ARRVAL_P(assignment_value)), NULL, ZVAL_PTR_DTOR, 0);
+			zend_hash_copy(ht, Z_ARRVAL_P(assignment_value), (copy_ctor_func_t) zval_deep_copy, NULL, sizeof(zval *));
+			Z_ARRVAL_P(assignment_value) = ht;
+		} else {
+			zval_copy_ctor(assignment_value);
 		}
 		INIT_PZVAL(assignment_value);
 	} else {
@@ -1650,16 +1643,11 @@ static int ZEND_FASTCALL  ZEND_RECV_INIT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_
 		Z_ADDREF_P(assignment_value);
 	}
 
-	zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, assignment_value, default_val, opline->extended_value TSRMLS_CC);
+	zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, assignment_value, opline->extended_value TSRMLS_CC);
 	var_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->result.var TSRMLS_CC);
 	zval_ptr_dtor(var_ptr);
 	*var_ptr = assignment_value;
 
-	if (default_val && assignment_value != default_val) {
-		zval_dtor(default_val);
-		efree(default_val);
-	}
-
 	CHECK_EXCEPTION();
 	ZEND_VM_NEXT_OPCODE();
 }

From 0ca47ba8d812f57d6087cc059c3ebb2c8d300027 Mon Sep 17 00:00:00 2001
From: Bob Weinand 
Date: Tue, 25 Nov 2014 12:27:17 +0100
Subject: [PATCH 097/102] Revert NEWS and set test to XFAIL

---
 NEWS                     | 1 -
 Zend/tests/bug68446.phpt | 2 ++
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index 52768d60968..5ae6d21b961 100644
--- a/NEWS
+++ b/NEWS
@@ -14,7 +14,6 @@ PHP                                                                        NEWS
   . Fixed bug #68370 ("unset($this)" can make the program crash). (Laruence)
   . Fixed bug #68422 (Incorrect argument reflection info for array_multisort()).
     (Alexander Lisachenko)
-  . Fixed bug #68446 (Array constant not accepted for array parameter default). (Bob)
 
 - FPM:
   . Fixed bug #68381 (fpm_unix_init_main ignores log_level).
diff --git a/Zend/tests/bug68446.phpt b/Zend/tests/bug68446.phpt
index 48e6f52f1cc..0b41c29ed28 100644
--- a/Zend/tests/bug68446.phpt
+++ b/Zend/tests/bug68446.phpt
@@ -1,5 +1,7 @@
 --TEST--
 Bug #68446 (Array constant not accepted for array parameter default)
+--XFAIL--
+Not fixed yet as of 5.6.4rc1
 --FILE--
 
Date: Tue, 25 Nov 2014 15:40:08 +0300
Subject: [PATCH 098/102] Revert "Merge remote-tracking branch
 'origin/PHP-5.6'"

This reverts commit 38229d13d14bb0bda736d52a9a4f25c121445692, reversing
changes made to 77f172725a37c8ddee750bf6970529a1570fbc86.
---
 Zend/zend_compile.c    | 14 +++++---------
 Zend/zend_execute.c    | 18 ++++--------------
 Zend/zend_vm_def.h     | 25 ++++++++-----------------
 Zend/zend_vm_execute.h | 25 ++++++++-----------------
 4 files changed, 25 insertions(+), 57 deletions(-)

diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index ee3aa75ad1c..d15b85fc0ba 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -3831,15 +3831,11 @@ void zend_compile_params(zend_ast *ast TSRMLS_DC) /* {{{ */
 		arg_info->class_name_len = 0;
 
 		if (type_ast) {
-			zend_bool has_null_default = 0;
-
-			if (default_ast) {
-				if (!(has_null_default = (Z_TYPE(default_node.u.constant) == IS_NULL || (Z_TYPE(default_node.u.constant) == IS_CONSTANT && strcasecmp(Z_STRVAL(default_node.u.constant), "NULL") == 0)))) {
-					if (Z_OPT_CONSTANT(default_node.u.constant)) {
-						has_null_default = 2;
-					}
-				}
-			}
+			zend_bool has_null_default = default_ast
+				&& (Z_TYPE(default_node.u.constant) == IS_NULL
+					|| (Z_TYPE(default_node.u.constant) == IS_CONSTANT
+						&& strcasecmp(Z_STRVAL(default_node.u.constant), "NULL") == 0)
+					|| Z_TYPE(default_node.u.constant) == IS_CONSTANT_AST); // ???
 
 			op_array->fn_flags |= ZEND_ACC_HAS_TYPE_HINTS;
 			arg_info->allow_null = has_null_default;
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index 5274f100e1c..d6f551bcdf1 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -574,17 +574,7 @@ ZEND_API void zend_verify_arg_error(int error_type, const zend_function *zf, uin
 	}
 }
 
-static inline int zend_arg_allows_null(zend_bool allow_null, zval *default_value TSRMLS_DC)
-{
-	if (allow_null < 2 || !default_value) {
-		return allow_null;
-	}
-
-	/* assuming update_constant_ex done before */
-	return Z_TYPE_P(default_value) == IS_NULL;
-}
-
-static void zend_verify_arg_type(zend_function *zf, uint32_t arg_num, zval *arg, zval *defaultval TSRMLS_DC)
+static void zend_verify_arg_type(zend_function *zf, uint32_t arg_num, zval *arg TSRMLS_DC)
 {
 	zend_arg_info *cur_arg_info;
 	char *need_msg;
@@ -611,18 +601,18 @@ static void zend_verify_arg_type(zend_function *zf, uint32_t arg_num, zval *arg,
 			if (!ce || !instanceof_function(Z_OBJCE_P(arg), ce TSRMLS_CC)) {
 				zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, need_msg, class_name, "instance of ", Z_OBJCE_P(arg)->name->val, arg TSRMLS_CC);
 			}
-		} else if (Z_TYPE_P(arg) != IS_NULL || !zend_arg_allows_null(cur_arg_info->allow_null, defaultval TSRMLS_CC)) {
+		} else if (Z_TYPE_P(arg) != IS_NULL || !cur_arg_info->allow_null) {
 			need_msg = zend_verify_arg_class_kind(cur_arg_info, &class_name, &ce TSRMLS_CC);
 			zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, need_msg, class_name, zend_zval_type_name(arg), "", arg TSRMLS_CC);
 		}
 	} else if (cur_arg_info->type_hint) {
 		if (cur_arg_info->type_hint == IS_ARRAY) {
 			ZVAL_DEREF(arg);
-			if (Z_TYPE_P(arg) != IS_ARRAY && (Z_TYPE_P(arg) != IS_NULL || !zend_arg_allows_null(cur_arg_info->allow_null, defaultval TSRMLS_CC))) {
+			if (Z_TYPE_P(arg) != IS_ARRAY && (Z_TYPE_P(arg) != IS_NULL || !cur_arg_info->allow_null)) {
 				zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be of the type array", "", zend_zval_type_name(arg), "", arg TSRMLS_CC);
 			}
 		} else if (cur_arg_info->type_hint == IS_CALLABLE) {
-			if (!zend_is_callable(arg, IS_CALLABLE_CHECK_SILENT, NULL TSRMLS_CC) && (Z_TYPE_P(arg) != IS_NULL || !zend_arg_allows_null(cur_arg_info->allow_null, defaultval TSRMLS_CC))) {
+			if (!zend_is_callable(arg, IS_CALLABLE_CHECK_SILENT, NULL TSRMLS_CC) && (Z_TYPE_P(arg) != IS_NULL || !cur_arg_info->allow_null)) {
 				zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be callable", "", zend_zval_type_name(arg), "", arg TSRMLS_CC);
 			}
 #if ZEND_DEBUG
diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h
index 95968d8ac60..ec9841c0f2a 100644
--- a/Zend/zend_vm_def.h
+++ b/Zend/zend_vm_def.h
@@ -2675,7 +2675,7 @@ ZEND_VM_HANDLER(60, ZEND_DO_FCALL, ANY, ANY)
 			zval *p = ZEND_CALL_ARG(call, 1);
 
 			for (i = 0; i < call->num_args; ++i) {
-				zend_verify_arg_type(fbc, i + 1, p, NULL TSRMLS_CC);
+				zend_verify_arg_type(fbc, i + 1, p TSRMLS_CC);
 				p++;
 			}
 			if (UNEXPECTED(EG(exception) != NULL)) {
@@ -3526,7 +3526,7 @@ ZEND_VM_HANDLER(63, ZEND_RECV, ANY, ANY)
 	} else if (UNEXPECTED((EX(func)->op_array.fn_flags & ZEND_ACC_HAS_TYPE_HINTS) != 0)) {
 		zval *param = _get_zval_ptr_cv_undef_BP_VAR_W(execute_data, opline->result.var TSRMLS_CC);
 
-		zend_verify_arg_type(EX(func), arg_num, param, NULL TSRMLS_CC);
+		zend_verify_arg_type(EX(func), arg_num, param TSRMLS_CC);
 		CHECK_EXCEPTION();
 	}
 
@@ -3537,20 +3537,15 @@ ZEND_VM_HANDLER(64, ZEND_RECV_INIT, ANY, CONST)
 {
 	USE_OPLINE
 	uint32_t arg_num = opline->op1.num;
-	zval *param, default_val = {{0}};
+	zval *param;
 
 	SAVE_OPLINE();
-	if (Z_OPT_CONSTANT_P(opline->op2.zv)) {
-		ZVAL_COPY_VALUE(&default_val, opline->op2.zv);
-		zval_update_constant(&default_val, 0 TSRMLS_CC);
-	}
-
 	param = _get_zval_ptr_cv_undef_BP_VAR_W(execute_data, opline->result.var TSRMLS_CC);
 	if (arg_num > EX(num_args)) {
-		if (Z_TYPE(default_val) != IS_UNDEF) {
-			*param = default_val;
+		ZVAL_COPY_VALUE(param, opline->op2.zv);
+		if (Z_OPT_CONSTANT_P(param)) {
+			zval_update_constant(param, 0 TSRMLS_CC);
 		} else {
-			ZVAL_COPY_VALUE(param, opline->op2.zv);
 			/* IS_CONST can't be IS_OBJECT, IS_RESOURCE or IS_REFERENCE */
 			if (UNEXPECTED(Z_OPT_COPYABLE_P(param))) {
 				zval_copy_ctor_func(param);
@@ -3559,11 +3554,7 @@ ZEND_VM_HANDLER(64, ZEND_RECV_INIT, ANY, CONST)
 	}
 
 	if (UNEXPECTED((EX(func)->op_array.fn_flags & ZEND_ACC_HAS_TYPE_HINTS) != 0)) {
-		zend_verify_arg_type(EX(func), arg_num, param, Z_TYPE(default_val) == IS_UNDEF ? NULL : &default_val TSRMLS_CC);
-	}
-
-	if (Z_TYPE(default_val) != IS_UNDEF && arg_num <= EX(num_args)) {
-		zval_dtor(&default_val);
+		zend_verify_arg_type(EX(func), arg_num, param TSRMLS_CC);
 	}
 
 	CHECK_EXCEPTION();
@@ -3588,7 +3579,7 @@ ZEND_VM_HANDLER(164, ZEND_RECV_VARIADIC, ANY, ANY)
 		param = EX_VAR_NUM(EX(func)->op_array.last_var + EX(func)->op_array.T);
 		if (UNEXPECTED((EX(func)->op_array.fn_flags & ZEND_ACC_HAS_TYPE_HINTS) != 0)) {
 			do {			
-				zend_verify_arg_type(EX(func), arg_num, param, NULL TSRMLS_CC);
+				zend_verify_arg_type(EX(func), arg_num, param TSRMLS_CC);
 				zend_hash_next_index_insert_new(Z_ARRVAL_P(params), param);
 				if (Z_REFCOUNTED_P(param)) Z_ADDREF_P(param);
 				param++;
diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h
index cd4a91f27ac..9ec7a833347 100644
--- a/Zend/zend_vm_execute.h
+++ b/Zend/zend_vm_execute.h
@@ -538,7 +538,7 @@ static int ZEND_FASTCALL  ZEND_DO_FCALL_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
 			zval *p = ZEND_CALL_ARG(call, 1);
 
 			for (i = 0; i < call->num_args; ++i) {
-				zend_verify_arg_type(fbc, i + 1, p, NULL TSRMLS_CC);
+				zend_verify_arg_type(fbc, i + 1, p TSRMLS_CC);
 				p++;
 			}
 			if (UNEXPECTED(EG(exception) != NULL)) {
@@ -978,7 +978,7 @@ static int ZEND_FASTCALL  ZEND_RECV_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
 	} else if (UNEXPECTED((EX(func)->op_array.fn_flags & ZEND_ACC_HAS_TYPE_HINTS) != 0)) {
 		zval *param = _get_zval_ptr_cv_undef_BP_VAR_W(execute_data, opline->result.var TSRMLS_CC);
 
-		zend_verify_arg_type(EX(func), arg_num, param, NULL TSRMLS_CC);
+		zend_verify_arg_type(EX(func), arg_num, param TSRMLS_CC);
 		CHECK_EXCEPTION();
 	}
 
@@ -1003,7 +1003,7 @@ static int ZEND_FASTCALL  ZEND_RECV_VARIADIC_SPEC_HANDLER(ZEND_OPCODE_HANDLER_AR
 		param = EX_VAR_NUM(EX(func)->op_array.last_var + EX(func)->op_array.T);
 		if (UNEXPECTED((EX(func)->op_array.fn_flags & ZEND_ACC_HAS_TYPE_HINTS) != 0)) {
 			do {
-				zend_verify_arg_type(EX(func), arg_num, param, NULL TSRMLS_CC);
+				zend_verify_arg_type(EX(func), arg_num, param TSRMLS_CC);
 				zend_hash_next_index_insert_new(Z_ARRVAL_P(params), param);
 				if (Z_REFCOUNTED_P(param)) Z_ADDREF_P(param);
 				param++;
@@ -1645,20 +1645,15 @@ static int ZEND_FASTCALL  ZEND_RECV_INIT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_
 {
 	USE_OPLINE
 	uint32_t arg_num = opline->op1.num;
-	zval *param, default_val = {{0}};
+	zval *param;
 
 	SAVE_OPLINE();
-	if (Z_OPT_CONSTANT_P(opline->op2.zv)) {
-		ZVAL_COPY_VALUE(&default_val, opline->op2.zv);
-		zval_update_constant(&default_val, 0 TSRMLS_CC);
-	}
-
 	param = _get_zval_ptr_cv_undef_BP_VAR_W(execute_data, opline->result.var TSRMLS_CC);
 	if (arg_num > EX(num_args)) {
-		if (Z_TYPE(default_val) != IS_UNDEF) {
-			*param = default_val;
+		ZVAL_COPY_VALUE(param, opline->op2.zv);
+		if (Z_OPT_CONSTANT_P(param)) {
+			zval_update_constant(param, 0 TSRMLS_CC);
 		} else {
-			ZVAL_COPY_VALUE(param, opline->op2.zv);
 			/* IS_CONST can't be IS_OBJECT, IS_RESOURCE or IS_REFERENCE */
 			if (UNEXPECTED(Z_OPT_COPYABLE_P(param))) {
 				zval_copy_ctor_func(param);
@@ -1667,11 +1662,7 @@ static int ZEND_FASTCALL  ZEND_RECV_INIT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_
 	}
 
 	if (UNEXPECTED((EX(func)->op_array.fn_flags & ZEND_ACC_HAS_TYPE_HINTS) != 0)) {
-		zend_verify_arg_type(EX(func), arg_num, param, Z_TYPE(default_val) == IS_UNDEF ? NULL : &default_val TSRMLS_CC);
-	}
-
-	if (Z_TYPE(default_val) != IS_UNDEF && arg_num <= EX(num_args)) {
-		zval_dtor(&default_val);
+		zend_verify_arg_type(EX(func), arg_num, param TSRMLS_CC);
 	}
 
 	CHECK_EXCEPTION();

From e116595e63e5fe5bb145b91c6b98c856a5923f76 Mon Sep 17 00:00:00 2001
From: Dmitry Stogov 
Date: Tue, 25 Nov 2014 18:09:08 +0300
Subject: [PATCH 099/102] Better fix for bug #68446

---
 Zend/zend_compile.c    | 15 ++++++++++++---
 Zend/zend_execute.c    | 23 +++++++++++++++++++----
 Zend/zend_vm_def.h     | 10 +++++-----
 Zend/zend_vm_execute.h | 10 +++++-----
 4 files changed, 41 insertions(+), 17 deletions(-)

diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 8e416ea0a59..ccaf1652c25 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -1931,8 +1931,11 @@ void zend_do_receive_param(zend_uchar op, znode *varname, const znode *initializ
 			if (class_type->u.constant.type == IS_ARRAY) {
 				cur_arg_info->type_hint = IS_ARRAY;
 				if (op == ZEND_RECV_INIT) {
-					if (Z_TYPE(initialization->u.constant) == IS_NULL || (Z_TYPE(initialization->u.constant) == IS_CONSTANT && !strcasecmp(Z_STRVAL(initialization->u.constant), "NULL")) || Z_TYPE(initialization->u.constant) == IS_CONSTANT_AST) {
+					if (Z_TYPE(initialization->u.constant) == IS_NULL || (Z_TYPE(initialization->u.constant) == IS_CONSTANT && !strcasecmp(Z_STRVAL(initialization->u.constant), "NULL"))) {
 						cur_arg_info->allow_null = 1;
+					} else if (IS_CONSTANT_TYPE(Z_TYPE(initialization->u.constant))) {
+						/* delay constant resolution and check to run-time */
+						cur_arg_info->allow_null = 0;
 					} else if (Z_TYPE(initialization->u.constant) != IS_ARRAY) {
 						zend_error_noreturn(E_COMPILE_ERROR, "Default value for parameters with array type hint can only be an array or NULL");
 					}
@@ -1940,8 +1943,11 @@ void zend_do_receive_param(zend_uchar op, znode *varname, const znode *initializ
 			} else if (class_type->u.constant.type == IS_CALLABLE) {
 				cur_arg_info->type_hint = IS_CALLABLE;
 				if (op == ZEND_RECV_INIT) {
-					if (Z_TYPE(initialization->u.constant) == IS_NULL || (Z_TYPE(initialization->u.constant) == IS_CONSTANT && !strcasecmp(Z_STRVAL(initialization->u.constant), "NULL")) || Z_TYPE(initialization->u.constant) == IS_CONSTANT_AST) {
+					if (Z_TYPE(initialization->u.constant) == IS_NULL || (Z_TYPE(initialization->u.constant) == IS_CONSTANT && !strcasecmp(Z_STRVAL(initialization->u.constant), "NULL"))) {
 						cur_arg_info->allow_null = 1;
+					} else if (IS_CONSTANT_TYPE(Z_TYPE(initialization->u.constant))) {
+						/* delay constant resolution and check to run-time */
+						cur_arg_info->allow_null = 0;
 					} else {
 						zend_error_noreturn(E_COMPILE_ERROR, "Default value for parameters with callable type hint can only be NULL");
 					}
@@ -1955,8 +1961,11 @@ void zend_do_receive_param(zend_uchar op, znode *varname, const znode *initializ
 				cur_arg_info->class_name = Z_STRVAL(class_type->u.constant);
 				cur_arg_info->class_name_len = Z_STRLEN(class_type->u.constant);
 				if (op == ZEND_RECV_INIT) {
-					if (Z_TYPE(initialization->u.constant) == IS_NULL || (Z_TYPE(initialization->u.constant) == IS_CONSTANT && !strcasecmp(Z_STRVAL(initialization->u.constant), "NULL")) || Z_TYPE(initialization->u.constant) == IS_CONSTANT_AST) {
+					if (Z_TYPE(initialization->u.constant) == IS_NULL || (Z_TYPE(initialization->u.constant) == IS_CONSTANT && !strcasecmp(Z_STRVAL(initialization->u.constant), "NULL"))) {
 						cur_arg_info->allow_null = 1;
+					} else if (IS_CONSTANT_TYPE(Z_TYPE(initialization->u.constant))) {
+						/* delay constant resolution and check to run-time */
+						cur_arg_info->allow_null = 0;
 					} else {
 						zend_error_noreturn(E_COMPILE_ERROR, "Default value for parameters with a class type hint can only be NULL");
 					}
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index 6ada04e1cb5..7ef6d1c3e6d 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -608,7 +608,22 @@ ZEND_API int zend_verify_arg_error(int error_type, const zend_function *zf, zend
 	return 0;
 }
 
-static inline int zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zval *arg, ulong fetch_type TSRMLS_DC)
+static int is_null_constant(zval *default_value)
+{
+	if (IS_CONSTANT_TYPE(Z_TYPE_P(default_value))) {
+		zval constant = *default_value;
+		zval *constant_ptr = &constant;
+
+		zval_update_constant(&constant_ptr, 0 TSRMLS_CC);
+		if (Z_TYPE(constant) == IS_NULL) {
+			return 1;
+		}
+		zval_dtor(&constant);
+	}
+	return 0;
+}
+
+static inline int zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zval *arg, ulong fetch_type, zval *default_value TSRMLS_DC)
 {
 	zend_arg_info *cur_arg_info;
 	char *need_msg;
@@ -638,7 +653,7 @@ static inline int zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zva
 			if (!ce || !instanceof_function(Z_OBJCE_P(arg), ce TSRMLS_CC)) {
 				return zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, need_msg, class_name, "instance of ", Z_OBJCE_P(arg)->name TSRMLS_CC);
 			}
-		} else if (Z_TYPE_P(arg) != IS_NULL || !cur_arg_info->allow_null) {
+		} else if (Z_TYPE_P(arg) != IS_NULL || !(cur_arg_info->allow_null || (default_value && is_null_constant(default_value)))) {
 			need_msg = zend_verify_arg_class_kind(cur_arg_info, fetch_type, &class_name, &ce TSRMLS_CC);
 			return zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, need_msg, class_name, zend_zval_type_name(arg), "" TSRMLS_CC);
 		}
@@ -649,7 +664,7 @@ static inline int zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zva
 					return zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be of the type array", "", "none", "" TSRMLS_CC);
 				}
 
-				if (Z_TYPE_P(arg) != IS_ARRAY && (Z_TYPE_P(arg) != IS_NULL || !cur_arg_info->allow_null)) {
+				if (Z_TYPE_P(arg) != IS_ARRAY && (Z_TYPE_P(arg) != IS_NULL || !(cur_arg_info->allow_null || (default_value && is_null_constant(default_value))))) {
 					return zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be of the type array", "", zend_zval_type_name(arg), "" TSRMLS_CC);
 				}
 				break;
@@ -658,7 +673,7 @@ static inline int zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zva
 				if (!arg) {
 					return zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be callable", "", "none", "" TSRMLS_CC);
 				}
-				if (!zend_is_callable(arg, IS_CALLABLE_CHECK_SILENT, NULL TSRMLS_CC) && (Z_TYPE_P(arg) != IS_NULL || !cur_arg_info->allow_null)) {
+				if (!zend_is_callable(arg, IS_CALLABLE_CHECK_SILENT, NULL TSRMLS_CC) && (Z_TYPE_P(arg) != IS_NULL || !(cur_arg_info->allow_null || (default_value && is_null_constant(default_value))))) {
 					return zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be callable", "", zend_zval_type_name(arg), "" TSRMLS_CC);
 				}
 				break;
diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h
index 705e46e7d33..03fa7cf09b7 100644
--- a/Zend/zend_vm_def.h
+++ b/Zend/zend_vm_def.h
@@ -1961,7 +1961,7 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
 			void **p = EX(function_state).arguments - num_args;
 
 			for (i = 0; i < num_args; ++i, ++p) {
-				zend_verify_arg_type(fbc, i + 1, (zval *) *p, 0 TSRMLS_CC);
+				zend_verify_arg_type(fbc, i + 1, (zval *) *p, 0, NULL TSRMLS_CC);
 			}
 		}
 
@@ -3374,7 +3374,7 @@ ZEND_VM_HANDLER(63, ZEND_RECV, ANY, ANY)
 
 	SAVE_OPLINE();
 	if (UNEXPECTED(param == NULL)) {
-		if (zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, NULL, opline->extended_value TSRMLS_CC)) {
+		if (zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, NULL, opline->extended_value, NULL TSRMLS_CC)) {
 			const char *space;
 			const char *class_name;
 			zend_execute_data *ptr;
@@ -3396,7 +3396,7 @@ ZEND_VM_HANDLER(63, ZEND_RECV, ANY, ANY)
 	} else {
 		zval **var_ptr;
 
-		zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, *param, opline->extended_value TSRMLS_CC);
+		zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, *param, opline->extended_value, NULL TSRMLS_CC);
 		var_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->result.var TSRMLS_CC);
 		Z_DELREF_PP(var_ptr);
 		*var_ptr = *param;
@@ -3438,7 +3438,7 @@ ZEND_VM_HANDLER(64, ZEND_RECV_INIT, ANY, CONST)
 		Z_ADDREF_P(assignment_value);
 	}
 
-	zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, assignment_value, opline->extended_value TSRMLS_CC);
+	zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, assignment_value, opline->extended_value, opline->op2.zv TSRMLS_CC);
 	var_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->result.var TSRMLS_CC);
 	zval_ptr_dtor(var_ptr);
 	*var_ptr = assignment_value;
@@ -3469,7 +3469,7 @@ ZEND_VM_HANDLER(164, ZEND_RECV_VARIADIC, ANY, ANY)
 
 	for (; arg_num <= arg_count; ++arg_num) {
 		zval **param = zend_vm_stack_get_arg(arg_num TSRMLS_CC);
-		zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, *param, opline->extended_value TSRMLS_CC);
+		zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, *param, opline->extended_value, NULL TSRMLS_CC);
 		zend_hash_next_index_insert(Z_ARRVAL_P(params), param, sizeof(zval *), NULL);
 		Z_ADDREF_PP(param);
 	}
diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h
index 993aaee7474..20731b4ef5f 100644
--- a/Zend/zend_vm_execute.h
+++ b/Zend/zend_vm_execute.h
@@ -541,7 +541,7 @@ static int ZEND_FASTCALL zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_AR
 			void **p = EX(function_state).arguments - num_args;
 
 			for (i = 0; i < num_args; ++i, ++p) {
-				zend_verify_arg_type(fbc, i + 1, (zval *) *p, 0 TSRMLS_CC);
+				zend_verify_arg_type(fbc, i + 1, (zval *) *p, 0, NULL TSRMLS_CC);
 			}
 		}
 
@@ -861,7 +861,7 @@ static int ZEND_FASTCALL  ZEND_RECV_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
 
 	SAVE_OPLINE();
 	if (UNEXPECTED(param == NULL)) {
-		if (zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, NULL, opline->extended_value TSRMLS_CC)) {
+		if (zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, NULL, opline->extended_value, NULL TSRMLS_CC)) {
 			const char *space;
 			const char *class_name;
 			zend_execute_data *ptr;
@@ -883,7 +883,7 @@ static int ZEND_FASTCALL  ZEND_RECV_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
 	} else {
 		zval **var_ptr;
 
-		zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, *param, opline->extended_value TSRMLS_CC);
+		zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, *param, opline->extended_value, NULL TSRMLS_CC);
 		var_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->result.var TSRMLS_CC);
 		Z_DELREF_PP(var_ptr);
 		*var_ptr = *param;
@@ -916,7 +916,7 @@ static int ZEND_FASTCALL  ZEND_RECV_VARIADIC_SPEC_HANDLER(ZEND_OPCODE_HANDLER_AR
 
 	for (; arg_num <= arg_count; ++arg_num) {
 		zval **param = zend_vm_stack_get_arg(arg_num TSRMLS_CC);
-		zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, *param, opline->extended_value TSRMLS_CC);
+		zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, *param, opline->extended_value, NULL TSRMLS_CC);
 		zend_hash_next_index_insert(Z_ARRVAL_P(params), param, sizeof(zval *), NULL);
 		Z_ADDREF_PP(param);
 	}
@@ -1643,7 +1643,7 @@ static int ZEND_FASTCALL  ZEND_RECV_INIT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_
 		Z_ADDREF_P(assignment_value);
 	}
 
-	zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, assignment_value, opline->extended_value TSRMLS_CC);
+	zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, assignment_value, opline->extended_value, opline->op2.zv TSRMLS_CC);
 	var_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->result.var TSRMLS_CC);
 	zval_ptr_dtor(var_ptr);
 	*var_ptr = assignment_value;

From 2c8aee0bb8a9e689700400f25b4588821778fcf0 Mon Sep 17 00:00:00 2001
From: Anatol Belski 
Date: Tue, 25 Nov 2014 17:56:28 +0100
Subject: [PATCH 100/102] fix TS build

---
 Zend/zend_execute.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index 7ef6d1c3e6d..cbd5689938e 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -608,7 +608,7 @@ ZEND_API int zend_verify_arg_error(int error_type, const zend_function *zf, zend
 	return 0;
 }
 
-static int is_null_constant(zval *default_value)
+static int is_null_constant(zval *default_value TSRMLS_DC)
 {
 	if (IS_CONSTANT_TYPE(Z_TYPE_P(default_value))) {
 		zval constant = *default_value;
@@ -653,7 +653,7 @@ static inline int zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zva
 			if (!ce || !instanceof_function(Z_OBJCE_P(arg), ce TSRMLS_CC)) {
 				return zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, need_msg, class_name, "instance of ", Z_OBJCE_P(arg)->name TSRMLS_CC);
 			}
-		} else if (Z_TYPE_P(arg) != IS_NULL || !(cur_arg_info->allow_null || (default_value && is_null_constant(default_value)))) {
+		} else if (Z_TYPE_P(arg) != IS_NULL || !(cur_arg_info->allow_null || (default_value && is_null_constant(default_value TSRMLS_CC)))) {
 			need_msg = zend_verify_arg_class_kind(cur_arg_info, fetch_type, &class_name, &ce TSRMLS_CC);
 			return zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, need_msg, class_name, zend_zval_type_name(arg), "" TSRMLS_CC);
 		}
@@ -664,7 +664,7 @@ static inline int zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zva
 					return zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be of the type array", "", "none", "" TSRMLS_CC);
 				}
 
-				if (Z_TYPE_P(arg) != IS_ARRAY && (Z_TYPE_P(arg) != IS_NULL || !(cur_arg_info->allow_null || (default_value && is_null_constant(default_value))))) {
+				if (Z_TYPE_P(arg) != IS_ARRAY && (Z_TYPE_P(arg) != IS_NULL || !(cur_arg_info->allow_null || (default_value && is_null_constant(default_value TSRMLS_CC))))) {
 					return zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be of the type array", "", zend_zval_type_name(arg), "" TSRMLS_CC);
 				}
 				break;
@@ -673,7 +673,7 @@ static inline int zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zva
 				if (!arg) {
 					return zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be callable", "", "none", "" TSRMLS_CC);
 				}
-				if (!zend_is_callable(arg, IS_CALLABLE_CHECK_SILENT, NULL TSRMLS_CC) && (Z_TYPE_P(arg) != IS_NULL || !(cur_arg_info->allow_null || (default_value && is_null_constant(default_value))))) {
+				if (!zend_is_callable(arg, IS_CALLABLE_CHECK_SILENT, NULL TSRMLS_CC) && (Z_TYPE_P(arg) != IS_NULL || !(cur_arg_info->allow_null || (default_value && is_null_constant(default_value TSRMLS_CC))))) {
 					return zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be callable", "", zend_zval_type_name(arg), "" TSRMLS_CC);
 				}
 				break;

From d36bf0e8ee54ef5d409322817c5c6d671cf0a19d Mon Sep 17 00:00:00 2001
From: Anatol Belski 
Date: Tue, 25 Nov 2014 17:58:20 +0100
Subject: [PATCH 101/102] fix TS build

---
 Zend/zend_execute.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index 9ac6c50410e..6c8ebca7070 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -574,7 +574,7 @@ ZEND_API void zend_verify_arg_error(int error_type, const zend_function *zf, uin
 	}
 }
 
-static int is_null_constant(zval *default_value)
+static int is_null_constant(zval *default_value TSRMLS_DC)
 {
 	if (Z_CONSTANT_P(default_value)) {
 		zval constant;
@@ -616,18 +616,18 @@ static void zend_verify_arg_type(zend_function *zf, uint32_t arg_num, zval *arg,
 			if (!ce || !instanceof_function(Z_OBJCE_P(arg), ce TSRMLS_CC)) {
 				zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, need_msg, class_name, "instance of ", Z_OBJCE_P(arg)->name->val, arg TSRMLS_CC);
 			}
-		} else if (Z_TYPE_P(arg) != IS_NULL || !(cur_arg_info->allow_null || (default_value && is_null_constant(default_value)))) {
+		} else if (Z_TYPE_P(arg) != IS_NULL || !(cur_arg_info->allow_null || (default_value && is_null_constant(default_value TSRMLS_CC)))) {
 			need_msg = zend_verify_arg_class_kind(cur_arg_info, &class_name, &ce TSRMLS_CC);
 			zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, need_msg, class_name, zend_zval_type_name(arg), "", arg TSRMLS_CC);
 		}
 	} else if (cur_arg_info->type_hint) {
 		if (cur_arg_info->type_hint == IS_ARRAY) {
 			ZVAL_DEREF(arg);
-			if (Z_TYPE_P(arg) != IS_ARRAY && (Z_TYPE_P(arg) != IS_NULL || !(cur_arg_info->allow_null || (default_value && is_null_constant(default_value))))) {
+			if (Z_TYPE_P(arg) != IS_ARRAY && (Z_TYPE_P(arg) != IS_NULL || !(cur_arg_info->allow_null || (default_value && is_null_constant(default_value TSRMLS_CC))))) {
 				zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be of the type array", "", zend_zval_type_name(arg), "", arg TSRMLS_CC);
 			}
 		} else if (cur_arg_info->type_hint == IS_CALLABLE) {
-			if (!zend_is_callable(arg, IS_CALLABLE_CHECK_SILENT, NULL TSRMLS_CC) && (Z_TYPE_P(arg) != IS_NULL || !(cur_arg_info->allow_null || (default_value && is_null_constant(default_value))))) {
+			if (!zend_is_callable(arg, IS_CALLABLE_CHECK_SILENT, NULL TSRMLS_CC) && (Z_TYPE_P(arg) != IS_NULL || !(cur_arg_info->allow_null || (default_value && is_null_constant(default_value TSRMLS_CC))))) {
 				zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be callable", "", zend_zval_type_name(arg), "", arg TSRMLS_CC);
 			}
 #if ZEND_DEBUG

From 4576b4d58a8fcc1fce5b69e948ab782696e78aaa Mon Sep 17 00:00:00 2001
From: Anatol Belski 
Date: Tue, 25 Nov 2014 18:16:26 +0100
Subject: [PATCH 102/102] fix dir separator in test

---
 Zend/tests/bug67436/bug67436_nohandler.phpt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Zend/tests/bug67436/bug67436_nohandler.phpt b/Zend/tests/bug67436/bug67436_nohandler.phpt
index 464f711532d..f1760c64629 100644
--- a/Zend/tests/bug67436/bug67436_nohandler.phpt
+++ b/Zend/tests/bug67436/bug67436_nohandler.phpt
@@ -19,6 +19,6 @@ $b = new b();
 $b->test();
 
 --EXPECTF--
-Strict Standards: Declaration of b::test() should be compatible with a::test($arg = c::TESTCONSTANT) in %s/bug67436/b.php on line %d
+Strict Standards: Declaration of b::test() should be compatible with a::test($arg = c::TESTCONSTANT) in %s%ebug67436%eb.php on line %d
 b::test()
 a::test(c::TESTCONSTANT)