Compare commits

...
168 Commits
Author SHA1 Message Date
Anatol Belski 721bcb2b7e set release versions 2016-11-08 13:17:14 +01:00
Anatol Belski c8ff491106 update NEWS 2016-11-08 13:16:20 +01:00
Anatol Belski 521838cf6d Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  fix memory leak

(cherry picked from commit e87daf363b)
2016-11-08 13:03:27 +01:00
Anatol Belski 35df4b1ae3 Fixed bug #73418 Integer Overflow in "_php_imap_mail" leads to crash
(cherry picked from commit 99b242a6d0)
(cherry picked from commit de643586de)
2016-11-08 13:02:49 +01:00
Christoph M. Becker a05e84c42b Fix #72696: imagefilltoborder stackoverflow on truecolor images
We must not allow negative color values be passed to
gdImageFillToBorder(), because that can lead to infinite recursion
since the recursion termination condition will not necessarily be met.

(cherry picked from commit 863d37ea66)
(cherry picked from commit 5693474997)
2016-11-08 13:02:19 +01:00
Christoph M. Becker bf00354cb7 Fix #72482: Ilegal write/read access caused by gdImageAALine overflow
Instead of rolling our own bounds check we use clip_1d() as it's done
in gdImageLine() and in external libgd. We must not pass the image
width and height, respectively, but rather the largest ordinate value
that is allowed to be accessed, i.e. width-1 and height-1,
respectively.

(cherry picked from commit 6499581af7)
(cherry picked from commit 1b5543b8ab)
2016-11-08 13:01:08 +01:00
Anatol Belski 44c55ec138 remove unreferenced var came in with merge
(cherry picked from commit 6b21c28b0e)
2016-11-08 12:59:12 +01:00
Stanislav Malyshev 9e1bc792df Fix bug #73331 - do not try to serialize/unserialize objects wddx can not handle
Proper soltion would be to call serialize/unserialize and deal with the result,
but this requires more work that should be done by wddx maintainer (not me).

(cherry picked from commit 6045de69c7)

Conflicts:
	ext/wddx/wddx.c

(cherry picked from commit 8c67460a10)
2016-11-08 12:58:56 +01:00
Bob Weinand 3106f0e746 Fixed build failure introduced by PR #2158
Note: AC_TRY_LINK interprets the source as part of a main function, ending up with int main() { /* ... */ int main() { /* ... */ } ; return 0; } here - Using AC_LINK_IFELSE with AC_LANG_SOURCE directly instead.
(cherry picked from commit 36527eccbb)
2016-11-07 12:04:22 +01:00
Anatol Belski 12bb3cd8d2 fix version 2016-10-25 11:18:07 +02:00
Anatol Belski 41923c1943 set versions 2016-10-25 10:40:23 +02:00
Derick Rethans 7544040469 Updated to version 2016.8 (2016h) 2016-10-24 10:37:13 +01:00
Derick Rethans 76293254cf Empty merge 2016-10-24 10:37:12 +01:00
Derick Rethans 4f5a755b9d Updated to version 2016.8 (2016h) 2016-10-24 10:37:07 +01:00
Nikita Popov 89d3e234af Fix test output
Changed due to eca84946a4.
2016-10-23 22:26:25 +02:00
Xinchen Hui eca84946a4 Fixed bug #73350 (Exception::__toString() cause circular references) 2016-10-22 14:50:21 +08:00
Adam Saponara 55d17662cb Fix bug #71241: array_replace_recursive mutates ref params
`array_replace_recursive` can sometimes mutate its params if
references are nested within. This differs from the PHP 5 behavior.
2016-10-20 13:22:04 +02:00
Leigh c3361f16c7 Add php_random_int internal API
This is the internal API compliment to `php_random_bytes`
2016-10-20 10:18:07 +01:00
Joe Watkins 9e480a1766 news entry for #pr 2152 2016-10-20 05:21:56 +01:00
Joe Watkins 295377630a Merge branch 'pull-request/2152' into PHP-7.0 2016-10-20 05:19:10 +01:00
Anatol Belski b754bc797c update NEWS 2016-10-18 19:43:12 +02:00
Anatol Belski 9f2ab75b10 Fixed bug #73329 (Float)"Nano" == NAN
The special cases (float)"inf", etc. were never intended and are
caused by the updated strtod lib. While it might be nice as an
easy way to produce Inf and NaN special values, it was never
documented and cause BC breaches.
2016-10-18 19:11:18 +02:00
Anatol Belski b4371a4292 sync NEWS
48f1a178 is reverted
2016-10-18 18:18:04 +02:00
Bob Weinand 8b177f6a2a Fixed bug #73338 (Exception thrown from error handler may crash) 2016-10-18 14:14:24 +02:00
Dmitry Stogov 7bd4e7208e Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  Fixed bug #73337 (try/catch not working with two exceptions inside a same operation)
2016-10-18 15:04:49 +03:00
Dmitry Stogov 6558559bcc Fixed bug #73337 (try/catch not working with two exceptions inside a same operation) 2016-10-18 14:48:01 +03:00
Joe Watkins 8c74be0c52 Revert "Fix bug #47890 #73215 uniqid() should use better random source"
This reverts commit 48f1a17886.
2016-10-18 11:30:19 +01:00
Yasuo Ohgaki 10a075fbd5 Update NEWS 2016-10-18 09:28:18 +09:00
Yasuo Ohgaki 48f1a17886 Fix bug #47890 #73215 uniqid() should use better random source 2016-10-18 09:13:42 +09:00
Christoph M. Becker 0b596f81b8 Merge branch 'PHP-5.6' into PHP-7.0
We also use ZEND_LONG_(MAX|MIN) now instead of LONG_(MAX|MIN).
2016-10-17 23:38:28 +02:00
Christoph M. Becker 86e603a664 Fix #73333: 2147483647 is fetched as string
We return all integers that can be represented as such by PHP as
integers, and only those that exceed the possible range as strings.
On builds which represent integers with 64 bits, the range check is
unnecessary and might cause code checkers to complain, so we skip this
special casing via the preprocessor according to
<http://git.php.net/?p=php-src.git;a=commit;h=99d087e5>.
2016-10-17 23:34:41 +02:00
Anatol Belski f85cc6aead sync NEWS 2016-10-17 21:26:34 +02:00
Joe Watkins 39ee3184ee Merge branch 'pull-request/1817' 2016-10-17 17:01:39 +01:00
Joe Watkins 5eb84337a6 Merge branch 'pull-request/1816' 2016-10-17 17:01:28 +01:00
Joe Watkins 522e4f1174 Merge branch 'pull-request/1814' 2016-10-17 17:01:10 +01:00
Joe Watkins 6806a41e7f Merge branch 'pull-request/1808' 2016-10-17 17:00:50 +01:00
Joe Watkins 96ed946b2b Merge branch 'pull-request/2097' 2016-10-17 16:03:12 +01:00
Joe Watkins bd6bce888a news entry for pr #2158 2016-10-17 15:50:59 +01:00
Joe Watkins 8d6cc00cbd Merge branch 'pull-request/2158' 2016-10-17 15:48:32 +01:00
Christopher Jones 8be59a1301 Fixed bug #71148 (Bind reference overwritten on PHP 7) 2016-10-17 12:40:14 +11:00
Bob Weinand d82da7de3a Fixed bug #71234 (INI files are loaded even invoked as phpdbg -n --version) 2016-10-16 15:41:37 +02:00
Bob Weinand e93eaee164 Fixed bug #70776 (Simple SIGINT does not have any effect) 2016-10-16 13:47:49 +02:00
Anatol Belski 6d91772c2f sync NEWS 2016-10-14 19:52:04 +02:00
Remi Collet f1cf340e19 bump ext/zip version 2016-10-14 17:31:07 +02:00
Bob Weinand 466870e2b0 Fix memory leak when compiling files in phpdbg 2016-10-14 12:24:28 +02:00
Remi Collet 428ef50838 Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  use zend_error instead of zend_error_noreturn
2016-10-14 10:54:09 +02:00
Remi Collet e1f5b6d8df use zend_error instead of zend_error_noreturn 2016-10-14 10:53:40 +02:00
Ferenc Kovacs d0b9d72da7 Merge branch 'PHP-5.6' into PHP-7.0 2016-10-14 08:08:10 +02:00
Ferenc Kovacs f7bf9650aa add missing NEWS entries for 5.6.27 2016-10-14 08:06:14 +02:00
Keith Smiley 3b9ba6195d soap #69137 - Invert logic to be correct 2016-10-13 23:56:24 -04:00
Anatol Belski 5ba9eab436 missed piece for renaming 2016-10-13 15:39:02 +02:00
Anatol Belski 730288ae41 rename publicly exposed symbol to avoid name conflicts 2016-10-13 15:23:50 +02:00
Bob Weinand d14498a475 Ignore non-executable opcodes in line mode of phpdbg_end_oplog() 2016-10-13 14:09:56 +02:00
Christoph M. Becker b8fab503fe Merge branch 'PHP-5.6' into PHP-7.0 2016-10-13 11:25:11 +02:00
Christoph M. Becker cc08cbc84d Fix #73280: Stack Buffer Overflow in GD dynamicGetbuf
We make sure to never pass a negative `rlen` as size to memcpy().

Cf. <https://github.com/libgd/libgd/commit/53110871>.
2016-10-13 11:10:02 +02:00
Anatol Belski ce3e792c2c use already exported symbol 2016-10-13 09:55:37 +02:00
Anatol Belski 3104882cf8 Revert "export symbol missing by phpdbg"
This reverts commit 611ab7fe5b.

Overseen strpprintf is there
2016-10-13 09:50:32 +02:00
Stanislav Malyshev cd8c9b0614 Fix outlen for openssl function
Even though datalen can't be over int, outlen can.
2016-10-12 23:19:07 -07:00
Stanislav Malyshev 2301608736 Syncronize with 5.6 - __toString should return "" 2016-10-12 23:09:49 -07:00
Stanislav Malyshev 9c50ba42d6 Fix potential overflows in php_pcre_replace_impl 2016-10-12 23:07:47 -07:00
Anatol Belski 0723a226c3 Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  Clear FG(user_stream_current_filename) when bailing out
  Fix tests
  fix tsrm
  Fix bug #73284 - heap overflow in php_ereg_replace function
  Fix bug #73276 - crash in openssl_random_pseudo_bytes function
  Fix bug #73293 - NULL pointer dereference in SimpleXMLElement::asXML()
  fix bug #73275 - crash in openssl_encrypt function
  Fix for #73240 - Write out of bounds at number_format
  Bug #73218: add mitigation for ICU int overflow
  Add more locale length checks, due to ICU bugs.
  Fix bug #73208 - another missing length check
  Fix bug #73190: memcpy negative parameter _bc_new_num_ex
  Fix bug #73189 - Memcpy negative size parameter php_resolve_path
  Fixed bug #73174 - heap overflow in php_pcre_replace_impl
  Fix bug #73150: missing NULL check in dom_document_save_html
  Fix bug #73147: Use After Free in PHP7 unserialize()
  Fix bug #73082
  Fix bug #73073 - CachingIterator null dereference when convert to string
2016-10-13 01:31:36 +02:00
Keith Smiley 26287132c0 Fixed bug #73237
If the response includes both fields with simple types (which get
concatenated into an XML string) and a complex type (which is parsed
into an object), then the object will parsed into the same zval as the
simple types and will overwrite the string.
2016-10-12 23:12:45 +02:00
Mitch Hagstrand bcee2fdbec Fixed bug in zend_accel_error() and cleaned up kill_all_lockers()
1. zend_accel_error was only executing clean up if log_verbosity_level is high enough to log
2. Cleaned up kill_all_lockers function and fixed comments.
2016-10-12 23:03:55 +02:00
Bob Weinand fe49fd7dad Update NEWS
Also add missing include.inc test file
2016-10-12 22:54:32 +02:00
Nikita Popov fe378c27cc Fix phpdbg tests after lineno change 2016-10-12 22:41:59 +02:00
Nikita Popov 5b429fef42 Fix line number of implicit return in pseudo-main scope 2016-10-12 22:25:41 +02:00
Anatol Belski 611ab7fe5b export symbol missing by phpdbg 2016-10-12 22:18:41 +02:00
Bob Weinand 671d8054f8 Fix accidental PHPDBG_ABI break 2016-10-12 22:16:11 +02:00
Stanislav Malyshev c4c2cce37d Fix bug #73189 - Memcpy negative size parameter php_resolve_path
(cherry picked from commit da7e89cde8)
2016-10-12 21:31:37 +02:00
Anatol Belski 58b18892bf update len in fallback cases 2016-10-12 20:52:46 +02:00
Bob Weinand 5aae01104f Add stdin command and -s command line parameter to phpdbg
This allows reading the initial script file from stdin instead of being forced to put the script into a file in order to run it with phpdbg.
Especially important for programmatic execution of phpdbg.

Also adding tests/include_once.phpt and tests/set_exception_handler.phpt as I seem to have forgotten to git add them sometime long ago...
2016-10-12 20:15:49 +02:00
Stanislav Malyshev 74b5662536 Fix bug #73190: memcpy negative parameter _bc_new_num_ex
(cherry picked from commit 40e7baab3c)
2016-10-12 19:48:25 +02:00
Stanislav Malyshev f42cbd749c Fix bug #73147: Use After Free in PHP7 unserialize()
(cherry picked from commit 0e6fe3a4c9)
2016-10-12 17:51:15 +02:00
Anatol Belski efc1f33b58 fix typo 2016-10-12 17:12:38 +02:00
Anatol Belski 80eb013a92 Revert "Fix for #73240 - Write out of bounds at number_format"
This reverts commit 01280f8deb.

The fix is already merged by Stas.
2016-10-12 16:12:18 +02:00
Anatol Belski b135ba3fa9 followup with #73276 merge 2016-10-12 16:03:35 +02:00
Anatol Belski 7c6cb1282d fix test 2016-10-12 16:03:09 +02:00
Stanislav Malyshev 7dc8b5e7ae Fix bug #73276 - crash in openssl_random_pseudo_bytes function
(cherry picked from commit 85a22a0af0)
2016-10-12 15:55:42 +02:00
Stanislav Malyshev 4ef79370a8 Fix bug #73293 - NULL pointer dereference in SimpleXMLElement::asXML()
(cherry picked from commit 96a8cf8e1b)
2016-10-12 15:40:21 +02:00
Stanislav Malyshev 01280f8deb Fix for #73240 - Write out of bounds at number_format
(cherry picked from commit 8259130b6b)
2016-10-12 14:55:00 +02:00
Anatol Belski aaa5d07365 avoid strlen 2016-10-12 13:28:23 +02:00
Stanislav Malyshev b26b02b2df Bug #73218: add mitigation for ICU int overflow
(cherry picked from commit d946d10293)
2016-10-12 13:22:51 +02:00
Stanislav Malyshev 87a8240b5a Add more locale length checks, due to ICU bugs.
(cherry picked from commit d3eb58332a)
2016-10-12 13:11:16 +02:00
Stanislav Malyshev d1e878f272 Fix bug #73150: missing NULL check in dom_document_save_html
(cherry picked from commit 1c0e9126fb)
2016-10-12 12:19:41 +02:00
Sara Golemon 43ccf23d70 Clear FG(user_stream_current_filename) when bailing out
If a userwrapper opener E_ERRORs then FG(user_stream_current_filename)
would remain set until the next request and would not be pointing
at unallocated memory.

Catch the bailout, clear the variable, then continue bailing.

Closes https://bugs.php.net/bug.php?id=73188
2016-10-11 21:55:01 -07:00
Sara Golemon 4d11a8eedf Clear FG(user_stream_current_filename) when bailing out
If a userwrapper opener E_ERRORs then FG(user_stream_current_filename)
would remain set until the next request and would not be pointing
at unallocated memory.

Catch the bailout, clear the variable, then continue bailing.

Closes https://bugs.php.net/bug.php?id=73188
2016-10-11 21:44:14 -07:00
Stanislav Malyshev 1bdb30a429 Merge branch 'PHP-7.0.12' into PHP-7.0
* PHP-7.0.12:
  set versions and release date
  sync NEWS
  Revert "Fixed bug #73067 (__debugInfo crashes when throwing an exception)"
  Fix for #73240 - Write out of bounds at number_format
  Fix bug #73257 and bug #73258 - SplObjectStorage unserialize allows use of non-object as key
  set versions
  Fix bug #73091 - Unserializing DateInterval object may lead to __toString invocation
2016-10-11 16:46:51 -07:00
Stanislav Malyshev 689a9b8def Merge branch 'PHP-5.6.27' into PHP-5.6
* PHP-5.6.27:
  Fix tests
  fix tsrm
  Fix bug #73284 - heap overflow in php_ereg_replace function
  Fix bug #73276 - crash in openssl_random_pseudo_bytes function
  Fix bug #73293 - NULL pointer dereference in SimpleXMLElement::asXML()
  fix bug #73275 - crash in openssl_encrypt function
  Fix for #73240 - Write out of bounds at number_format
  Bug #73218: add mitigation for ICU int overflow
  Add more locale length checks, due to ICU bugs.
  Fix bug #73208 - another missing length check
  Fix bug #73190: memcpy negative parameter _bc_new_num_ex
  Fix bug #73189 - Memcpy negative size parameter php_resolve_path
  Fixed bug #73174 - heap overflow in php_pcre_replace_impl
  Fix bug #73150: missing NULL check in dom_document_save_html
  Fix bug #73147: Use After Free in PHP7 unserialize()
  Fix bug #73082
  Fix bug #73073 - CachingIterator null dereference when convert to string
2016-10-11 16:26:35 -07:00
Stanislav Malyshev 082d1f2375 Fix tests 2016-10-11 16:18:08 -07:00
Stanislav Malyshev c1112ff323 fix tsrm 2016-10-11 14:39:16 -07:00
Stanislav Malyshev 21452a5401 Fix bug #73284 - heap overflow in php_ereg_replace function 2016-10-11 14:16:51 -07:00
Stanislav Malyshev 85a22a0af0 Fix bug #73276 - crash in openssl_random_pseudo_bytes function 2016-10-11 13:37:47 -07:00
Stanislav Malyshev 96a8cf8e1b Fix bug #73293 - NULL pointer dereference in SimpleXMLElement::asXML() 2016-10-11 13:30:52 -07:00
Stanislav Malyshev 8822f7c9f0 fix bug #73275 - crash in openssl_encrypt function 2016-10-11 13:19:20 -07:00
Anatol Belski 5899f76a7d update NEWS 2016-10-11 11:41:45 +02:00
Stanislav Malyshev 8259130b6b Fix for #73240 - Write out of bounds at number_format 2016-10-10 23:42:50 -07:00
Anatol Belski 29a089d3c9 update NEWS 2016-10-10 20:57:57 +02:00
Anatol Belski bf400108d9 Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  update NEWS
2016-10-10 20:57:23 +02:00
Anatol Belski 4165d97606 update NEWS 2016-10-10 20:55:44 +02:00
Anatol Belski 62c68f7483 Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  add test for bug #73037
2016-10-10 16:02:30 +02:00
Anatol Belski 256b150a96 add test for bug #73037 2016-10-10 15:59:52 +02:00
Nikita Popov c91f652ddb Fixed bug #73273
As well as a few other $_SESSION separation issues.
2016-10-10 12:20:44 +02:00
Christoph M. Becker fb08216b08 Merge branch 'PHP-5.6' into PHP-7.0 2016-10-10 11:45:53 +02:00
Christoph M. Becker fc989fc6e7 Fix #73279: Integer overflow in gdImageScaleBilinearPalette()
The color components are supposed to be in range 0..255, so we must not
cast them to `signed char`, what can be the default for `char`.

Port of <https://github.com/libgd/libgd/commit/77c8d359>.
2016-10-10 11:41:39 +02:00
Christoph M. Becker c930714cbe Merge branch 'PHP-5.6' into PHP-7.0 2016-10-09 15:14:17 +02:00
Christoph M. Becker b92216b97d Fix #73272: imagescale() affects imagesetinterpolation()
We must not permanently change the interpolation method, but rather
have to restore the old method after we're done with scaling the image.
2016-10-09 15:10:34 +02:00
Anatol Belski 6f84ac721b Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  fix leak
2016-10-08 19:25:36 +02:00
Anatol Belski 3c5742ebd7 fix leak 2016-10-08 19:07:35 +02:00
Nikita Popov 2a75f5026a Fix bug #66773, #66862
This a partial backport of 8754b19. It
a) fixes the class/function/constant import table confusion in the
   namespaced case, and
b) restricts conflict checks to a single file based on a filename
   pointer comparison.

It does not fix the issues with filename reuse (e.g. due to eval)
and late-bound classes. This part of the change requires globals
changes.
2016-10-08 17:00:27 +02:00
Nikita Popov 159de7723e Merge branch 'PHP-5.6' into PHP-7.0 2016-10-08 01:06:02 +02:00
Nikita Popov b061fa909d Fix bug #73192 2016-10-08 01:04:22 +02:00
Nikita Popov bc3a0b82b8 Revert "Fixed test"
This reverts commit a10d03ac16.
2016-10-08 00:43:36 +02:00
Nikita Popov 1c468ee044 Revert "Added validation to parse_url() to prohibit restricted characters inside login/pass components based on RFC3986"
This reverts commit 085dfca02b.
2016-10-08 00:43:17 +02:00
Christoph M. Becker 825e0fd430 Document that ext/shmop deals with resources as of PHP 7.0.0
Second attempt
2016-10-07 16:35:37 +02:00
Anatol Belski ea83e504e5 fix datatype 2016-10-06 11:01:27 +02:00
Anatol Belski 5b79e95f7b Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  Fix bug #73037, second round
2016-10-05 15:03:38 +02:00
Anatol Belski 07546496b1 Fix bug #73037, second round 2016-10-05 14:54:06 +02:00
Bob Weinand 4790da5475 Update run command for allowing STDIN 2016-10-05 12:14:02 +02:00
Bob Weinand eaff72f31b Remove phpdbg fix targeting 7.1 which landed in 7.0 2016-10-05 12:08:20 +02:00
Stanislav Malyshev d946d10293 Bug #73218: add mitigation for ICU int overflow 2016-10-04 22:40:43 -07:00
Stanislav Malyshev 56e19b7c75 Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  Fixed test
  Added validation to parse_url() to prohibit restricted characters inside login/pass components based on RFC3986
  Apparently negative wordwrap is a thing and should work as length = 0.
2016-10-04 21:56:28 -07:00
Stanislav Malyshev d3eb58332a Add more locale length checks, due to ICU bugs. 2016-10-04 21:28:40 -07:00
Ilia Alshanetsky a10d03ac16 Fixed test 2016-10-04 21:20:38 -07:00
Ilia Alshanetsky 085dfca02b Added validation to parse_url() to prohibit restricted characters inside login/pass components based on RFC3986 2016-10-04 21:20:31 -07:00
Stanislav Malyshev 8ea01d5f19 Apparently negative wordwrap is a thing and should work as length = 0.
I'll leave it as is for now.
2016-10-03 19:17:42 -07:00
Stanislav Malyshev 49b45e5af1 Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  Really fix bug #73017
2016-10-03 18:38:46 -07:00
Stanislav Malyshev 631173aa5c Really fix bug #73017 2016-10-03 18:07:21 -07:00
Keith Smiley 31cbce341c soap #69137 - Fix SSL verify when using a proxy
Name verification was failing because the OpenSSL extension was picking
the proxy server's address when guessing which name to compare to the
SSL certificate. This scenario is already handled for stream wrappers
in http_fopen_wrapper.c. This patch applies the same fix to the SOAP
extension: when a proxy is used, set peer_name explicitly on the stream
context.
2016-10-03 14:02:34 -04:00
Bob Weinand 8908df690f Fix crash on Linux due to double fclose() 2016-10-03 12:55:06 +02:00
Stanislav Malyshev ef801b9bf9 Fix bug #73208 - another missing length check 2016-10-03 00:12:14 -07:00
Stanislav Malyshev 40e7baab3c Fix bug #73190: memcpy negative parameter _bc_new_num_ex 2016-10-03 00:09:02 -07:00
Bob Weinand 417a8ef6b4 Fix run command args passing when inmidst execution 2016-10-02 12:45:20 +01:00
Bob Weinand 9d537951c5 Add proper escape sequences and reading stdin from file in phpdbg run command 2016-10-01 19:05:19 +01:00
Nikita Popov 633b93817e Merge branch 'PHP-5.6' into PHP-7.0 2016-10-01 19:05:48 +02:00
Nikita Popov f9d4b1a3f1 Fix leak in zend_exception_error
Only occurs if a non-fatal severity level is used, e.g. when using
interactive mode.
2016-10-01 19:04:31 +02:00
Bob Weinand 3280a29ee5 Fix invalid access to interned strings after they are freed in phpdbg 2016-10-01 10:46:21 +01:00
Christoph M. Becker 12967bc346 Merge branch 'PHP-5.6' into PHP-7.0 2016-09-30 23:54:18 +02:00
Christoph M. Becker 9acfb1a3a5 Fix #73213: Integer overflow in imageline() with antialiasing
We port the respective fixes <https://github.com/libgd/libgd/commit/eca37d620>
and <https://github.com/libgd/libgd/commit/837b7327> to our bundled libgd.
2016-09-30 23:38:13 +02:00
Derick Rethans 6ad288ee23 Merge branch 'PHP-5.6' into PHP-7.0 2016-09-30 20:49:53 +01:00
Derick Rethans c0219b323e Fixed tests due to changes in underlaying data 2016-09-30 20:49:44 +01:00
Derick Rethans 7deb32abc9 Merge branch 'PHP-5.6' into PHP-7.0 2016-09-30 20:31:05 +01:00
Derick Rethans 91fd4bf000 Fixed parsing of AM/PM without all the expected dots in place 2016-09-30 20:21:48 +01:00
Christoph M. Becker dd93712911 Merge branch 'PHP-5.6' into PHP-7.0 2016-09-30 11:40:55 +02:00
Christoph M. Becker e72165bb86 Fix #73203: passing additional_parameters causes mail to fail
We make sure that there's no unsigned underflow, which happened for `y==0`.
2016-09-30 11:38:09 +02:00
Joe Watkins e60620b974 Merge branch 'PHP-7.0' of https://github.com/php/php-src into PHP-7.0 2016-09-30 07:22:50 +01:00
Joe Watkins a8d031fbd8 fix user filter bug 2016-09-30 07:21:01 +01:00
Christoph M. Becker 81cbbb68af Merge branch 'pull-request/2128' into PHP-7.0 2016-09-29 14:39:39 +02:00
Anatol Belski 62bed405da sync win32 makefile with makedist zendparse exports
With a newer bison this part is relevant. Whil bison 2.4.1 is still
used, this changes cater for the forward compatibility.
2016-09-29 12:56:49 +02:00
Dmitry Stogov e7f4355d9b Better fix for bug #72854 (avoid extra copy and creating reference to stack variable) 2016-09-29 10:56:01 +03:00
Stanislav Malyshev da7e89cde8 Fix bug #73189 - Memcpy negative size parameter php_resolve_path 2016-09-28 23:30:48 -07:00
Stanislav Malyshev 29e2a204fb Fixed bug #73174 - heap overflow in php_pcre_replace_impl 2016-09-28 22:29:59 -07:00
Ferenc Kovacs 581e890483 Merge branch 'PHP-5.6' into PHP-7.0
Conflicts:
	configure.in
	main/php_version.h
2016-09-29 00:58:02 +02:00
Ferenc Kovacs 703c247c7d 5.6.28 is next 2016-09-29 00:55:36 +02:00
Derick Rethans 83780a6cd2 Updated to version 2016.7 (2016g) 2016-09-28 23:30:27 +01:00
Derick Rethans 03ac064b2e Empty merge 2016-09-28 23:30:27 +01:00
Derick Rethans 6a544f2d1e Updated to version 2016.7 (2016g) 2016-09-28 23:30:26 +01:00
Nikita Popov e520b9e127 Merge branch 'PHP-5.6' into PHP-7.0 2016-09-28 23:22:11 +02:00
Nikita Popov 1f5412982c Handle resource keys in constexpr arrays 2016-09-28 23:11:02 +02:00
Nikita Popov 40b8105cca Fix the constant array case as well 2016-09-28 23:05:21 +02:00
Nikita Popov 437942d972 Merge branch 'PHP-5.6' into PHP-7.0 2016-09-28 22:36:58 +02:00
Nikita Popov 99bf19c177 Check next_index_insert failure in ADD_ARRAY_ELEMENT 2016-09-28 22:35:27 +02:00
Nikita Popov b7cbaa7f43 Fix bug #73181 2016-09-27 19:47:48 +02:00
Anatol Belski cb29c01ed6 prepare next 2016-09-27 12:49:52 +02:00
Stanislav Malyshev 1c0e9126fb Fix bug #73150: missing NULL check in dom_document_save_html 2016-09-25 21:25:01 -07:00
Stanislav Malyshev 0e6fe3a4c9 Fix bug #73147: Use After Free in PHP7 unserialize() 2016-09-25 19:53:59 -07:00
Stanislav Malyshev e1709b7e58 Fix bug #73082 2016-09-25 16:07:14 -07:00
Stanislav Malyshev 33a8af0510 Fix bug #73073 - CachingIterator null dereference when convert to string 2016-09-20 22:59:12 -07:00
Christoph M. Becker 44968927d7 Add CURLE_SSL_PINNEDPUBKEYNOTMATCH
This error constant is returned on key mismatch when CURLOPT_PINNEDPUBLICKEY
is used. As the option had been introduced in PHP 7.0.7, it makes sense to
also add the related error constant to PHP 7.0+.

Cf. <https://curl.haxx.se/libcurl/c/CURLOPT_PINNEDPUBLICKEY.html>.
2016-09-15 12:20:19 +02:00
155 changed files with 10917 additions and 8344 deletions

No files matched your search

+93
View File
@@ -1,5 +1,71 @@
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
10 Nov 2016 PHP 7.0.13
- Core:
. Fixed bug #73350 (Exception::__toString() cause circular references).
(Laruence)
. Fixed bug #73181 (parse_str() without a second argument leads to crash).
(Nikita)
. Fixed bug #66773 (Autoload with Opcache allows importing conflicting class
name to namespace). (Nikita)
. Fixed bug #66862 ((Sub-)Namespaces unexpected behaviour). (Nikita)
. Fix pthreads detection when cross-compiling (ffontaine)
. Fixed bug #73337 (try/catch not working with two exceptions inside a same
operation). (Dmitry)
. Fixed bug #73338 (Exception thrown from error handler causes valgrind
warnings (and crashes)). (Bob, Dmitry)
. Fixed bug #73329 ((Float)"Nano" == NAN). (Anatol)
- GD:
. Fixed bug #73213 (Integer overflow in imageline() with antialiasing). (cmb)
. Fixed bug #73272 (imagescale() is not affected by, but affects
imagesetinterpolation()). (cmb)
. Fixed bug #73279 (Integer overflow in gdImageScaleBilinearPalette()). (cmb)
. Fixed bug #73280 (Stack Buffer Overflow in GD dynamicGetbuf). (cmb)
. Fixed bug #72482 (Ilegal write/read access caused by gdImageAALine
overflow). (cmb)
. Fixed bug #72696 (imagefilltoborder stackoverflow on truecolor images).
(cmb)
- IMAP:
. Fixed bug #73418 (Integer Overflow in "_php_imap_mail" leads to crash).
(Anatol)
- OCI8
. Fixed bug #71148 (Bind reference overwritten on PHP 7). (Oracle Corp.)
- phpdbg:
. Properly allow for stdin input from a file. (Bob)
. Add -s command line option / stdin command for reading script from stdin.
(Bob)
. Ignore non-executable opcodes in line mode of phpdbg_end_oplog(). (Bob)
. Fixed bug #70776 (Simple SIGINT does not have any effect with -rr). (Bob)
. Fixed bug #71234 (INI files are loaded even invoked as -n --version). (Bob)
- Session:
. Fixed bug #73273 (session_unset() empties values from all variables in which
is $_session stored). (Nikita)
- SOAP:
. Fixed bug #73037 (SoapServer reports Bad Request when gzipped). (Anatol)
. Fixed bug #73237 (Nested object in "any" element overwrites other fields).
(Keith Smiley)
. Fixed bug #69137 (Peer verification fails when using a proxy with SoapClient)
(Keith Smiley)
- SQLite3:
. Fixed bug #73333 (2147483647 is fetched as string). (cmb)
- Standard:
. Fixed bug #73203 (passing additional_parameters causes mail to fail). (cmb)
. Fixed bug #71241 (array_replace_recursive sometimes mutates its parameters).
(adsr)
- Wddx:
. Fixed bug #73331 (NULL Pointer Dereference in WDDX Packet Deserialization
with PDORow). (Stas)
13 Oct 2016 PHP 7.0.12
- Core:
@@ -13,10 +79,23 @@ PHP NEWS
. Fixed bug #73163 (PHP hangs if error handler throws while accessing undef
const in default value). (Nikita)
. Fixed bug #73172 (parse error: Invalid numeric literal). (Nikita, Anatol)
. Fixed for #73240 (Write out of bounds at number_format). (Stas)
. Fixed bug #73147 (Use After Free in PHP7 unserialize()). (Stas)
. Fixed bug #73189 (Memcpy negative size parameter php_resolve_path). (Stas)
- BCmath:
. Fix bug #73190 (memcpy negative parameter _bc_new_num_ex). (Stas)
- COM:
. Fixed bug #73126 (Cannot pass parameter 1 by reference). (Anatol)
- Date:
. Fixed bug #73091 (Unserializing DateInterval object may lead to __toString
invocation). (Stas)
- DOM:
. Fixed bug #73150 (missing NULL check in dom_document_save_html). (Stas)
- Filter:
. Fixed bug #72972 (Bad filter for the flags FILTER_FLAG_NO_RES_RANGE and
FILTER_FLAG_NO_PRIV_RANGE). (julien)
@@ -38,6 +117,9 @@ PHP NEWS
files). (cmb)
. Fixed bug #73161 (imagecreatefromgd2() may leak memory). (cmb)
- Intl:
. Fixed bug #73218 (add mitigation for ICU int overflow). (Stas)
- Mbstring:
. Fixed bug #66797 (mb_substr only takes 32-bit signed integer). (cmb)
. Fixed bug #66964 (mb_convert_variables() cannot detect recursion) (Yasuo)
@@ -55,10 +137,13 @@ PHP NEWS
- OpenSSL:
. Fixed bug #73072 (Invalid path SNI_server_certs causes segfault).
(Jakub Zelenka)
. Fixed bug #73276 (crash in openssl_random_pseudo_bytes function). (Stas)
. Fixed bug #73275 (crash in openssl_encrypt function). (Stas)
- PCRE:
. Fixed bug #73121 (Bundled PCRE doesn't compile because JIT isn't supported
on s390). (Anatol)
. Fixed bug #73174 (heap overflow in php_pcre_replace_impl). (Stas)
- PDO_DBlib:
. Fixed bug #72414 (Never quote values as raw binary data). (Adam Baratz)
@@ -82,11 +167,19 @@ PHP NEWS
. Fixed bug #73100 (session_destroy null dereference in ps_files_path_create).
(cmb)
- SimpleXML:
. Fixed bug #73293 (NULL pointer dereference in SimpleXMLElement::asXML()).
(Stas)
- SOAP:
. Fixed bug #71711 (Soap Server Member variables reference bug). (Nikita)
. Fixed bug #71996 (Using references in arrays doesn't work like expected).
(Nikita)
- SPL:
. Fixed bug #73257, #73258 (SplObjectStorage unserialize allows use of
non-object as key). (Stas)
- SQLite3:
. Updated bundled SQLite3 to 3.14.2. (cmb)
+26 -29
View File
@@ -66,7 +66,7 @@ dnl
dnl Check whether the current setup can use POSIX threads calls
dnl
AC_DEFUN([PTHREADS_CHECK_COMPILE], [
AC_TRY_RUN( [
AC_LINK_IFELSE([ AC_LANG_SOURCE([
#include <pthread.h>
#include <stddef.h>
@@ -80,18 +80,11 @@ int main() {
int data = 1;
pthread_mutexattr_init(&mattr);
return pthread_create(&thd, NULL, thread_routine, &data);
} ], [
pthreads_working=yes
} ]) ], [
pthreads_checked=yes
], [
pthreads_working=no
], [
dnl For cross compiling running this test is of no use. NetWare supports pthreads
pthreads_working=no
case $host_alias in
*netware*)
pthreads_working=yes
esac
]
pthreads_checked=no
]
) ] )dnl
dnl
dnl PTHREADS_CHECK()
@@ -129,30 +122,34 @@ else
CFLAGS="$CFLAGS $flag"
PTHREADS_CHECK_COMPILE
CFLAGS=$ac_save
if test "$pthreads_working" = "yes"; then
if test "$pthreads_checked" = "yes"; then
ac_cv_pthreads_cflags=$flag
break
fi
done
fi
fi
])
])
AC_CACHE_CHECK(for pthreads_lib, ac_cv_pthreads_lib,[
ac_cv_pthreads_lib=
if test "$pthreads_working" != "yes"; then
for lib in pthread pthreads c_r; do
ac_save=$LIBS
LIBS="$LIBS -l$lib"
PTHREADS_CHECK_COMPILE
LIBS=$ac_save
if test "$pthreads_working" = "yes"; then
ac_cv_pthreads_lib=$lib
break
fi
done
AC_CACHE_CHECK(for pthreads_lib, ac_cv_pthreads_lib,[
ac_cv_pthreads_lib=
if test "$pthreads_working" != "yes"; then
for lib in pthread pthreads c_r; do
ac_save=$LIBS
LIBS="$LIBS -l$lib"
PTHREADS_CHECK_COMPILE
LIBS=$ac_save
if test "$pthreads_checked" = "yes"; then
ac_cv_pthreads_lib=$lib
break
fi
done
fi
])
if test "x$ac_cv_pthreads_cflags" != "x" -o "x$ac_cv_pthreads_lib" != "x"; then
pthreads_working="yes"
fi
fi
])
if test "$pthreads_working" = "yes"; then
threads_result="POSIX-Threads found"
+3
View File
@@ -727,6 +727,9 @@ out, that the corresponding SDK isn't available anymore.
- Openssl
minimum supported OpenSSL version series was raised to 0.9.8
- Shmop
The shmop identifiers have been changed from ints to resources of type shmop.
========================================
10. New Global Constants
========================================
@@ -0,0 +1,25 @@
--TEST--
Next free element may overflow in array literals
--FILE--
<?php
$i = PHP_INT_MAX;
$array = [$i => 42, new stdClass];
var_dump($array);
const FOO = [PHP_INT_MAX => 42, "foo"];
var_dump(FOO);
?>
--EXPECTF--
Warning: Cannot add element to the array as the next element is already occupied in %s on line %d
array(1) {
[%d]=>
int(42)
}
Warning: Cannot add element to the array as the next element is already occupied in %s on line %d
array(1) {
[%d]=>
int(42)
}
+1 -1
View File
@@ -1,5 +1,5 @@
--TEST--
iBug #73156 (segfault on undefined function)
Bug #73156 (segfault on undefined function)
--FILE--
<?php
class A {
+20
View File
@@ -0,0 +1,20 @@
--TEST--
Bug #73181: parse_str() without a second argument leads to crash
--FILE--
<?php
function x() {
parse_str("1&x");
var_dump(get_defined_vars());
}
x();
?>
--EXPECT--
array(2) {
[1]=>
string(0) ""
["x"]=>
string(0) ""
}
+12
View File
@@ -0,0 +1,12 @@
--TEST--
Bug #73337 (try/catch not working with two exceptions inside a same operation)
--FILE--
<?php
class d { function __destruct() { throw new Exception; } }
try { new d + new d; } catch (Exception $e) { print "Exception properly caught\n"; }
?>
--EXPECTF--
Notice: Object of class d could not be converted to int in %sbug73337.php on line 3
Notice: Object of class d could not be converted to int in %sbug73337.php on line 3
Exception properly caught
+18
View File
@@ -0,0 +1,18 @@
--TEST--
Bug #73338: Ensure exceptions in function init opcodes are cleaned properly
--FILE--
<?php
try { call_user_func(new class { function __destruct () { throw new Error; } }); } catch (Error $e) {}
set_error_handler(function() { throw new Error; });
try { var_dump(new stdClass, call_user_func("fail")); } catch (Error $e) {}
try { (function() { call_user_func("fail"); })(); } catch (Error $e) {}
try { [new class { static function foo() {} function __destruct () { throw new Error; } }, "foo"](); } catch (Error $e) {}
?>
--EXPECTF--
Warning: call_user_func() expects parameter 1 to be a valid callback, no array or string given in %s on line %d
+27
View File
@@ -0,0 +1,27 @@
--TEST--
Bug #73350 (Exception::__toString() cause circular references)
--FILE--
<?php
$e = new Exception();
// This line cause problem :(
// Comment it to see the difference.
(string) $e;
// This line show the clue (PHP Warning: ...).
var_export($e);
?>
--EXPECTF--
Exception::__set_state(array(
'message' => '',
'string' => 'Exception in %sbug73350.php:%d
Stack trace:
#0 {main}',
'code' => 0,
'file' => '%sbug73350.php',
'line' => %d,
'trace' =>
array (
),
'previous' => NULL,
))
@@ -0,0 +1,15 @@
--TEST--
Constexpr arrays should be able to handle resource keys
--FILE--
<?php
const FOO = [STDIN => 42];
var_dump(FOO);
?>
--EXPECTF--
Notice: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
array(1) {
[%d]=>
int(42)
}
@@ -0,0 +1,15 @@
--TEST--
"use function" should not conflict with class names
--FILE--
<?php
namespace Foo;
class Bar {}
use function bar;
?>
===DONE===
--EXPECT--
===DONE===
+12
View File
@@ -0,0 +1,12 @@
--TEST--
Use conflicts should not occur across files
--FILE--
<?php
require __DIR__ . '/use_no_file_conflict_1.inc';
require __DIR__ . '/use_no_file_conflict_2.inc';
?>
===DONE===
--EXPECT--
===DONE===
+4
View File
@@ -0,0 +1,4 @@
<?php
namespace Foo;
class A {}
+4
View File
@@ -0,0 +1,4 @@
<?php
namespace Foo;
use A;
+18
View File
@@ -3847,6 +3847,24 @@ ZEND_API void zend_update_property_null(zend_class_entry *scope, zval *object, c
}
/* }}} */
ZEND_API void zend_unset_property(zend_class_entry *scope, zval *object, const char *name, size_t name_length) /* {{{ */
{
zval property;
zend_class_entry *old_scope = EG(scope);
EG(scope) = scope;
if (!Z_OBJ_HT_P(object)->unset_property) {
zend_error_noreturn(E_CORE_ERROR, "Property %s of class %s cannot be unset", name, ZSTR_VAL(Z_OBJCE_P(object)->name));
}
ZVAL_STRINGL(&property, name, name_length);
Z_OBJ_HT_P(object)->unset_property(object, &property, 0);
zval_ptr_dtor(&property);
EG(scope) = old_scope;
}
/* }}} */
ZEND_API void zend_update_property_bool(zend_class_entry *scope, zval *object, const char *name, size_t name_length, zend_long value) /* {{{ */
{
zval tmp;
+1
View File
@@ -343,6 +343,7 @@ ZEND_API void zend_update_property_double(zend_class_entry *scope, zval *object,
ZEND_API void zend_update_property_str(zend_class_entry *scope, zval *object, const char *name, size_t name_length, zend_string *value);
ZEND_API void zend_update_property_string(zend_class_entry *scope, zval *object, const char *name, size_t name_length, const char *value);
ZEND_API void zend_update_property_stringl(zend_class_entry *scope, zval *object, const char *name, size_t name_length, const char *value, size_t value_length);
ZEND_API void zend_unset_property(zend_class_entry *scope, zval *object, const char *name, size_t name_length);
ZEND_API int zend_update_static_property(zend_class_entry *scope, const char *name, size_t name_length, zval *value);
ZEND_API int zend_update_static_property_null(zend_class_entry *scope, const char *name, size_t name_length);
+6 -19
View File
@@ -1472,7 +1472,7 @@ static void *zend_mm_realloc_heap(zend_mm_heap *heap, void *ptr, size_t size, si
#endif
#ifdef ZEND_WIN32
/* On Windows we don't have ability to extend huge blocks in-place.
* We allocate them with 2MB size granularity, to avoid many
* We allocate them with 2MB size granularity, to avoid many
* reallocations when they are extended by small pieces
*/
new_size = ZEND_MM_ALIGNED_SIZE_EX(size, MAX(REAL_PAGE_SIZE, ZEND_MM_CHUNK_SIZE));
@@ -1740,7 +1740,7 @@ static void *zend_mm_alloc_huge(zend_mm_heap *heap, size_t size ZEND_FILE_LINE_D
{
#ifdef ZEND_WIN32
/* On Windows we don't have ability to extend huge blocks in-place.
* We allocate them with 2MB size granularity, to avoid many
* We allocate them with 2MB size granularity, to avoid many
* reallocations when they are extended by small pieces
*/
size_t new_size = ZEND_MM_ALIGNED_SIZE_EX(size, MAX(REAL_PAGE_SIZE, ZEND_MM_CHUNK_SIZE));
@@ -2500,37 +2500,24 @@ ZEND_API size_t ZEND_FASTCALL _zend_mem_block_size(void *ptr ZEND_FILE_LINE_DC Z
return zend_mm_size(AG(mm_heap), ptr ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
}
static zend_always_inline size_t safe_address(size_t nmemb, size_t size, size_t offset)
{
int overflow;
size_t ret = zend_safe_address(nmemb, size, offset, &overflow);
if (UNEXPECTED(overflow)) {
zend_error_noreturn(E_ERROR, "Possible integer overflow in memory allocation (%zu * %zu + %zu)", nmemb, size, offset);
return 0;
}
return ret;
}
ZEND_API void* ZEND_FASTCALL _safe_emalloc(size_t nmemb, size_t size, size_t offset ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
{
return emalloc_rel(safe_address(nmemb, size, offset));
return emalloc_rel(zend_safe_address_guarded(nmemb, size, offset));
}
ZEND_API void* ZEND_FASTCALL _safe_malloc(size_t nmemb, size_t size, size_t offset)
{
return pemalloc(safe_address(nmemb, size, offset), 1);
return pemalloc(zend_safe_address_guarded(nmemb, size, offset), 1);
}
ZEND_API void* ZEND_FASTCALL _safe_erealloc(void *ptr, size_t nmemb, size_t size, size_t offset ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
{
return erealloc_rel(ptr, safe_address(nmemb, size, offset));
return erealloc_rel(ptr, zend_safe_address_guarded(nmemb, size, offset));
}
ZEND_API void* ZEND_FASTCALL _safe_realloc(void *ptr, size_t nmemb, size_t size, size_t offset)
{
return perealloc(ptr, safe_address(nmemb, size, offset), 1);
return perealloc(ptr, zend_safe_address_guarded(nmemb, size, offset), 1);
}
+9 -1
View File
@@ -181,7 +181,11 @@ static int zend_ast_add_array_element(zval *result, zval *offset, zval *expr)
{
switch (Z_TYPE_P(offset)) {
case IS_UNDEF:
zend_hash_next_index_insert(Z_ARRVAL_P(result), expr);
if (!zend_hash_next_index_insert(Z_ARRVAL_P(result), expr)) {
zend_error(E_WARNING,
"Cannot add element to the array as the next element is already occupied");
zval_ptr_dtor(expr);
}
break;
case IS_STRING:
zend_symtable_update(Z_ARRVAL_P(result), Z_STR_P(offset), expr);
@@ -202,6 +206,10 @@ static int zend_ast_add_array_element(zval *result, zval *offset, zval *expr)
case IS_DOUBLE:
zend_hash_index_update(Z_ARRVAL_P(result), zend_dval_to_lval(Z_DVAL_P(offset)), expr);
break;
case IS_RESOURCE:
zend_error(E_NOTICE, "Resource ID#%d used as offset, casting to integer (%d)", Z_RES_HANDLE_P(offset), Z_RES_HANDLE_P(offset));
zend_hash_index_update(Z_ARRVAL_P(result), Z_RES_HANDLE_P(offset), expr);
break;
default:
zend_throw_error(NULL, "Illegal offset type");
return FAILURE;
+42 -35
View File
@@ -5499,6 +5499,41 @@ static void zend_check_already_in_use(uint32_t type, zend_string *old_name, zend
}
/* }}} */
static void zend_check_use_conflict(
uint32_t type, zend_string *old_name, zend_string *new_name, zend_string *lookup_name) {
switch (type) {
case T_CLASS:
{
zend_class_entry *ce = zend_hash_find_ptr(CG(class_table), lookup_name);
if (ce && ce->type == ZEND_USER_CLASS
&& ce->info.user.filename == CG(compiled_filename)
) {
zend_check_already_in_use(type, old_name, new_name, lookup_name);
}
break;
}
case T_FUNCTION:
{
zend_function *fn = zend_hash_find_ptr(CG(function_table), lookup_name);
if (fn && fn->type == ZEND_USER_FUNCTION
&& fn->op_array.filename == CG(compiled_filename)
) {
zend_check_already_in_use(type, old_name, new_name, lookup_name);
}
break;
}
case T_CONST:
{
zend_string *filename = zend_hash_find_ptr(&CG(const_filenames), lookup_name);
if (filename && filename == CG(compiled_filename)) {
zend_check_already_in_use(type, old_name, new_name, lookup_name);
}
break;
}
EMPTY_SWITCH_DEFAULT_CASE()
}
}
void zend_compile_use(zend_ast *ast) /* {{{ */
{
zend_ast_list *list = zend_ast_get_list(ast);
@@ -5555,43 +5590,11 @@ void zend_compile_use(zend_ast *ast) /* {{{ */
ZSTR_VAL(ns_name)[ZSTR_LEN(current_ns)] = '\\';
memcpy(ZSTR_VAL(ns_name) + ZSTR_LEN(current_ns) + 1, ZSTR_VAL(lookup_name), ZSTR_LEN(lookup_name));
if (zend_hash_exists(CG(class_table), ns_name)) {
zend_check_already_in_use(type, old_name, new_name, ns_name);
}
zend_check_use_conflict(type, old_name, new_name, ns_name);
zend_string_free(ns_name);
} else {
switch (type) {
case T_CLASS:
{
zend_class_entry *ce = zend_hash_find_ptr(CG(class_table), lookup_name);
if (ce && ce->type == ZEND_USER_CLASS
&& ce->info.user.filename == CG(compiled_filename)
) {
zend_check_already_in_use(type, old_name, new_name, lookup_name);
}
break;
}
case T_FUNCTION:
{
zend_function *fn = zend_hash_find_ptr(CG(function_table), lookup_name);
if (fn && fn->type == ZEND_USER_FUNCTION
&& fn->op_array.filename == CG(compiled_filename)
) {
zend_check_already_in_use(type, old_name, new_name, lookup_name);
}
break;
}
case T_CONST:
{
zend_string *filename = zend_hash_find_ptr(&CG(const_filenames), lookup_name);
if (filename && filename == CG(compiled_filename)) {
zend_check_already_in_use(type, old_name, new_name, lookup_name);
}
break;
}
EMPTY_SWITCH_DEFAULT_CASE()
}
zend_check_use_conflict(type, old_name, new_name, lookup_name);
}
zend_string_addref(old_name);
@@ -5950,7 +5953,11 @@ static zend_bool zend_try_ct_eval_array(zval *result, zend_ast *ast) /* {{{ */
break;
}
} else {
zend_hash_next_index_insert(Z_ARRVAL_P(result), value);
if (!zend_hash_next_index_insert(Z_ARRVAL_P(result), value)) {
zval_ptr_dtor_nogc(value);
zval_ptr_dtor(result);
return 0;
}
}
}
+22 -5
View File
@@ -293,10 +293,7 @@ ZEND_METHOD(exception, __construct)
#define CHECK_EXC_TYPE(name, type) \
pvalue = zend_read_property(i_get_exception_base(object), (object), name, sizeof(name) - 1, 1, &value); \
if (Z_TYPE_P(pvalue) != IS_NULL && Z_TYPE_P(pvalue) != type) { \
zval tmp; \
ZVAL_STRINGL(&tmp, name, sizeof(name) - 1); \
Z_OBJ_HANDLER_P(object, unset_property)(object, &tmp, NULL); \
zval_ptr_dtor(&tmp); \
zend_unset_property(i_get_exception_base(object), object, name, sizeof(name)-1); \
}
ZEND_METHOD(exception, __wakeup)
@@ -309,7 +306,12 @@ ZEND_METHOD(exception, __wakeup)
CHECK_EXC_TYPE("file", IS_STRING);
CHECK_EXC_TYPE("line", IS_LONG);
CHECK_EXC_TYPE("trace", IS_ARRAY);
CHECK_EXC_TYPE("previous", IS_OBJECT);
pvalue = zend_read_property(i_get_exception_base(object), object, "previous", sizeof("previous")-1, 1, &value);
if (pvalue && Z_TYPE_P(pvalue) != IS_NULL && (Z_TYPE_P(pvalue) != IS_OBJECT ||
!instanceof_function(Z_OBJCE_P(pvalue), i_get_exception_base(object)) ||
pvalue == object)) {
zend_unset_property(i_get_exception_base(object), object, "previous", sizeof("previous")-1);
}
}
/* }}} */
@@ -771,10 +773,25 @@ ZEND_METHOD(exception, __toString)
zend_string_release(file);
zval_ptr_dtor(&trace);
Z_OBJPROP_P(exception)->u.v.nApplyCount++;
exception = GET_PROPERTY(exception, "previous");
if (exception && Z_TYPE_P(exception) == IS_OBJECT && Z_OBJPROP_P(exception)->u.v.nApplyCount > 0) {
break;
}
}
zval_dtor(&fname);
exception = getThis();
/* Reset apply counts */
while (exception && Z_TYPE_P(exception) == IS_OBJECT && (base_ce = i_get_exception_base(exception)) && instanceof_function(Z_OBJCE_P(exception), base_ce)) {
if (Z_OBJPROP_P(exception)->u.v.nApplyCount) {
Z_OBJPROP_P(exception)->u.v.nApplyCount--;
} else {
break;
}
exception = GET_PROPERTY(exception, "previous");
}
exception = getThis();
base_ce = i_get_exception_base(exception);
+11 -3
View File
@@ -576,7 +576,6 @@ static inline zval *_get_obj_zval_ptr_ptr(int op_type, znode_op node, zend_execu
static inline void zend_assign_to_variable_reference(zval *variable_ptr, zval *value_ptr)
{
zend_reference *ref;
zval garbage;
if (EXPECTED(!Z_ISREF_P(value_ptr))) {
ZVAL_NEW_REF(value_ptr, value_ptr);
@@ -586,9 +585,18 @@ static inline void zend_assign_to_variable_reference(zval *variable_ptr, zval *v
ref = Z_REF_P(value_ptr);
GC_REFCOUNT(ref)++;
ZVAL_COPY_VALUE(&garbage, variable_ptr);
if (Z_REFCOUNTED_P(variable_ptr)) {
zend_refcounted *garbage = Z_COUNTED_P(variable_ptr);
if (--GC_REFCOUNT(garbage) == 0) {
ZVAL_REF(variable_ptr, ref);
zval_dtor_func_for_ptr(garbage);
return;
} else {
GC_ZVAL_CHECK_POSSIBLE_ROOT(variable_ptr);
}
}
ZVAL_REF(variable_ptr, ref);
zval_ptr_dtor(&garbage);
}
/* this should modify object only if it's empty */
+3
View File
@@ -852,8 +852,11 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache) /
EG(scope) = func->common.scope;
call->symbol_table = fci->symbol_table;
if (EXPECTED((func->op_array.fn_flags & ZEND_ACC_GENERATOR) == 0)) {
const zend_op *current_opline_before_exception = EG(opline_before_exception);
zend_init_execute_data(call, &func->op_array, fci->retval);
zend_execute_ex(call);
EG(opline_before_exception) = current_opline_before_exception;
} else {
zend_generator_create_zval(call, &func->op_array, fci->retval);
}
+6 -2
View File
@@ -1447,13 +1447,17 @@ ZEND_API void ZEND_FASTCALL zend_symtable_clean(HashTable *ht)
} else if (ht->nNumUsed == ht->nNumOfElements) {
do {
i_zval_ptr_dtor(&p->val ZEND_FILE_LINE_CC);
zend_string_release(p->key);
if (EXPECTED(p->key)) {
zend_string_release(p->key);
}
} while (++p != end);
} else {
do {
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF)) {
i_zval_ptr_dtor(&p->val ZEND_FILE_LINE_CC);
zend_string_release(p->key);
if (EXPECTED(p->key)) {
zend_string_release(p->key);
}
}
} while (++p != end);
}
+5310 -5142
View File
File diff suppressed because it is too large. Load diff
+6 -2
View File
@@ -589,6 +589,7 @@ ZEND_API zend_op_array *compile_file(zend_file_handle *file_handle, int type)
CG(ast) = NULL;
CG(ast_arena) = zend_arena_create(1024 * 32);
if (!zendparse()) {
int last_lineno = CG(zend_lineno);
zval retval_zv;
zend_file_context original_file_context;
zend_oparray_context original_oparray_context;
@@ -605,9 +606,10 @@ ZEND_API zend_op_array *compile_file(zend_file_handle *file_handle, int type)
zend_file_context_begin(&original_file_context);
zend_oparray_context_begin(&original_oparray_context);
zend_compile_top_stmt(CG(ast));
CG(zend_lineno) = last_lineno;
zend_emit_final_return(&retval_zv);
op_array->line_start = 1;
op_array->line_end = CG(zend_lineno);
op_array->line_end = last_lineno;
pass_two(op_array);
zend_oparray_context_end(&original_oparray_context);
zend_file_context_end(&original_file_context);
@@ -756,6 +758,7 @@ zend_op_array *compile_string(zval *source_string, char *filename)
BEGIN(ST_IN_SCRIPTING);
if (!zendparse()) {
int last_lineno = CG(zend_lineno);
zend_file_context original_file_context;
zend_oparray_context original_oparray_context;
zend_op_array *original_active_op_array = CG(active_op_array);
@@ -770,9 +773,10 @@ zend_op_array *compile_string(zval *source_string, char *filename)
zend_file_context_begin(&original_file_context);
zend_oparray_context_begin(&original_oparray_context);
zend_compile_top_stmt(CG(ast));
CG(zend_lineno) = last_lineno;
zend_emit_final_return(NULL);
op_array->line_start = 1;
op_array->line_end = CG(zend_lineno);
op_array->line_end = last_lineno;
pass_two(op_array);
zend_oparray_context_end(&original_oparray_context);
zend_file_context_end(&original_file_context);
+1 -1
View File
@@ -1,4 +1,4 @@
/* Generated by re2c 0.13.5 */
/* Generated by re2c 0.16 */
#line 3 "Zend/zend_language_scanner_defs.h"
enum YYCONDTYPE {
+12
View File
@@ -266,6 +266,18 @@ static zend_always_inline size_t zend_safe_address(size_t nmemb, size_t size, si
}
#endif
static zend_always_inline size_t zend_safe_address_guarded(size_t nmemb, size_t size, size_t offset)
{
int overflow;
size_t ret = zend_safe_address(nmemb, size, offset, &overflow);
if (UNEXPECTED(overflow)) {
zend_error_noreturn(E_ERROR, "Possible integer overflow in memory allocation (%zu * %zu + %zu)", nmemb, size, offset);
return 0;
}
return ret;
}
#endif /* ZEND_MULTIPLY_H */
/*
+4
View File
@@ -68,6 +68,10 @@ typedef unsigned long int uint32_t;
#undef USE_LOCALE
#endif
#ifndef NO_INFNAN_CHECK
#define NO_INFNAN_CHECK
#endif
#ifdef WORDS_BIGENDIAN
#define IEEE_BIG_ENDIAN 1
#else
+53 -22
View File
@@ -3012,15 +3012,19 @@ ZEND_VM_HANDLER(112, ZEND_INIT_METHOD_CALL, CONST|TMPVAR|UNUSED|CV, CONST|TMPVAR
GC_REFCOUNT(obj)++; /* For $this pointer */
}
FREE_OP2();
FREE_OP1();
if ((OP1_TYPE & (IS_VAR|IS_TMP_VAR)) && UNEXPECTED(EG(exception))) {
HANDLE_EXCEPTION();
}
call = zend_vm_stack_push_call_frame(call_info,
fbc, opline->extended_value, called_scope, obj);
call->prev_execute_data = EX(call);
EX(call) = call;
FREE_OP2();
FREE_OP1();
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, CONST|VAR, CONST|TMPVAR|UNUSED|CV)
@@ -3161,7 +3165,7 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, CONST|VAR, CONST|TMPVAR|UNUSE
call->prev_execute_data = EX(call);
EX(call) = call;
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST)
@@ -3283,7 +3287,6 @@ ZEND_VM_C_LABEL(try_function_name):
called_scope = NULL;
object = NULL;
}
FREE_OP2();
} else if (OP2_TYPE != IS_CONST &&
EXPECTED(Z_TYPE_P(function_name) == IS_OBJECT) &&
Z_OBJ_HANDLER_P(function_name, get_closure) &&
@@ -3297,7 +3300,6 @@ ZEND_VM_C_LABEL(try_function_name):
call_info |= ZEND_CALL_RELEASE_THIS;
GC_REFCOUNT(object)++; /* For $this pointer */
}
FREE_OP2();
} else if (EXPECTED(Z_TYPE_P(function_name) == IS_ARRAY) &&
zend_hash_num_elements(Z_ARRVAL_P(function_name)) == 2) {
zval *obj;
@@ -3381,7 +3383,6 @@ ZEND_VM_C_LABEL(try_function_name):
GC_REFCOUNT(object)++; /* For $this pointer */
}
}
FREE_OP2();
} else if ((OP2_TYPE & (IS_VAR|IS_CV)) && Z_TYPE_P(function_name) == IS_REFERENCE) {
function_name = Z_REFVAL_P(function_name);
ZEND_VM_C_GOTO(try_function_name);
@@ -3396,6 +3397,18 @@ ZEND_VM_C_LABEL(try_function_name):
FREE_OP2();
HANDLE_EXCEPTION();
}
FREE_OP2();
if ((OP2_TYPE & (IS_VAR|IS_TMP_VAR)) && UNEXPECTED(EG(exception))) {
if (call_info & ZEND_CALL_RELEASE_THIS) {
zend_object_release(object);
}
if (fbc->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE) {
zend_string_release(fbc->common.function_name);
zend_free_trampoline(fbc);
}
HANDLE_EXCEPTION();
}
call = zend_vm_stack_push_call_frame(call_info,
fbc, opline->extended_value, called_scope, object);
call->prev_execute_data = EX(call);
@@ -3421,6 +3434,19 @@ ZEND_VM_HANDLER(118, ZEND_INIT_USER_CALL, CONST, CONST|TMPVAR|CV)
function_name = GET_OP2_ZVAL_PTR(BP_VAR_R);
if (zend_is_callable_ex(function_name, NULL, 0, NULL, &fcc, &error)) {
func = fcc.function_handler;
called_scope = fcc.called_scope;
object = fcc.object;
if (error) {
efree(error);
/* This is the only soft error is_callable() can generate */
zend_error(E_DEPRECATED,
"Non-static method %s::%s() should not be called statically",
ZSTR_VAL(func->common.scope->name), ZSTR_VAL(func->common.function_name));
if (UNEXPECTED(EG(exception) != NULL)) {
FREE_OP2();
HANDLE_EXCEPTION();
}
}
if (func->common.fn_flags & ZEND_ACC_CLOSURE) {
/* Delay closure destruction until its invocation */
if (OP2_TYPE & (IS_VAR|IS_CV)) {
@@ -3430,25 +3456,28 @@ ZEND_VM_HANDLER(118, ZEND_INIT_USER_CALL, CONST, CONST|TMPVAR|CV)
GC_REFCOUNT((zend_object*)func->common.prototype)++;
call_info |= ZEND_CALL_CLOSURE;
}
called_scope = fcc.called_scope;
object = fcc.object;
if (object) {
call_info |= ZEND_CALL_RELEASE_THIS;
GC_REFCOUNT(object)++; /* For $this pointer */
}
if (error) {
efree(error);
/* This is the only soft error is_callable() can generate */
zend_error(E_DEPRECATED,
"Non-static method %s::%s() should not be called statically",
ZSTR_VAL(func->common.scope->name), ZSTR_VAL(func->common.function_name));
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
FREE_OP2();
if ((OP2_TYPE & (IS_TMP_VAR|IS_VAR)) && UNEXPECTED(EG(exception))) {
if (call_info & ZEND_CALL_CLOSURE) {
zend_object_release((zend_object*)func->common.prototype);
}
if (call_info & ZEND_CALL_RELEASE_THIS) {
zend_object_release(object);
}
HANDLE_EXCEPTION();
}
} else {
zend_internal_type_error(EX_USES_STRICT_TYPES(), "%s() expects parameter 1 to be a valid callback, %s", Z_STRVAL_P(EX_CONSTANT(opline->op1)), error);
efree(error);
FREE_OP2();
if (UNEXPECTED(EG(exception))) {
HANDLE_EXCEPTION();
}
func = (zend_function*)&zend_pass_function;
called_scope = NULL;
object = NULL;
@@ -3459,8 +3488,7 @@ ZEND_VM_HANDLER(118, ZEND_INIT_USER_CALL, CONST, CONST|TMPVAR|CV)
call->prev_execute_data = EX(call);
EX(call) = call;
FREE_OP2();
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
ZEND_VM_HANDLER(69, ZEND_INIT_NS_FCALL_BY_NAME, ANY, CONST)
@@ -4946,7 +4974,7 @@ ZEND_VM_HANDLER(68, ZEND_NEW, CONST|VAR, ANY)
ZVAL_COPY(EX_VAR(opline->result.var), &object_zval);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
}
@@ -5232,7 +5260,10 @@ ZEND_VM_C_LABEL(num_index):
}
FREE_OP2();
} else {
zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr);
if (!zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr)) {
zend_error(E_WARNING, "Cannot add element to the array as the next element is already occupied");
zval_ptr_dtor(expr_ptr);
}
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
+266 -100
View File
@@ -1995,7 +1995,6 @@ try_function_name:
called_scope = NULL;
object = NULL;
}
} else if (IS_CONST != IS_CONST &&
EXPECTED(Z_TYPE_P(function_name) == IS_OBJECT) &&
Z_OBJ_HANDLER_P(function_name, get_closure) &&
@@ -2009,7 +2008,6 @@ try_function_name:
call_info |= ZEND_CALL_RELEASE_THIS;
GC_REFCOUNT(object)++; /* For $this pointer */
}
} else if (EXPECTED(Z_TYPE_P(function_name) == IS_ARRAY) &&
zend_hash_num_elements(Z_ARRVAL_P(function_name)) == 2) {
zval *obj;
@@ -2093,7 +2091,6 @@ try_function_name:
GC_REFCOUNT(object)++; /* For $this pointer */
}
}
} else if ((IS_CONST & (IS_VAR|IS_CV)) && Z_TYPE_P(function_name) == IS_REFERENCE) {
function_name = Z_REFVAL_P(function_name);
goto try_function_name;
@@ -2108,6 +2105,17 @@ try_function_name:
HANDLE_EXCEPTION();
}
if ((IS_CONST & (IS_VAR|IS_TMP_VAR)) && UNEXPECTED(EG(exception))) {
if (call_info & ZEND_CALL_RELEASE_THIS) {
zend_object_release(object);
}
if (fbc->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE) {
zend_string_release(fbc->common.function_name);
zend_free_trampoline(fbc);
}
HANDLE_EXCEPTION();
}
call = zend_vm_stack_push_call_frame(call_info,
fbc, opline->extended_value, called_scope, object);
call->prev_execute_data = EX(call);
@@ -2418,7 +2426,6 @@ try_function_name:
called_scope = NULL;
object = NULL;
}
} else if (IS_CV != IS_CONST &&
EXPECTED(Z_TYPE_P(function_name) == IS_OBJECT) &&
Z_OBJ_HANDLER_P(function_name, get_closure) &&
@@ -2432,7 +2439,6 @@ try_function_name:
call_info |= ZEND_CALL_RELEASE_THIS;
GC_REFCOUNT(object)++; /* For $this pointer */
}
} else if (EXPECTED(Z_TYPE_P(function_name) == IS_ARRAY) &&
zend_hash_num_elements(Z_ARRVAL_P(function_name)) == 2) {
zval *obj;
@@ -2516,7 +2522,6 @@ try_function_name:
GC_REFCOUNT(object)++; /* For $this pointer */
}
}
} else if ((IS_CV & (IS_VAR|IS_CV)) && Z_TYPE_P(function_name) == IS_REFERENCE) {
function_name = Z_REFVAL_P(function_name);
goto try_function_name;
@@ -2531,6 +2536,17 @@ try_function_name:
HANDLE_EXCEPTION();
}
if ((IS_CV & (IS_VAR|IS_TMP_VAR)) && UNEXPECTED(EG(exception))) {
if (call_info & ZEND_CALL_RELEASE_THIS) {
zend_object_release(object);
}
if (fbc->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE) {
zend_string_release(fbc->common.function_name);
zend_free_trampoline(fbc);
}
HANDLE_EXCEPTION();
}
call = zend_vm_stack_push_call_frame(call_info,
fbc, opline->extended_value, called_scope, object);
call->prev_execute_data = EX(call);
@@ -2674,7 +2690,6 @@ try_function_name:
called_scope = NULL;
object = NULL;
}
zval_ptr_dtor_nogc(free_op2);
} else if ((IS_TMP_VAR|IS_VAR) != IS_CONST &&
EXPECTED(Z_TYPE_P(function_name) == IS_OBJECT) &&
Z_OBJ_HANDLER_P(function_name, get_closure) &&
@@ -2688,7 +2703,6 @@ try_function_name:
call_info |= ZEND_CALL_RELEASE_THIS;
GC_REFCOUNT(object)++; /* For $this pointer */
}
zval_ptr_dtor_nogc(free_op2);
} else if (EXPECTED(Z_TYPE_P(function_name) == IS_ARRAY) &&
zend_hash_num_elements(Z_ARRVAL_P(function_name)) == 2) {
zval *obj;
@@ -2772,7 +2786,6 @@ try_function_name:
GC_REFCOUNT(object)++; /* For $this pointer */
}
}
zval_ptr_dtor_nogc(free_op2);
} else if (((IS_TMP_VAR|IS_VAR) & (IS_VAR|IS_CV)) && Z_TYPE_P(function_name) == IS_REFERENCE) {
function_name = Z_REFVAL_P(function_name);
goto try_function_name;
@@ -2787,6 +2800,18 @@ try_function_name:
zval_ptr_dtor_nogc(free_op2);
HANDLE_EXCEPTION();
}
zval_ptr_dtor_nogc(free_op2);
if (((IS_TMP_VAR|IS_VAR) & (IS_VAR|IS_TMP_VAR)) && UNEXPECTED(EG(exception))) {
if (call_info & ZEND_CALL_RELEASE_THIS) {
zend_object_release(object);
}
if (fbc->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE) {
zend_string_release(fbc->common.function_name);
zend_free_trampoline(fbc);
}
HANDLE_EXCEPTION();
}
call = zend_vm_stack_push_call_frame(call_info,
fbc, opline->extended_value, called_scope, object);
call->prev_execute_data = EX(call);
@@ -3367,7 +3392,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_NEW_SPEC_CONST_HANDLER(ZEND_OP
ZVAL_COPY(EX_VAR(opline->result.var), &object_zval);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
}
@@ -5594,13 +5619,17 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CONST_CO
GC_REFCOUNT(obj)++; /* For $this pointer */
}
if ((IS_CONST & (IS_VAR|IS_TMP_VAR)) && UNEXPECTED(EG(exception))) {
HANDLE_EXCEPTION();
}
call = zend_vm_stack_push_call_frame(call_info,
fbc, opline->extended_value, called_scope, obj);
call->prev_execute_data = EX(call);
EX(call) = call;
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -5741,7 +5770,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C
call->prev_execute_data = EX(call);
EX(call) = call;
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -5761,6 +5790,19 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_CONS
function_name = EX_CONSTANT(opline->op2);
if (zend_is_callable_ex(function_name, NULL, 0, NULL, &fcc, &error)) {
func = fcc.function_handler;
called_scope = fcc.called_scope;
object = fcc.object;
if (error) {
efree(error);
/* This is the only soft error is_callable() can generate */
zend_error(E_DEPRECATED,
"Non-static method %s::%s() should not be called statically",
ZSTR_VAL(func->common.scope->name), ZSTR_VAL(func->common.function_name));
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
}
if (func->common.fn_flags & ZEND_ACC_CLOSURE) {
/* Delay closure destruction until its invocation */
if (IS_CONST & (IS_VAR|IS_CV)) {
@@ -5770,25 +5812,27 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_CONS
GC_REFCOUNT((zend_object*)func->common.prototype)++;
call_info |= ZEND_CALL_CLOSURE;
}
called_scope = fcc.called_scope;
object = fcc.object;
if (object) {
call_info |= ZEND_CALL_RELEASE_THIS;
GC_REFCOUNT(object)++; /* For $this pointer */
}
if (error) {
efree(error);
/* This is the only soft error is_callable() can generate */
zend_error(E_DEPRECATED,
"Non-static method %s::%s() should not be called statically",
ZSTR_VAL(func->common.scope->name), ZSTR_VAL(func->common.function_name));
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
if ((IS_CONST & (IS_TMP_VAR|IS_VAR)) && UNEXPECTED(EG(exception))) {
if (call_info & ZEND_CALL_CLOSURE) {
zend_object_release((zend_object*)func->common.prototype);
}
if (call_info & ZEND_CALL_RELEASE_THIS) {
zend_object_release(object);
}
HANDLE_EXCEPTION();
}
} else {
zend_internal_type_error(EX_USES_STRICT_TYPES(), "%s() expects parameter 1 to be a valid callback, %s", Z_STRVAL_P(EX_CONSTANT(opline->op1)), error);
efree(error);
if (UNEXPECTED(EG(exception))) {
HANDLE_EXCEPTION();
}
func = (zend_function*)&zend_pass_function;
called_scope = NULL;
object = NULL;
@@ -5799,7 +5843,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_CONS
call->prev_execute_data = EX(call);
EX(call) = call;
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CASE_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -6077,7 +6121,10 @@ num_index:
}
} else {
zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr);
if (!zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr)) {
zend_error(E_WARNING, "Cannot add element to the array as the next element is already occupied");
zval_ptr_dtor(expr_ptr);
}
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -7737,7 +7784,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C
call->prev_execute_data = EX(call);
EX(call) = call;
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_VERIFY_RETURN_TYPE_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -7891,7 +7938,10 @@ num_index:
}
} else {
zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr);
if (!zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr)) {
zend_error(E_WARNING, "Cannot add element to the array as the next element is already occupied");
zval_ptr_dtor(expr_ptr);
}
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -9340,13 +9390,17 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CONST_CV
GC_REFCOUNT(obj)++; /* For $this pointer */
}
if ((IS_CONST & (IS_VAR|IS_TMP_VAR)) && UNEXPECTED(EG(exception))) {
HANDLE_EXCEPTION();
}
call = zend_vm_stack_push_call_frame(call_info,
fbc, opline->extended_value, called_scope, obj);
call->prev_execute_data = EX(call);
EX(call) = call;
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -9487,7 +9541,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C
call->prev_execute_data = EX(call);
EX(call) = call;
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -9507,6 +9561,19 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_CV_H
function_name = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var);
if (zend_is_callable_ex(function_name, NULL, 0, NULL, &fcc, &error)) {
func = fcc.function_handler;
called_scope = fcc.called_scope;
object = fcc.object;
if (error) {
efree(error);
/* This is the only soft error is_callable() can generate */
zend_error(E_DEPRECATED,
"Non-static method %s::%s() should not be called statically",
ZSTR_VAL(func->common.scope->name), ZSTR_VAL(func->common.function_name));
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
}
}
if (func->common.fn_flags & ZEND_ACC_CLOSURE) {
/* Delay closure destruction until its invocation */
if (IS_CV & (IS_VAR|IS_CV)) {
@@ -9516,25 +9583,27 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_CV_H
GC_REFCOUNT((zend_object*)func->common.prototype)++;
call_info |= ZEND_CALL_CLOSURE;
}
called_scope = fcc.called_scope;
object = fcc.object;
if (object) {
call_info |= ZEND_CALL_RELEASE_THIS;
GC_REFCOUNT(object)++; /* For $this pointer */
}
if (error) {
efree(error);
/* This is the only soft error is_callable() can generate */
zend_error(E_DEPRECATED,
"Non-static method %s::%s() should not be called statically",
ZSTR_VAL(func->common.scope->name), ZSTR_VAL(func->common.function_name));
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
if ((IS_CV & (IS_TMP_VAR|IS_VAR)) && UNEXPECTED(EG(exception))) {
if (call_info & ZEND_CALL_CLOSURE) {
zend_object_release((zend_object*)func->common.prototype);
}
if (call_info & ZEND_CALL_RELEASE_THIS) {
zend_object_release(object);
}
HANDLE_EXCEPTION();
}
} else {
zend_internal_type_error(EX_USES_STRICT_TYPES(), "%s() expects parameter 1 to be a valid callback, %s", Z_STRVAL_P(EX_CONSTANT(opline->op1)), error);
efree(error);
if (UNEXPECTED(EG(exception))) {
HANDLE_EXCEPTION();
}
func = (zend_function*)&zend_pass_function;
called_scope = NULL;
object = NULL;
@@ -9545,7 +9614,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_CV_H
call->prev_execute_data = EX(call);
EX(call) = call;
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CATCH_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -9771,7 +9840,10 @@ num_index:
}
} else {
zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr);
if (!zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr)) {
zend_error(E_WARNING, "Cannot add element to the array as the next element is already occupied");
zval_ptr_dtor(expr_ptr);
}
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -11167,14 +11239,18 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CONST_TM
GC_REFCOUNT(obj)++; /* For $this pointer */
}
zval_ptr_dtor_nogc(free_op2);
if ((IS_CONST & (IS_VAR|IS_TMP_VAR)) && UNEXPECTED(EG(exception))) {
HANDLE_EXCEPTION();
}
call = zend_vm_stack_push_call_frame(call_info,
fbc, opline->extended_value, called_scope, obj);
call->prev_execute_data = EX(call);
EX(call) = call;
zval_ptr_dtor_nogc(free_op2);
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -11315,7 +11391,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C
call->prev_execute_data = EX(call);
EX(call) = call;
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -11335,6 +11411,19 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_TMPV
function_name = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2);
if (zend_is_callable_ex(function_name, NULL, 0, NULL, &fcc, &error)) {
func = fcc.function_handler;
called_scope = fcc.called_scope;
object = fcc.object;
if (error) {
efree(error);
/* This is the only soft error is_callable() can generate */
zend_error(E_DEPRECATED,
"Non-static method %s::%s() should not be called statically",
ZSTR_VAL(func->common.scope->name), ZSTR_VAL(func->common.function_name));
if (UNEXPECTED(EG(exception) != NULL)) {
zval_ptr_dtor_nogc(free_op2);
HANDLE_EXCEPTION();
}
}
if (func->common.fn_flags & ZEND_ACC_CLOSURE) {
/* Delay closure destruction until its invocation */
if ((IS_TMP_VAR|IS_VAR) & (IS_VAR|IS_CV)) {
@@ -11344,25 +11433,28 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_TMPV
GC_REFCOUNT((zend_object*)func->common.prototype)++;
call_info |= ZEND_CALL_CLOSURE;
}
called_scope = fcc.called_scope;
object = fcc.object;
if (object) {
call_info |= ZEND_CALL_RELEASE_THIS;
GC_REFCOUNT(object)++; /* For $this pointer */
}
if (error) {
efree(error);
/* This is the only soft error is_callable() can generate */
zend_error(E_DEPRECATED,
"Non-static method %s::%s() should not be called statically",
ZSTR_VAL(func->common.scope->name), ZSTR_VAL(func->common.function_name));
if (UNEXPECTED(EG(exception) != NULL)) {
HANDLE_EXCEPTION();
zval_ptr_dtor_nogc(free_op2);
if (((IS_TMP_VAR|IS_VAR) & (IS_TMP_VAR|IS_VAR)) && UNEXPECTED(EG(exception))) {
if (call_info & ZEND_CALL_CLOSURE) {
zend_object_release((zend_object*)func->common.prototype);
}
if (call_info & ZEND_CALL_RELEASE_THIS) {
zend_object_release(object);
}
HANDLE_EXCEPTION();
}
} else {
zend_internal_type_error(EX_USES_STRICT_TYPES(), "%s() expects parameter 1 to be a valid callback, %s", Z_STRVAL_P(EX_CONSTANT(opline->op1)), error);
efree(error);
zval_ptr_dtor_nogc(free_op2);
if (UNEXPECTED(EG(exception))) {
HANDLE_EXCEPTION();
}
func = (zend_function*)&zend_pass_function;
called_scope = NULL;
object = NULL;
@@ -11373,8 +11465,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_TMPV
call->prev_execute_data = EX(call);
EX(call) = call;
zval_ptr_dtor_nogc(free_op2);
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CASE_SPEC_CONST_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -11545,7 +11636,10 @@ num_index:
}
zval_ptr_dtor_nogc(free_op2);
} else {
zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr);
if (!zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr)) {
zend_error(E_WARNING, "Cannot add element to the array as the next element is already occupied");
zval_ptr_dtor(expr_ptr);
}
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -13014,7 +13108,10 @@ num_index:
}
} else {
zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr);
if (!zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr)) {
zend_error(E_WARNING, "Cannot add element to the array as the next element is already occupied");
zval_ptr_dtor(expr_ptr);
}
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -13738,7 +13835,10 @@ num_index:
}
} else {
zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr);
if (!zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr)) {
zend_error(E_WARNING, "Cannot add element to the array as the next element is already occupied");
zval_ptr_dtor(expr_ptr);
}
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -14287,7 +14387,10 @@ num_index:
}
} else {
zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr);
if (!zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr)) {
zend_error(E_WARNING, "Cannot add element to the array as the next element is already occupied");
zval_ptr_dtor(expr_ptr);
}
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -14801,7 +14904,10 @@ num_index:
}
zval_ptr_dtor_nogc(free_op2);
} else {
zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr);
if (!zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr)) {
zend_error(E_WARNING, "Cannot add element to the array as the next element is already occupied");
zval_ptr_dtor(expr_ptr);
}
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -15458,7 +15564,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_NEW_SPEC_VAR_HANDLER(ZEND_OPCO
ZVAL_COPY(EX_VAR(opline->result.var), &object_zval);
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
}
@@ -17702,7 +17808,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V
call->prev_execute_data = EX(call);
EX(call) = call;
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -17906,7 +18012,10 @@ num_index:
}
} else {
zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr);
if (!zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr)) {
zend_error(E_WARNING, "Cannot add element to the array as the next element is already occupied");
zval_ptr_dtor(expr_ptr);
}
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -19338,7 +19447,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V
call->prev_execute_data = EX(call);
EX(call) = call;
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_VERIFY_RETURN_TYPE_SPEC_VAR_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -19492,7 +19601,10 @@ num_index:
}
} else {
zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr);
if (!zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr)) {
zend_error(E_WARNING, "Cannot add element to the array as the next element is already occupied");
zval_ptr_dtor(expr_ptr);
}
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -20980,7 +21092,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V
call->prev_execute_data = EX(call);
EX(call) = call;
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -21077,7 +21189,10 @@ num_index:
}
} else {
zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr);
if (!zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr)) {
zend_error(E_WARNING, "Cannot add element to the array as the next element is already occupied");
zval_ptr_dtor(expr_ptr);
}
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -22569,7 +22684,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V
call->prev_execute_data = EX(call);
EX(call) = call;
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_VAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -22666,7 +22781,10 @@ num_index:
}
zval_ptr_dtor_nogc(free_op2);
} else {
zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr);
if (!zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr)) {
zend_error(E_WARNING, "Cannot add element to the array as the next element is already occupied");
zval_ptr_dtor(expr_ptr);
}
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -23949,13 +24067,17 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_C
GC_REFCOUNT(obj)++; /* For $this pointer */
}
if ((IS_UNUSED & (IS_VAR|IS_TMP_VAR)) && UNEXPECTED(EG(exception))) {
HANDLE_EXCEPTION();
}
call = zend_vm_stack_push_call_frame(call_info,
fbc, opline->extended_value, called_scope, obj);
call->prev_execute_data = EX(call);
EX(call) = call;
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_CONSTANT_SPEC_UNUSED_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -26376,13 +26498,17 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_C
GC_REFCOUNT(obj)++; /* For $this pointer */
}
if ((IS_UNUSED & (IS_VAR|IS_TMP_VAR)) && UNEXPECTED(EG(exception))) {
HANDLE_EXCEPTION();
}
call = zend_vm_stack_push_call_frame(call_info,
fbc, opline->extended_value, called_scope, obj);
call->prev_execute_data = EX(call);
EX(call) = call;
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_UNUSED_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -27880,14 +28006,18 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_T
GC_REFCOUNT(obj)++; /* For $this pointer */
}
zval_ptr_dtor_nogc(free_op2);
if ((IS_UNUSED & (IS_VAR|IS_TMP_VAR)) && UNEXPECTED(EG(exception))) {
HANDLE_EXCEPTION();
}
call = zend_vm_stack_push_call_frame(call_info,
fbc, opline->extended_value, called_scope, obj);
call->prev_execute_data = EX(call);
EX(call) = call;
zval_ptr_dtor_nogc(free_op2);
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_UNUSED_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -32164,13 +32294,17 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CONST
GC_REFCOUNT(obj)++; /* For $this pointer */
}
if ((IS_CV & (IS_VAR|IS_TMP_VAR)) && UNEXPECTED(EG(exception))) {
HANDLE_EXCEPTION();
}
call = zend_vm_stack_push_call_frame(call_info,
fbc, opline->extended_value, called_scope, obj);
call->prev_execute_data = EX(call);
EX(call) = call;
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CASE_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -32341,7 +32475,10 @@ num_index:
}
} else {
zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr);
if (!zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr)) {
zend_error(E_WARNING, "Cannot add element to the array as the next element is already occupied");
zval_ptr_dtor(expr_ptr);
}
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -34874,7 +35011,10 @@ num_index:
}
} else {
zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr);
if (!zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr)) {
zend_error(E_WARNING, "Cannot add element to the array as the next element is already occupied");
zval_ptr_dtor(expr_ptr);
}
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -37262,13 +37402,17 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CV_HA
GC_REFCOUNT(obj)++; /* For $this pointer */
}
if ((IS_CV & (IS_VAR|IS_TMP_VAR)) && UNEXPECTED(EG(exception))) {
HANDLE_EXCEPTION();
}
call = zend_vm_stack_push_call_frame(call_info,
fbc, opline->extended_value, called_scope, obj);
call->prev_execute_data = EX(call);
EX(call) = call;
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CASE_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -37439,7 +37583,10 @@ num_index:
}
} else {
zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr);
if (!zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr)) {
zend_error(E_WARNING, "Cannot add element to the array as the next element is already occupied");
zval_ptr_dtor(expr_ptr);
}
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -39854,14 +40001,18 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_TMPVA
GC_REFCOUNT(obj)++; /* For $this pointer */
}
zval_ptr_dtor_nogc(free_op2);
if ((IS_CV & (IS_VAR|IS_TMP_VAR)) && UNEXPECTED(EG(exception))) {
HANDLE_EXCEPTION();
}
call = zend_vm_stack_push_call_frame(call_info,
fbc, opline->extended_value, called_scope, obj);
call->prev_execute_data = EX(call);
EX(call) = call;
zval_ptr_dtor_nogc(free_op2);
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CASE_SPEC_CV_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -40032,7 +40183,10 @@ num_index:
}
zval_ptr_dtor_nogc(free_op2);
} else {
zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr);
if (!zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr)) {
zend_error(E_WARNING, "Cannot add element to the array as the next element is already occupied");
zval_ptr_dtor(expr_ptr);
}
}
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
@@ -42093,14 +42247,18 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_C
GC_REFCOUNT(obj)++; /* For $this pointer */
}
zval_ptr_dtor_nogc(free_op1);
if (((IS_TMP_VAR|IS_VAR) & (IS_VAR|IS_TMP_VAR)) && UNEXPECTED(EG(exception))) {
HANDLE_EXCEPTION();
}
call = zend_vm_stack_push_call_frame(call_info,
fbc, opline->extended_value, called_scope, obj);
call->prev_execute_data = EX(call);
EX(call) = call;
zval_ptr_dtor_nogc(free_op1);
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CASE_SPEC_TMPVAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -44241,14 +44399,18 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_C
GC_REFCOUNT(obj)++; /* For $this pointer */
}
zval_ptr_dtor_nogc(free_op1);
if (((IS_TMP_VAR|IS_VAR) & (IS_VAR|IS_TMP_VAR)) && UNEXPECTED(EG(exception))) {
HANDLE_EXCEPTION();
}
call = zend_vm_stack_push_call_frame(call_info,
fbc, opline->extended_value, called_scope, obj);
call->prev_execute_data = EX(call);
EX(call) = call;
zval_ptr_dtor_nogc(free_op1);
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CASE_SPEC_TMPVAR_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
@@ -45387,15 +45549,19 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_T
GC_REFCOUNT(obj)++; /* For $this pointer */
}
zval_ptr_dtor_nogc(free_op2);
zval_ptr_dtor_nogc(free_op1);
if (((IS_TMP_VAR|IS_VAR) & (IS_VAR|IS_TMP_VAR)) && UNEXPECTED(EG(exception))) {
HANDLE_EXCEPTION();
}
call = zend_vm_stack_push_call_frame(call_info,
fbc, opline->extended_value, called_scope, obj);
call->prev_execute_data = EX(call);
EX(call) = call;
zval_ptr_dtor_nogc(free_op2);
zval_ptr_dtor_nogc(free_op1);
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CASE_SPEC_TMPVAR_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
+1 -1
View File
@@ -119,7 +119,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
PHP_MAJOR_VERSION=7
PHP_MINOR_VERSION=0
PHP_RELEASE_VERSION=12
PHP_RELEASE_VERSION=13
PHP_EXTRA_VERSION=""
PHP_VERSION="$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION.$PHP_RELEASE_VERSION$PHP_EXTRA_VERSION"
PHP_VERSION_ID=`expr [$]PHP_MAJOR_VERSION \* 10000 + [$]PHP_MINOR_VERSION \* 100 + [$]PHP_RELEASE_VERSION`
+4 -1
View File
@@ -49,7 +49,10 @@ _bc_new_num_ex (length, scale, persistent)
int length, scale, persistent;
{
bc_num temp;
/* PHP Change: add length check */
if ((size_t)length+(size_t)scale > INT_MAX) {
zend_error(E_ERROR, "Result too long, max is %d", INT_MAX);
}
/* PHP Change: malloc() -> pemalloc(), removed free_list code */
temp = (bc_num) safe_pemalloc (1, sizeof(bc_struct)+length, scale, persistent);
#if 0
+1 -2
View File
@@ -41,6 +41,5 @@
void bc_out_of_memory (void)
{
(void) fprintf (stderr, "bcmath: out of memory!\n");
exit (1);
zend_error(E_ERROR, "bcmath: out of memory!");
}
+1
View File
@@ -137,6 +137,7 @@ ZEND_METHOD(CURLFile, setPostFilename)
Unserialization handler */
ZEND_METHOD(CURLFile, __wakeup)
{
zend_unset_property(curl_CURLFile_class, getThis(), "name", sizeof("name")-1);
zend_update_property_string(curl_CURLFile_class, getThis(), "name", sizeof("name")-1, "");
zend_throw_exception(NULL, "Unserialization of CURLFile instances is not allowed", 0);
}
+3
View File
@@ -801,6 +801,9 @@ PHP_MINIT_FUNCTION(curl)
REGISTER_CURL_CONSTANT(CURLE_SSL_ENGINE_NOTFOUND);
REGISTER_CURL_CONSTANT(CURLE_SSL_ENGINE_SETFAILED);
REGISTER_CURL_CONSTANT(CURLE_SSL_PEER_CERTIFICATE);
#if LIBCURL_VERSION_NUM >= 0x072700 /* Available since 7.39.0 */
REGISTER_CURL_CONSTANT(CURLE_SSL_PINNEDPUBKEYNOTMATCH);
#endif
REGISTER_CURL_CONSTANT(CURLE_TELNET_OPTION_SYNTAX);
REGISTER_CURL_CONSTANT(CURLE_TOO_MANY_REDIRECTS);
REGISTER_CURL_CONSTANT(CURLE_UNKNOWN_TELNET_OPTION);
+20
View File
@@ -0,0 +1,20 @@
--TEST--
Bug #73147: Use After Free in PHP7 unserialize()
--SKIPIF--
<?php
if (!extension_loaded("curl")) {
exit("skip curl extension not loaded");
}
?>
--FILE--
<?php
$poc = 'a:1:{i:0;O:8:"CURLFile":1:{s:4:"name";R:1;}}';
try {
var_dump(unserialize($poc));
} catch(Exception $e) {
echo $e->getMessage();
}
?>
--EXPECT--
Unserialization of CURLFile instances is not allowed
+104 -100
View File
@@ -1,4 +1,4 @@
/* Generated by re2c 0.15.3 on Sun Jul 24 14:52:04 2016 */
/* Generated by re2c 0.15.3 on Fri Sep 30 20:30:54 2016 */
#line 1 "ext/date/lib/parse_date.re"
/*
* The MIT License (MIT)
@@ -396,8 +396,12 @@ static timelib_sll timelib_meridian(char **ptr, timelib_sll h)
}
++*ptr;
if (**ptr == '.') {
*ptr += 3;
} else {
++*ptr;
}
if (**ptr == 'M' || **ptr == 'm') {
++*ptr;
}
if (**ptr == '.') {
++*ptr;
}
return retval;
@@ -820,11 +824,11 @@ static int scan(Scanner *s, timelib_tz_get_wrapper tz_get_wrapper)
std:
s->tok = cursor;
s->len = 0;
#line 946 "ext/date/lib/parse_date.re"
#line 950 "ext/date/lib/parse_date.re"
#line 828 "<stdout>"
#line 832 "<stdout>"
{
YYCTYPE yych;
unsigned int yyaccept = 0;
@@ -959,7 +963,7 @@ yy2:
}
}
yy3:
#line 1626 "ext/date/lib/parse_date.re"
#line 1630 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("tzcorrection | tz");
@@ -972,7 +976,7 @@ yy3:
TIMELIB_DEINIT;
return TIMELIB_TIMEZONE;
}
#line 976 "<stdout>"
#line 980 "<stdout>"
yy4:
yych = *++YYCURSOR;
if (yych <= 'E') {
@@ -1272,12 +1276,12 @@ yy11:
if (yych <= '/') goto yy12;
if (yych <= '9') goto yy1385;
yy12:
#line 1721 "ext/date/lib/parse_date.re"
#line 1725 "ext/date/lib/parse_date.re"
{
add_error(s, "Unexpected character");
goto std;
}
#line 1281 "<stdout>"
#line 1285 "<stdout>"
yy13:
yych = *++YYCURSOR;
if (yych <= 'R') {
@@ -2291,22 +2295,22 @@ yy48:
if (yych <= '/') goto yy49;
if (yych <= '9') goto yy54;
yy49:
#line 1710 "ext/date/lib/parse_date.re"
#line 1714 "ext/date/lib/parse_date.re"
{
goto std;
}
#line 2299 "<stdout>"
#line 2303 "<stdout>"
yy50:
yych = *++YYCURSOR;
goto yy49;
yy51:
++YYCURSOR;
#line 1715 "ext/date/lib/parse_date.re"
#line 1719 "ext/date/lib/parse_date.re"
{
s->pos = cursor; s->line++;
goto std;
}
#line 2310 "<stdout>"
#line 2314 "<stdout>"
yy53:
yych = *++YYCURSOR;
goto yy12;
@@ -2673,7 +2677,7 @@ yy71:
if (yych == 'S') goto yy73;
if (yych == 's') goto yy73;
yy72:
#line 1694 "ext/date/lib/parse_date.re"
#line 1698 "ext/date/lib/parse_date.re"
{
timelib_ull i;
DEBUG_OUTPUT("relative");
@@ -2688,7 +2692,7 @@ yy72:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 2692 "<stdout>"
#line 2696 "<stdout>"
yy73:
yych = *++YYCURSOR;
if (yych == 'D') goto yy74;
@@ -3356,7 +3360,7 @@ yy165:
}
}
yy166:
#line 1557 "ext/date/lib/parse_date.re"
#line 1561 "ext/date/lib/parse_date.re"
{
const timelib_relunit* relunit;
DEBUG_OUTPUT("daytext");
@@ -3373,7 +3377,7 @@ yy166:
TIMELIB_DEINIT;
return TIMELIB_WEEKDAY;
}
#line 3377 "<stdout>"
#line 3381 "<stdout>"
yy167:
yych = *++YYCURSOR;
if (yych <= 'K') {
@@ -3866,7 +3870,7 @@ yy192:
}
}
yy193:
#line 1616 "ext/date/lib/parse_date.re"
#line 1620 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("monthtext");
TIMELIB_INIT;
@@ -3875,7 +3879,7 @@ yy193:
TIMELIB_DEINIT;
return TIMELIB_DATE_TEXT;
}
#line 3879 "<stdout>"
#line 3883 "<stdout>"
yy194:
++YYCURSOR;
if ((YYLIMIT - YYCURSOR) < 21) YYFILL(21);
@@ -3921,7 +3925,7 @@ yy197:
}
}
yy198:
#line 1362 "ext/date/lib/parse_date.re"
#line 1366 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datetextual | datenoyear");
@@ -3934,7 +3938,7 @@ yy198:
TIMELIB_DEINIT;
return TIMELIB_DATE_TEXT;
}
#line 3938 "<stdout>"
#line 3942 "<stdout>"
yy199:
yyaccept = 6;
yych = *(YYMARKER = ++YYCURSOR);
@@ -4179,7 +4183,7 @@ yy221:
if (yych <= ':') goto yy224;
}
yy222:
#line 1664 "ext/date/lib/parse_date.re"
#line 1668 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("dateshortwithtimeshort | dateshortwithtimelong | dateshortwithtimelongtz");
@@ -4208,7 +4212,7 @@ yy222:
TIMELIB_DEINIT;
return TIMELIB_SHORTDATE_WITH_TIME;
}
#line 4212 "<stdout>"
#line 4216 "<stdout>"
yy223:
yyaccept = 7;
yych = *(YYMARKER = ++YYCURSOR);
@@ -4850,7 +4854,7 @@ yy276:
}
yy277:
++YYCURSOR;
#line 1640 "ext/date/lib/parse_date.re"
#line 1644 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("dateshortwithtimeshort12 | dateshortwithtimelong12");
TIMELIB_INIT;
@@ -4873,7 +4877,7 @@ yy277:
TIMELIB_DEINIT;
return TIMELIB_SHORTDATE_WITH_TIME;
}
#line 4877 "<stdout>"
#line 4881 "<stdout>"
yy279:
yych = *++YYCURSOR;
if (yych <= 0x1F) {
@@ -5035,7 +5039,7 @@ yy292:
yy293:
++YYCURSOR;
yy294:
#line 1334 "ext/date/lib/parse_date.re"
#line 1338 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datenoday");
@@ -5048,7 +5052,7 @@ yy294:
TIMELIB_DEINIT;
return TIMELIB_DATE_NO_DAY;
}
#line 5052 "<stdout>"
#line 5056 "<stdout>"
yy295:
yych = *++YYCURSOR;
if (yych <= '/') {
@@ -6199,7 +6203,7 @@ yy361:
if ((yych = *YYCURSOR) <= '/') goto yy363;
if (yych <= '9') goto yy364;
yy363:
#line 1478 "ext/date/lib/parse_date.re"
#line 1482 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pgtextshort");
@@ -6212,7 +6216,7 @@ yy363:
TIMELIB_DEINIT;
return TIMELIB_PG_TEXT;
}
#line 6216 "<stdout>"
#line 6220 "<stdout>"
yy364:
yych = *++YYCURSOR;
if (yych <= '/') goto yy363;
@@ -6821,7 +6825,7 @@ yy391:
if (yych <= 'z') goto yy142;
}
yy392:
#line 1536 "ext/date/lib/parse_date.re"
#line 1540 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("ago");
TIMELIB_INIT;
@@ -6841,7 +6845,7 @@ yy392:
TIMELIB_DEINIT;
return TIMELIB_AGO;
}
#line 6845 "<stdout>"
#line 6849 "<stdout>"
yy393:
yyaccept = 5;
yych = *(YYMARKER = ++YYCURSOR);
@@ -8529,7 +8533,7 @@ yy452:
yy453:
++YYCURSOR;
yy454:
#line 1239 "ext/date/lib/parse_date.re"
#line 1243 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("iso8601date4 | iso8601date2 | iso8601dateslash | dateslash");
TIMELIB_INIT;
@@ -8540,7 +8544,7 @@ yy454:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 8544 "<stdout>"
#line 8548 "<stdout>"
yy455:
yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
@@ -9076,7 +9080,7 @@ yy474:
}
}
yy475:
#line 1376 "ext/date/lib/parse_date.re"
#line 1380 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("datenoyearrev");
TIMELIB_INIT;
@@ -9087,7 +9091,7 @@ yy475:
TIMELIB_DEINIT;
return TIMELIB_DATE_TEXT;
}
#line 9091 "<stdout>"
#line 9095 "<stdout>"
yy476:
yyaccept = 10;
yych = *(YYMARKER = ++YYCURSOR);
@@ -9215,7 +9219,7 @@ yy485:
}
yy487:
++YYCURSOR;
#line 1094 "ext/date/lib/parse_date.re"
#line 1098 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("timetiny12 | timeshort12 | timelong12");
TIMELIB_INIT;
@@ -9231,7 +9235,7 @@ yy487:
TIMELIB_DEINIT;
return TIMELIB_TIME12;
}
#line 9235 "<stdout>"
#line 9239 "<stdout>"
yy489:
yyaccept = 11;
yych = *(YYMARKER = ++YYCURSOR);
@@ -9242,7 +9246,7 @@ yy489:
if (yych <= ':') goto yy492;
}
yy490:
#line 1131 "ext/date/lib/parse_date.re"
#line 1135 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("timeshort24 | timelong24 | iso8601long");
@@ -9267,7 +9271,7 @@ yy490:
TIMELIB_DEINIT;
return TIMELIB_TIME24_WITH_ZONE;
}
#line 9271 "<stdout>"
#line 9275 "<stdout>"
yy491:
yyaccept = 11;
yych = *(YYMARKER = ++YYCURSOR);
@@ -9544,7 +9548,7 @@ yy520:
}
yy522:
++YYCURSOR;
#line 1111 "ext/date/lib/parse_date.re"
#line 1115 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("mssqltime");
TIMELIB_INIT;
@@ -9563,7 +9567,7 @@ yy522:
TIMELIB_DEINIT;
return TIMELIB_TIME24_WITH_ZONE;
}
#line 9567 "<stdout>"
#line 9571 "<stdout>"
yy524:
yyaccept = 11;
YYMARKER = ++YYCURSOR;
@@ -9658,7 +9662,7 @@ yy533:
if ((yych = *YYCURSOR) <= '/') goto yy534;
if (yych <= '9') goto yy540;
yy534:
#line 1293 "ext/date/lib/parse_date.re"
#line 1297 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datefull");
@@ -9672,7 +9676,7 @@ yy534:
TIMELIB_DEINIT;
return TIMELIB_DATE_FULL;
}
#line 9676 "<stdout>"
#line 9680 "<stdout>"
yy535:
yych = *++YYCURSOR;
if (yych == 'M') goto yy536;
@@ -10336,7 +10340,7 @@ yy604:
if (yych <= '/') goto yy56;
if (yych >= ':') goto yy56;
++YYCURSOR;
#line 1308 "ext/date/lib/parse_date.re"
#line 1312 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("pointed date YYYY");
TIMELIB_INIT;
@@ -10347,7 +10351,7 @@ yy604:
TIMELIB_DEINIT;
return TIMELIB_DATE_FULL_POINTED;
}
#line 10351 "<stdout>"
#line 10355 "<stdout>"
yy607:
yyaccept = 11;
yych = *(YYMARKER = ++YYCURSOR);
@@ -10378,7 +10382,7 @@ yy610:
if (yych <= '/') goto yy611;
if (yych <= '9') goto yy604;
yy611:
#line 1320 "ext/date/lib/parse_date.re"
#line 1324 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pointed date YY");
@@ -10391,7 +10395,7 @@ yy611:
TIMELIB_DEINIT;
return TIMELIB_DATE_FULL_POINTED;
}
#line 10395 "<stdout>"
#line 10399 "<stdout>"
yy612:
yyaccept = 11;
yych = *(YYMARKER = ++YYCURSOR);
@@ -10987,7 +10991,7 @@ yy655:
}
}
yy656:
#line 1279 "ext/date/lib/parse_date.re"
#line 1283 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("gnudateshort");
@@ -11000,7 +11004,7 @@ yy656:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 11004 "<stdout>"
#line 11008 "<stdout>"
yy657:
yyaccept = 13;
yych = *(YYMARKER = ++YYCURSOR);
@@ -11096,7 +11100,7 @@ yy665:
}
}
yy666:
#line 1223 "ext/date/lib/parse_date.re"
#line 1227 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("americanshort | american");
@@ -11111,7 +11115,7 @@ yy666:
TIMELIB_DEINIT;
return TIMELIB_AMERICAN;
}
#line 11115 "<stdout>"
#line 11119 "<stdout>"
yy667:
yyaccept = 14;
yych = *(YYMARKER = ++YYCURSOR);
@@ -11310,7 +11314,7 @@ yy699:
if (yych <= '9') goto yy702;
if (yych <= ':') goto yy703;
yy700:
#line 1506 "ext/date/lib/parse_date.re"
#line 1510 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("clf");
@@ -11330,7 +11334,7 @@ yy700:
TIMELIB_DEINIT;
return TIMELIB_CLF;
}
#line 11334 "<stdout>"
#line 11338 "<stdout>"
yy701:
yych = *++YYCURSOR;
if (yych <= '5') {
@@ -11817,7 +11821,7 @@ yy762:
if (yych <= 't') goto yy662;
}
yy763:
#line 1251 "ext/date/lib/parse_date.re"
#line 1255 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("iso8601date2");
@@ -11830,7 +11834,7 @@ yy763:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 11834 "<stdout>"
#line 11838 "<stdout>"
yy764:
yych = *++YYCURSOR;
if (yych == 'C') goto yy765;
@@ -11861,7 +11865,7 @@ yy769:
if (yych >= '2') goto yy56;
yy770:
++YYCURSOR;
#line 1492 "ext/date/lib/parse_date.re"
#line 1496 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pgtextreverse");
@@ -11874,7 +11878,7 @@ yy770:
TIMELIB_DEINIT;
return TIMELIB_PG_TEXT;
}
#line 11878 "<stdout>"
#line 11882 "<stdout>"
yy772:
yych = *++YYCURSOR;
if (yych == 'V') goto yy765;
@@ -11999,7 +12003,7 @@ yy782:
default: goto yy783;
}
yy783:
#line 1527 "ext/date/lib/parse_date.re"
#line 1531 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("year4");
TIMELIB_INIT;
@@ -12007,7 +12011,7 @@ yy783:
TIMELIB_DEINIT;
return TIMELIB_CLF;
}
#line 12011 "<stdout>"
#line 12015 "<stdout>"
yy784:
yych = *++YYCURSOR;
switch (yych) {
@@ -12145,7 +12149,7 @@ yy792:
if (yych <= 'X') goto yy883;
}
yy793:
#line 1348 "ext/date/lib/parse_date.re"
#line 1352 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("datenodayrev");
@@ -12158,7 +12162,7 @@ yy793:
TIMELIB_DEINIT;
return TIMELIB_DATE_NO_DAY;
}
#line 12162 "<stdout>"
#line 12166 "<stdout>"
yy794:
yych = *++YYCURSOR;
if (yych == 'I') goto yy927;
@@ -12352,7 +12356,7 @@ yy813:
if (yych <= '/') goto yy814;
if (yych <= '7') goto yy816;
yy814:
#line 1459 "ext/date/lib/parse_date.re"
#line 1463 "ext/date/lib/parse_date.re"
{
timelib_sll w, d;
DEBUG_OUTPUT("isoweek");
@@ -12370,14 +12374,14 @@ yy814:
TIMELIB_DEINIT;
return TIMELIB_ISO_WEEK;
}
#line 12374 "<stdout>"
#line 12378 "<stdout>"
yy815:
yych = *++YYCURSOR;
if (yych <= '/') goto yy56;
if (yych >= '8') goto yy56;
yy816:
++YYCURSOR;
#line 1440 "ext/date/lib/parse_date.re"
#line 1444 "ext/date/lib/parse_date.re"
{
timelib_sll w, d;
DEBUG_OUTPUT("isoweekday");
@@ -12395,7 +12399,7 @@ yy816:
TIMELIB_DEINIT;
return TIMELIB_ISO_WEEK;
}
#line 12399 "<stdout>"
#line 12403 "<stdout>"
yy818:
yych = *++YYCURSOR;
if (yych <= '/') goto yy60;
@@ -12455,7 +12459,7 @@ yy820:
}
}
yy821:
#line 1426 "ext/date/lib/parse_date.re"
#line 1430 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("pgydotd");
@@ -12468,7 +12472,7 @@ yy821:
TIMELIB_DEINIT;
return TIMELIB_PG_YEARDAY;
}
#line 12472 "<stdout>"
#line 12476 "<stdout>"
yy822:
yych = *++YYCURSOR;
if (yych <= '/') goto yy60;
@@ -12550,7 +12554,7 @@ yy840:
yy841:
++YYCURSOR;
yy842:
#line 1400 "ext/date/lib/parse_date.re"
#line 1404 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("xmlrpc | xmlrpcnocolon | soap | wddx | exif");
@@ -12575,7 +12579,7 @@ yy842:
TIMELIB_DEINIT;
return TIMELIB_XMLRPC_SOAP;
}
#line 12579 "<stdout>"
#line 12583 "<stdout>"
yy843:
yych = *++YYCURSOR;
if (yych <= '2') {
@@ -12831,7 +12835,7 @@ yy847:
}
}
yy848:
#line 1388 "ext/date/lib/parse_date.re"
#line 1392 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("datenocolon");
TIMELIB_INIT;
@@ -12842,7 +12846,7 @@ yy848:
TIMELIB_DEINIT;
return TIMELIB_DATE_NOCOLON;
}
#line 12846 "<stdout>"
#line 12850 "<stdout>"
yy849:
yych = *++YYCURSOR;
if (yych <= 'H') {
@@ -13636,7 +13640,7 @@ yy972:
if (yych <= '/') goto yy973;
if (yych <= '9') goto yy995;
yy973:
#line 1265 "ext/date/lib/parse_date.re"
#line 1269 "ext/date/lib/parse_date.re"
{
int length = 0;
DEBUG_OUTPUT("gnudateshorter");
@@ -13649,7 +13653,7 @@ yy973:
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
#line 13653 "<stdout>"
#line 13657 "<stdout>"
yy974:
yyaccept = 22;
yych = *(YYMARKER = ++YYCURSOR);
@@ -14561,7 +14565,7 @@ yy1065:
default: goto yy1067;
}
yy1067:
#line 1157 "ext/date/lib/parse_date.re"
#line 1161 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("gnunocolon");
TIMELIB_INIT;
@@ -14583,7 +14587,7 @@ yy1067:
TIMELIB_DEINIT;
return TIMELIB_GNU_NOCOLON;
}
#line 14587 "<stdout>"
#line 14591 "<stdout>"
yy1068:
yych = *++YYCURSOR;
if (yych <= '/') goto yy60;
@@ -14667,7 +14671,7 @@ yy1074:
}
}
yy1075:
#line 1203 "ext/date/lib/parse_date.re"
#line 1207 "ext/date/lib/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("iso8601nocolon");
@@ -14686,7 +14690,7 @@ yy1075:
TIMELIB_DEINIT;
return TIMELIB_ISO_NOCOLON;
}
#line 14690 "<stdout>"
#line 14694 "<stdout>"
yy1076:
yyaccept = 25;
yych = *(YYMARKER = ++YYCURSOR);
@@ -15542,7 +15546,7 @@ yy1116:
}
}
yy1117:
#line 1599 "ext/date/lib/parse_date.re"
#line 1603 "ext/date/lib/parse_date.re"
{
timelib_sll i;
int behavior = 0;
@@ -15558,7 +15562,7 @@ yy1117:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 15562 "<stdout>"
#line 15566 "<stdout>"
yy1118:
++YYCURSOR;
if ((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
@@ -15600,7 +15604,7 @@ yy1124:
if (yych != 'f') goto yy56;
yy1125:
++YYCURSOR;
#line 1072 "ext/date/lib/parse_date.re"
#line 1076 "ext/date/lib/parse_date.re"
{
timelib_sll i;
int behavior = 0;
@@ -15621,7 +15625,7 @@ yy1125:
TIMELIB_DEINIT;
return TIMELIB_WEEK_DAY_OF_MONTH;
}
#line 15625 "<stdout>"
#line 15629 "<stdout>"
yy1127:
yyaccept = 26;
yych = *(YYMARKER = ++YYCURSOR);
@@ -15714,7 +15718,7 @@ yy1140:
}
}
yy1141:
#line 1575 "ext/date/lib/parse_date.re"
#line 1579 "ext/date/lib/parse_date.re"
{
timelib_sll i;
int behavior = 0;
@@ -15737,7 +15741,7 @@ yy1141:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 15741 "<stdout>"
#line 15745 "<stdout>"
yy1142:
yych = *++YYCURSOR;
goto yy1117;
@@ -18261,7 +18265,7 @@ yy1293:
if (yych <= '9') goto yy1296;
goto yy1297;
yy1294:
#line 1049 "ext/date/lib/parse_date.re"
#line 1053 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("backof | frontof");
TIMELIB_INIT;
@@ -18283,7 +18287,7 @@ yy1294:
TIMELIB_DEINIT;
return TIMELIB_LF_DAY_OF_MONTH;
}
#line 18287 "<stdout>"
#line 18291 "<stdout>"
yy1295:
yyaccept = 28;
yych = *(YYMARKER = ++YYCURSOR);
@@ -18522,7 +18526,7 @@ yy1314:
if (yych != 'f') goto yy56;
yy1315:
++YYCURSOR;
#line 1032 "ext/date/lib/parse_date.re"
#line 1036 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("firstdayof | lastdayof");
TIMELIB_INIT;
@@ -18538,7 +18542,7 @@ yy1315:
TIMELIB_DEINIT;
return TIMELIB_LF_DAY_OF_MONTH;
}
#line 18542 "<stdout>"
#line 18546 "<stdout>"
yy1317:
yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
@@ -19898,7 +19902,7 @@ yy1385:
if (yych <= '/') goto yy1387;
if (yych <= '9') goto yy1385;
yy1387:
#line 1006 "ext/date/lib/parse_date.re"
#line 1010 "ext/date/lib/parse_date.re"
{
timelib_ull i;
@@ -19923,7 +19927,7 @@ yy1387:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 19927 "<stdout>"
#line 19931 "<stdout>"
yy1388:
yych = *++YYCURSOR;
if (yych <= 'N') {
@@ -20329,7 +20333,7 @@ yy1415:
yy1416:
++YYCURSOR;
yy1417:
#line 994 "ext/date/lib/parse_date.re"
#line 998 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("tomorrow");
TIMELIB_INIT;
@@ -20340,7 +20344,7 @@ yy1417:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 20344 "<stdout>"
#line 20348 "<stdout>"
yy1418:
yych = *++YYCURSOR;
if (yych <= 'Y') {
@@ -20372,7 +20376,7 @@ yy1419:
if (yych <= 'z') goto yy144;
}
yy1420:
#line 984 "ext/date/lib/parse_date.re"
#line 988 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("midnight | today");
TIMELIB_INIT;
@@ -20381,7 +20385,7 @@ yy1420:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 20385 "<stdout>"
#line 20389 "<stdout>"
yy1421:
yych = *++YYCURSOR;
if (yych <= 'S') {
@@ -22313,7 +22317,7 @@ yy1499:
if (yych <= 'z') goto yy142;
}
yy1500:
#line 963 "ext/date/lib/parse_date.re"
#line 967 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("now");
TIMELIB_INIT;
@@ -22321,7 +22325,7 @@ yy1500:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 22325 "<stdout>"
#line 22329 "<stdout>"
yy1501:
yych = *++YYCURSOR;
if (yych <= 'N') {
@@ -22452,7 +22456,7 @@ yy1507:
if (yych <= 'z') goto yy143;
}
yy1508:
#line 972 "ext/date/lib/parse_date.re"
#line 976 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("noon");
TIMELIB_INIT;
@@ -22463,7 +22467,7 @@ yy1508:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 22467 "<stdout>"
#line 22471 "<stdout>"
yy1509:
yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
@@ -22973,7 +22977,7 @@ yy1529:
yy1530:
++YYCURSOR;
yy1531:
#line 951 "ext/date/lib/parse_date.re"
#line 955 "ext/date/lib/parse_date.re"
{
DEBUG_OUTPUT("yesterday");
TIMELIB_INIT;
@@ -22984,7 +22988,7 @@ yy1531:
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
#line 22988 "<stdout>"
#line 22992 "<stdout>"
yy1532:
yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
@@ -23149,7 +23153,7 @@ yy1537:
goto yy1531;
}
}
#line 1725 "ext/date/lib/parse_date.re"
#line 1729 "ext/date/lib/parse_date.re"
}
+6 -2
View File
@@ -394,8 +394,12 @@ static timelib_sll timelib_meridian(char **ptr, timelib_sll h)
}
++*ptr;
if (**ptr == '.') {
*ptr += 3;
} else {
++*ptr;
}
if (**ptr == 'M' || **ptr == 'm') {
++*ptr;
}
if (**ptr == '.') {
++*ptr;
}
return retval;
+2138 -2248
View File
File diff suppressed because it is too large. Load diff
+6 -6
View File
@@ -75,8 +75,8 @@ result = Monday 1983-04-18 01:00:00 CEST
wanted = Monday 00:00:00
Asia/Yerevan
ts = Monday 2037-10-19 17:17:17 AMT
result = Monday 2037-10-26 00:00:00 AMT
ts = Monday 2037-10-19 17:17:17 +04
result = Monday 2037-10-26 00:00:00 +04
wanted = Monday 00:00:00
America/Curacao
@@ -115,8 +115,8 @@ result = Monday 1971-04-05 00:00:00 AST
wanted = Monday 00:00:00
Asia/Baku
ts = Friday 1971-01-01 17:17:17 BAKT
result = Monday 1971-01-04 00:00:00 BAKT
ts = Friday 1971-01-01 17:17:17 +04
result = Monday 1971-01-04 00:00:00 +04
wanted = Monday 00:00:00
Europe/Sarajevo
@@ -165,6 +165,6 @@ result = Monday 1980-04-07 00:00:00 CEST
wanted = Monday 00:00:00
Asia/Baku
ts = Monday 1995-12-25 17:17:17 AZT
result = Monday 1996-01-01 00:00:00 AZT
ts = Monday 1995-12-25 17:17:17 +04
result = Monday 1996-01-01 00:00:00 +04
wanted = Monday 00:00:00
+2 -2
View File
@@ -226,8 +226,8 @@ result=Thursday 1980-04-10 00:00:00 CEST 1
wanted=Thursday 00:00:00
TZ=Asia/Baku - wrong day.
tStamp=Sunday 1992-09-20 17:17:17 AZST 1
result=Monday 1992-09-28 00:00:00 AZT 0
tStamp=Sunday 1992-09-20 17:17:17 +04 1
result=Monday 1992-09-28 00:00:00 +04 0
wanted=Monday 00:00:00
TZ=America/Noronha - wrong day.
+2 -2
View File
@@ -28,6 +28,6 @@ result=Monday 1990-10-22 00:00:00 WART 0
wanted=Monday 00:00:00
TZ=Asia/Tbilisi - Is it OK for this to be 2 AM?
tStamp=Sunday 2005-03-20 17:17:17 GET 0
result=Sunday 2005-03-27 00:00:00 GET 0
tStamp=Sunday 2005-03-20 17:17:17 +03 0
result=Sunday 2005-03-27 00:00:00 +03 0
wanted=Sunday 00:00:00
+2 -2
View File
@@ -1663,7 +1663,7 @@ PHP_FUNCTION(dom_document_savexml)
if (options & LIBXML_SAVE_NOEMPTYTAG) {
xmlSaveNoEmptyTags = saveempty;
}
if (!size) {
if (!size || !mem) {
RETURN_FALSE;
}
RETVAL_STRINGL((char *) mem, size);
@@ -2215,7 +2215,7 @@ PHP_FUNCTION(dom_document_save_html)
#else
htmlDocDumpMemory(docp, &mem, &size);
#endif
if (!size) {
if (!size || !mem) {
RETVAL_FALSE;
} else {
RETVAL_STRINGL((const char*) mem, size);
+4 -1
View File
@@ -4695,7 +4695,7 @@ PHP_FUNCTION(imagescale)
gdImagePtr im_scaled = NULL;
int new_width, new_height;
zend_long tmp_w, tmp_h=-1, tmp_m = GD_BILINEAR_FIXED;
gdInterpolationMethod method;
gdInterpolationMethod method, old_method;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl|ll", &IM, &tmp_w, &tmp_h, &tmp_m) == FAILURE) {
return;
@@ -4724,9 +4724,12 @@ PHP_FUNCTION(imagescale)
new_width = tmp_w;
new_height = tmp_h;
/* gdImageGetInterpolationMethod() is only available as of GD 2.1.1 */
old_method = im->interpolation_id;
if (gdImageSetInterpolationMethod(im, method)) {
im_scaled = gdImageScale(im, new_width, new_height);
}
gdImageSetInterpolationMethod(im, old_method);
if (im_scaled == NULL) {
RETURN_FALSE;
+33 -66
View File
@@ -1115,7 +1115,7 @@ void gdImageLine (gdImagePtr im, int x1, int y1, int x2, int y2, int color)
}
/* 2.0.10: Nick Atty: clip to edges of drawing rectangle, return if no points need to be drawn */
if (!clip_1d(&x1,&y1,&x2,&y2,gdImageSX(im)) || !clip_1d(&y1,&x1,&y2,&x2,gdImageSY(im))) {
if (!clip_1d(&x1,&y1,&x2,&y2,gdImageSX(im)-1) || !clip_1d(&y1,&x1,&y2,&x2,gdImageSY(im)-1)) {
return;
}
@@ -1296,58 +1296,13 @@ inline static void gdImageSetAAPixelColor(gdImagePtr im, int x, int y, int color
void gdImageAALine (gdImagePtr im, int x1, int y1, int x2, int y2, int col)
{
/* keep them as 32bits */
long x, y, inc;
long x, y, inc, frac;
long dx, dy,tmp;
if (y1 < 0 && y2 < 0) {
/* 2.0.10: Nick Atty: clip to edges of drawing rectangle, return if no points need to be drawn */
if (!clip_1d(&x1,&y1,&x2,&y2,gdImageSX(im)-1) || !clip_1d(&y1,&x1,&y2,&x2,gdImageSY(im)-1)) {
return;
}
if (y1 < 0) {
x1 += (y1 * (x1 - x2)) / (y2 - y1);
y1 = 0;
}
if (y2 < 0) {
x2 += (y2 * (x1 - x2)) / (y2 - y1);
y2 = 0;
}
/* bottom edge */
if (y1 >= im->sy && y2 >= im->sy) {
return;
}
if (y1 >= im->sy) {
x1 -= ((im->sy - y1) * (x1 - x2)) / (y2 - y1);
y1 = im->sy - 1;
}
if (y2 >= im->sy) {
x2 -= ((im->sy - y2) * (x1 - x2)) / (y2 - y1);
y2 = im->sy - 1;
}
/* left edge */
if (x1 < 0 && x2 < 0) {
return;
}
if (x1 < 0) {
y1 += (x1 * (y1 - y2)) / (x2 - x1);
x1 = 0;
}
if (x2 < 0) {
y2 += (x2 * (y1 - y2)) / (x2 - x1);
x2 = 0;
}
/* right edge */
if (x1 >= im->sx && x2 >= im->sx) {
return;
}
if (x1 >= im->sx) {
y1 -= ((im->sx - x1) * (y1 - y2)) / (x2 - x1);
x1 = im->sx - 1;
}
if (x2 >= im->sx) {
y2 -= ((im->sx - x2) * (y1 - y2)) / (x2 - x1);
x2 = im->sx - 1;
}
dx = x2 - x1;
dy = y2 - y1;
@@ -1366,16 +1321,22 @@ void gdImageAALine (gdImagePtr im, int x1, int y1, int x2, int y2, int col)
dx = x2 - x1;
dy = y2 - y1;
}
x = x1 << 16;
y = y1 << 16;
y = y1;
inc = (dy * 65536) / dx;
while ((x >> 16) <= x2) {
gdImageSetAAPixelColor(im, x >> 16, y >> 16, col, (y >> 8) & 0xFF);
if ((y >> 16) + 1 < im->sy) {
gdImageSetAAPixelColor(im, x >> 16, (y >> 16) + 1,col, (~y >> 8) & 0xFF);
frac = 0;
for (x = x1; x <= x2; x++) {
gdImageSetAAPixelColor(im, x, y, col, (frac >> 8) & 0xFF);
if (y + 1 < im->sy) {
gdImageSetAAPixelColor(im, x, y + 1, col, (~frac >> 8) & 0xFF);
}
frac += inc;
if (frac >= 65536) {
frac -= 65536;
y++;
} else if (frac < 0) {
frac += 65536;
y--;
}
x += (1 << 16);
y += inc;
}
} else {
if (dy < 0) {
@@ -1388,16 +1349,22 @@ void gdImageAALine (gdImagePtr im, int x1, int y1, int x2, int y2, int col)
dx = x2 - x1;
dy = y2 - y1;
}
x = x1 << 16;
y = y1 << 16;
x = x1;
inc = (dx * 65536) / dy;
while ((y>>16) <= y2) {
gdImageSetAAPixelColor(im, x >> 16, y >> 16, col, (x >> 8) & 0xFF);
if ((x >> 16) + 1 < im->sx) {
gdImageSetAAPixelColor(im, (x >> 16) + 1, (y >> 16),col, (~x >> 8) & 0xFF);
frac = 0;
for (y = y1; y <= y2; y++) {
gdImageSetAAPixelColor(im, x, y, col, (frac >> 8) & 0xFF);
if (x + 1 < im->sx) {
gdImageSetAAPixelColor(im, x + 1, y, col, (~frac >> 8) & 0xFF);
}
frac += inc;
if (frac >= 65536) {
frac -= 65536;
x++;
} else if (frac < 0) {
frac += 65536;
x--;
}
x += inc;
y += (1<<16);
}
}
}
@@ -1778,7 +1745,7 @@ void gdImageFillToBorder (gdImagePtr im, int x, int y, int border, int color)
int leftLimit = -1, rightLimit;
int i, restoreAlphaBlending = 0;
if (border < 0) {
if (border < 0 || color < 0) {
/* Refuse to fill to a non-solid border */
return;
}
+4 -4
View File
@@ -1331,10 +1331,10 @@ static gdImagePtr gdImageScaleBilinearPalette(gdImagePtr im, const unsigned int
f_a4 = gd_itofx(gdTrueColorGetAlpha(pixel4));
{
const char red = (char) gd_fxtoi(gd_mulfx(f_w1, f_r1) + gd_mulfx(f_w2, f_r2) + gd_mulfx(f_w3, f_r3) + gd_mulfx(f_w4, f_r4));
const char green = (char) gd_fxtoi(gd_mulfx(f_w1, f_g1) + gd_mulfx(f_w2, f_g2) + gd_mulfx(f_w3, f_g3) + gd_mulfx(f_w4, f_g4));
const char blue = (char) gd_fxtoi(gd_mulfx(f_w1, f_b1) + gd_mulfx(f_w2, f_b2) + gd_mulfx(f_w3, f_b3) + gd_mulfx(f_w4, f_b4));
const char alpha = (char) gd_fxtoi(gd_mulfx(f_w1, f_a1) + gd_mulfx(f_w2, f_a2) + gd_mulfx(f_w3, f_a3) + gd_mulfx(f_w4, f_a4));
const unsigned char red = (unsigned char) gd_fxtoi(gd_mulfx(f_w1, f_r1) + gd_mulfx(f_w2, f_r2) + gd_mulfx(f_w3, f_r3) + gd_mulfx(f_w4, f_r4));
const unsigned char green = (unsigned char) gd_fxtoi(gd_mulfx(f_w1, f_g1) + gd_mulfx(f_w2, f_g2) + gd_mulfx(f_w3, f_g3) + gd_mulfx(f_w4, f_g4));
const unsigned char blue = (unsigned char) gd_fxtoi(gd_mulfx(f_w1, f_b1) + gd_mulfx(f_w2, f_b2) + gd_mulfx(f_w3, f_b3) + gd_mulfx(f_w4, f_b4));
const unsigned char alpha = (unsigned char) gd_fxtoi(gd_mulfx(f_w1, f_a1) + gd_mulfx(f_w2, f_a2) + gd_mulfx(f_w3, f_a3) + gd_mulfx(f_w4, f_a4));
new_img->tpixels[dst_offset_v][dst_offset_h] = gdTrueColorAlpha(red, green, blue, alpha);
}
+1 -1
View File
@@ -237,7 +237,7 @@ static int dynamicGetbuf (gdIOCtxPtr ctx, void *buf, int len)
if (remain >= len) {
rlen = len;
} else {
if (remain == 0) {
if (remain <= 0) {
return EOF;
}
rlen = remain;
+19
View File
@@ -0,0 +1,19 @@
--TEST--
Bug #72482 (Ilegal write/read access caused by gdImageAALine overflow)
--SKIPIF--
<?php
if (!extension_loaded('gd')) die('skip gd extension not available');
?>
--FILE--
<?php
$img = imagecreatetruecolor(13, 1007);
imageantialias($img, true);
imageline($img, 0, 0, 1073745919, 1073745919, 4096);
$img = imagecreatetruecolor(100, 100);
imageantialias($img, true);
imageline($img, 1094795585, 0, 2147483647, 255, 0xff);
?>
===DONE===
--EXPECT--
===DONE===
+21
View File
@@ -0,0 +1,21 @@
--TEST--
Bug 72482 (Ilegal write/read access caused by gdImageAALine overflow)
--SKIPIF--
<?php
if (!extension_loaded('gd')) die('skip gd extension not available');
?>
--FILE--
<?php
require_once __DIR__ . DIRECTORY_SEPARATOR . 'func.inc';
$im = imagecreatetruecolor(10, 10);
imagefilledrectangle($im, 0, 0, 9, 9, imagecolorallocate($im, 255, 255, 255));
imageantialias($im, true);
imageline($im, 0, 0, 10, 10, imagecolorallocate($im, 0, 0, 0));
test_image_equals_file(__DIR__ . DIRECTORY_SEPARATOR . 'bug72482_2.png', $im);
?>
===DONE===
--EXPECT--
The images are equal.
===DONE===
Binary file not shown.

After

Width:  |  Height:  |  Size: 118 B

+14
View File
@@ -0,0 +1,14 @@
--TEST--
Bug #72696 (imagefilltoborder stackoverflow on truecolor images)
--SKIPIF--
<?php
if (!extension_loaded('gd')) die('skip gd extension not available');
?>
--FILE--
<?php
$im = imagecreatetruecolor(10, 10);
imagefilltoborder($im, 0, 0, 1, -2);
?>
===DONE===
--EXPECT--
===DONE===
+22
View File
@@ -0,0 +1,22 @@
--TEST--
Bug #73213 (Integer overflow in imageline() with antialiasing)
--SKIPIF--
<?php
if (!extension_loaded('gd')) die('skip gd extension not available');
?>
--FILE--
<?php
require_once __DIR__ . DIRECTORY_SEPARATOR . 'func.inc';
$im = imagecreatetruecolor(32768, 1);
$black = imagecolorallocate($im, 0, 0, 0);
imageantialias($im, true);
imageline($im, 0,0, 32767,0, $black);
test_image_equals_file(__DIR__ . DIRECTORY_SEPARATOR . 'bug73213.png', $im);
?>
===DONE===
--EXPECT--
The images are equal.
===DONE===
Binary file not shown.

After

Width:  |  Height:  |  Size: 195 B

+24
View File
@@ -0,0 +1,24 @@
--TEST--
Bug #73272 (imagescale() is not affected by, but affects imagesetinterpolation())
--SKIPIF--
<?php
if (!extension_loaded('gd')) die('skip gd extension not available');
?>
--FILE--
<?php
require_once __DIR__ . DIRECTORY_SEPARATOR . 'func.inc';
$src = imagecreatetruecolor(100, 100);
imagefilledrectangle($src, 0,0, 99,99, 0xFFFFFF);
imageellipse($src, 49,49, 40,40, 0x000000);
imagesetinterpolation($src, IMG_NEAREST_NEIGHBOUR);
imagescale($src, 200, 200, IMG_BILINEAR_FIXED);
$dst = imagerotate($src, 60, 0xFFFFFF);
test_image_equals_file(__DIR__ . DIRECTORY_SEPARATOR . 'bug73272.png', $dst);
?>
===DONE===
--EXPECT--
The images are equal.
===DONE===
Binary file not shown.

After

Width:  |  Height:  |  Size: 739 B

+20
View File
@@ -0,0 +1,20 @@
--TEST--
Bug #73279 (Integer overflow in gdImageScaleBilinearPalette())
--SKIPIF--
<?php
if (!extension_loaded('gd')) die('skip gd extension not available');
if (!GD_BUNDLED && version_compare(GD_VERSION, '2.2.4', '<')) {
die('skip only for bundled libgd or external libgd >= 2.2.4');
}
?>
--FILE--
<?php
$src = imagecreate(100, 100);
imagecolorallocate($src, 255, 255, 255);
$dst = imagescale($src, 200, 200, IMG_BILINEAR_FIXED);
printf("color: %x\n", imagecolorat($dst, 99, 99));
?>
===DONE===
--EXPECT--
color: ffffff
===DONE===
+22
View File
@@ -0,0 +1,22 @@
--TEST--
Bug #73279 (Integer overflow in gdImageScaleBilinearPalette())
--SKIPIF--
<?php
if (!extension_loaded('gd')) die('skip gd extension not available');
if (GD_BUNDLED || version_compare(GD_VERSION, '2.2.4', '>=')) {
die('skip only for external libgd < 2.2.4');
}
?>
--FILE--
<?php
$src = imagecreate(100, 100);
imagecolorallocate($src, 255, 255, 255);
$dst = imagescale($src, 200, 200, IMG_BILINEAR_FIXED);
printf("color: %x\n", imagecolorat($dst, 99, 99));
?>
===DONE===
--XFAIL--
Bug #330 has not yet been fixed
--EXPECT--
color: ffffff
===DONE===
+21
View File
@@ -0,0 +1,21 @@
--TEST--
bool hash_update_file ( resource $hcontext , string $filename [, resource $scontext = NULL ] );
--CREDITS--
marcosptf - <marcosptf@yahoo.com.br> - @phpsp - sao paulo - br
--SKIPIF--
<?php
if (phpversion() < "5.3.0") {
die('SKIP php version so lower.');
}
require_once(dirname(__FILE__) . '/skip_mhash.inc'); ?>
?>
--FILE--
<?php
$ctx = hash_init('md5');
$filePath = __DIR__ . DIRECTORY_SEPARATOR . 'sha1.phpt';
fopen($filePath, "r");
var_dump(hash_update_file($ctx, $filePath));
hash_final($ctx);
?>
--EXPECT--
bool(true)
+23
View File
@@ -0,0 +1,23 @@
--TEST--
int hash_update_stream ( resource $context , resource $handle [, int $length = -1 ] );
--CREDITS--
marcosptf - <marcosptf@yahoo.com.br> - @phpsp - sao paulo - br
--SKIPIF--
<?php
if (phpversion() < "5.3.0") {
die('SKIP php version so lower.');
}
require_once(dirname(__FILE__) . '/skip_mhash.inc'); ?>
?>
--FILE--
<?php
$fp = tmpfile();
fwrite($fp, 'The quick brown fox jumped over the lazy dog.');
rewind($fp);
$ctx = hash_init('md5');
hash_update_stream($ctx, $fp);
echo hash_final($ctx);
?>
--EXPECT--
5c6ffbdd40d9556b73a21e63c3e0e904
+1 -1
View File
@@ -3934,7 +3934,7 @@ int _php_imap_mail(char *to, char *subject, char *message, char *headers, char *
char *tsm_errmsg = NULL;
ADDRESS *addr;
char *bufferTo = NULL, *bufferCc = NULL, *bufferBcc = NULL, *bufferHeader = NULL;
int offset, bufferLen = 0;
size_t offset, bufferLen = 0;
size_t bt_len;
if (headers) {
+13
View File
@@ -405,7 +405,10 @@ static void get_icu_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAMETERS)
if(loc_name_len == 0) {
loc_name = intl_locale_get_default();
loc_name_len = strlen(loc_name);
}
INTL_CHECK_LOCALE_LEN(loc_name_len);
/* Call ICU get */
tag_value = get_icu_value_internal( loc_name , tag_name , &result ,0);
@@ -1167,8 +1170,10 @@ PHP_FUNCTION(locale_get_all_variants)
if(loc_name_len == 0) {
loc_name = intl_locale_get_default();
loc_name_len = strlen(loc_name);
}
INTL_CHECK_LOCALE_LEN(loc_name_len);
array_init( return_value );
@@ -1271,12 +1276,16 @@ PHP_FUNCTION(locale_filter_matches)
if(loc_range_len == 0) {
loc_range = intl_locale_get_default();
loc_range_len = strlen(loc_range);
}
if( strcmp(loc_range,"*")==0){
RETURN_TRUE;
}
INTL_CHECK_LOCALE_LEN(loc_range_len);
INTL_CHECK_LOCALE_LEN(lang_tag_len);
if( boolCanonical ){
/* canonicalize loc_range */
can_loc_range=get_icu_value_internal( loc_range , LOC_CANONICALIZE_TAG , &result , 0);
@@ -1551,13 +1560,17 @@ PHP_FUNCTION(locale_lookup)
if(loc_range_len == 0) {
if(fallback_loc_str) {
loc_range = ZSTR_VAL(fallback_loc_str);
loc_range_len = ZSTR_LEN(fallback_loc_str);
} else {
loc_range = intl_locale_get_default();
loc_range_len = strlen(loc_range);
}
}
hash_arr = Z_ARRVAL_P(arr);
INTL_CHECK_LOCALE_LEN(loc_range_len);
if( !hash_arr || zend_hash_num_elements( hash_arr ) == 0 ) {
RETURN_EMPTY_STRING();
}
@@ -101,6 +101,13 @@ static int resourcebundle_ctor(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_constr
locale = intl_locale_get_default();
}
if (bundlename_len >= MAXPATHLEN) {
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "Bundle name too long", 0 );
zval_dtor(return_value);
ZVAL_NULL(return_value);
return FAILURE;
}
if (fallback) {
rb->me = ures_open(bundlename, locale, &INTL_DATA_ERROR_CODE(rb));
} else {
@@ -331,6 +338,11 @@ PHP_FUNCTION( resourcebundle_locales )
RETURN_FALSE;
}
if (bundlename_len >= MAXPATHLEN) {
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "resourcebundle_locales: bundle name too long", 0 );
RETURN_FALSE;
}
if(bundlename_len == 0) {
// fetch default locales list
bundlename = NULL;
+1 -3
View File
@@ -9,6 +9,4 @@ $out = locale_get_primary_language($var1);
echo strlen($out) . PHP_EOL;
echo unpack('H*', $out)[1] . PHP_EOL;
--EXPECT--
1000
61616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161
0
+1
View File
@@ -1299,6 +1299,7 @@ static void php_mcrypt_do_crypt(char* cipher, const char *key, size_t key_len, c
}
if (mcrypt_generic_init(td, (void *) key, (int)key_len, (void *) iv) < 0) {
efree(data_s);
php_error_docref(NULL, E_RECOVERABLE_ERROR, "Mcrypt initialisation failed");
mcrypt_module_close(td);
RETURN_FALSE;
+5
View File
@@ -1387,6 +1387,11 @@ void php_oci_bind_hash_dtor(zval *data)
{
php_oci_bind *bind = (php_oci_bind *) Z_PTR_P(data);
if (!Z_ISUNDEF(bind->parameter)) {
zval_ptr_dtor(&bind->parameter);
ZVAL_UNDEF(&bind->parameter);
}
if (bind->array.elements) {
efree(bind->array.elements);
bind->array.elements = NULL;
+1 -1
View File
@@ -110,7 +110,7 @@ PHP_FUNCTION(oci_bind_by_name)
zval *bind_var = NULL;
php_oci_statement *statement;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsz/|ll", &z_statement, &name, &name_len, &bind_var, &maxlen, &type) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsz|ll", &z_statement, &name, &name_len, &bind_var, &maxlen, &type) == FAILURE) {
return;
}
+38 -23
View File
@@ -1094,13 +1094,20 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, size_t name_l
int mode = OCI_DATA_AT_EXEC;
sb4 value_sz = -1;
sword errstatus;
zval *param = NULL;
if (!Z_ISREF_P(var)) {
param = var;
} else {
param = Z_REFVAL_P(var);
}
switch (type) {
case SQLT_NTY:
{
zval *tmp;
if (Z_TYPE_P(var) != IS_OBJECT || (tmp = zend_hash_str_find(Z_OBJPROP_P(var), "collection", sizeof("collection")-1)) == NULL) {
if (Z_TYPE_P(param) != IS_OBJECT || (tmp = zend_hash_str_find(Z_OBJPROP_P(param), "collection", sizeof("collection")-1)) == NULL) {
php_error_docref(NULL, E_WARNING, "Unable to find collection property");
return 1;
}
@@ -1122,7 +1129,7 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, size_t name_l
{
zval *tmp;
if (Z_TYPE_P(var) != IS_OBJECT || (tmp = zend_hash_str_find(Z_OBJPROP_P(var), "descriptor", sizeof("descriptor")-1)) == NULL) {
if (Z_TYPE_P(param) != IS_OBJECT || (tmp = zend_hash_str_find(Z_OBJPROP_P(param), "descriptor", sizeof("descriptor")-1)) == NULL) {
php_error_docref(NULL, E_WARNING, "Unable to find descriptor property");
return 1;
}
@@ -1141,17 +1148,17 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, size_t name_l
case SQLT_INT:
case SQLT_NUM:
if (Z_TYPE_P(var) == IS_RESOURCE || Z_TYPE_P(var) == IS_OBJECT) {
if (Z_TYPE_P(param) == IS_RESOURCE || Z_TYPE_P(param) == IS_OBJECT) {
php_error_docref(NULL, E_WARNING, "Invalid variable used for bind");
return 1;
}
convert_to_long(var);
convert_to_long(param);
#if defined(OCI_MAJOR_VERSION) && (OCI_MAJOR_VERSION > 10) && \
(defined(__x86_64__) || defined(__LP64__) || defined(_LP64) || defined(_WIN64))
bind_data = (ub8 *)&Z_LVAL_P(var);
bind_data = (ub8 *)&Z_LVAL_P(param);
value_sz = sizeof(ub8);
#else
bind_data = (ub4 *)&Z_LVAL_P(var);
bind_data = (ub4 *)&Z_LVAL_P(param);
value_sz = sizeof(ub4);
#endif
mode = OCI_DEFAULT;
@@ -1162,20 +1169,20 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, size_t name_l
case SQLT_LNG:
case SQLT_AFC:
case SQLT_CHR: /* SQLT_CHR is the default value when type was not specified */
if (Z_TYPE_P(var) == IS_RESOURCE || Z_TYPE_P(var) == IS_OBJECT) {
if (Z_TYPE_P(param) == IS_RESOURCE || Z_TYPE_P(param) == IS_OBJECT) {
php_error_docref(NULL, E_WARNING, "Invalid variable used for bind");
return 1;
}
if (Z_TYPE_P(var) != IS_NULL) {
convert_to_string(var);
if (Z_TYPE_P(param) != IS_NULL) {
convert_to_string(param);
}
if ((maxlength == -1) || (maxlength == 0)) {
if (type == SQLT_LNG) {
value_sz = SB4MAXVAL;
} else if (Z_TYPE_P(var) == IS_STRING) {
value_sz = (sb4) Z_STRLEN_P(var);
} else if (Z_TYPE_P(param) == IS_STRING) {
value_sz = (sb4) Z_STRLEN_P(param);
} else {
/* Bug-72524: revert value_sz from PHP_OCI_PIECE_SIZE to 0. This restores PHP 5.6 behavior */
/* Bug-72524: revert value_sz from PHP_OCI_PIECE_SIZE to 0. This restores PHP 5.6 behavior */
value_sz = 0;
}
} else {
@@ -1184,11 +1191,11 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, size_t name_l
break;
case SQLT_RSET:
if (Z_TYPE_P(var) != IS_RESOURCE) {
if (Z_TYPE_P(param) != IS_RESOURCE) {
php_error_docref(NULL, E_WARNING, "Invalid variable used for bind");
return 1;
}
PHP_OCI_ZVAL_TO_STATEMENT_EX(var, bind_statement);
PHP_OCI_ZVAL_TO_STATEMENT_EX(param, bind_statement);
value_sz = sizeof(void*);
oci_stmt = bind_statement->stmt;
@@ -1200,15 +1207,15 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, size_t name_l
#if defined(OCI_MAJOR_VERSION) && OCI_MAJOR_VERSION >= 12
case SQLT_BOL:
if (Z_TYPE_P(var) == IS_RESOURCE || Z_TYPE_P(var) == IS_OBJECT) {
if (Z_TYPE_P(param) == IS_RESOURCE || Z_TYPE_P(param) == IS_OBJECT) {
php_error_docref(NULL, E_WARNING, "Invalid variable used for bind");
return 1;
}
convert_to_boolean(var);
bind_data = (zend_long *)&Z_LVAL_P(var);
if (Z_TYPE_P(var) == IS_TRUE)
convert_to_boolean(param);
bind_data = (zend_long *)&Z_LVAL_P(param);
if (Z_TYPE_P(param) == IS_TRUE)
*(zend_long *)bind_data = 1;
else if (Z_TYPE_P(var) == IS_FALSE)
else if (Z_TYPE_P(param) == IS_FALSE)
*(zend_long *)bind_data = 0;
else {
php_error_docref(NULL, E_WARNING, "Invalid variable used for bind");
@@ -1234,6 +1241,10 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, size_t name_l
if ((old_bind = zend_hash_str_find_ptr(statement->binds, name, name_len)) != NULL) {
bindp = old_bind;
if (!Z_ISUNDEF(bindp->parameter)) {
zval_ptr_dtor(&bindp->parameter);
ZVAL_UNDEF(&bindp->parameter);
}
} else {
zend_string *zvtmp;
zvtmp = zend_string_init(name, name_len, 0);
@@ -1241,16 +1252,20 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, size_t name_l
bindp = zend_hash_update_ptr(statement->binds, zvtmp, bindp);
zend_string_release(zvtmp);
}
/* Make sure the minimum of value_sz is 1 to avoid ORA-3149
* when both in/out parameters are bound with empty strings
*/
/* Keep a copy of bound variable in the bind hash */
ZVAL_COPY(&bindp->parameter, var);
/* Make sure the minimum of value_sz is 1 to avoid ORA-3149
* when both in/out parameters are bound with empty strings
*/
if (value_sz == 0)
value_sz = 1;
bindp->descriptor = oci_desc;
bindp->statement = oci_stmt;
bindp->parent_statement = statement;
bindp->zval = var;
bindp->zval = param;
bindp->type = type;
/* Storing max length set in OCIBindByName() to check it later in
* php_oci_bind_in_callback() function to avoid ORA-1406 error while
+21 -5
View File
@@ -46,12 +46,12 @@ Interoperability Support" (ID 207303.1) for details.
<active>no</active>
</lead>
<date>2016-08-18</date>
<date>2016-10-17</date>
<time>12:00:00</time>
<version>
<release>2.1.2</release>
<api>2.1.2</api>
<release>2.1.3</release>
<api>2.1.3</api>
</version>
<stability>
<release>stable</release>
@@ -60,8 +60,7 @@ Interoperability Support" (ID 207303.1) for details.
<license uri="http://www.php.net/license">PHP</license>
<notes>
This version is for PHP 7 only.
Fixed invalid handle error with Implicit Result Sets
Fixed bug #72524 (Binding null values triggers ORA-24816 error)
Fixed bug #71148 (Bind reference overwritten on PHP 7)
</notes>
<contents>
<dir name="/">
@@ -469,6 +468,23 @@ Fixed bug #72524 (Binding null values triggers ORA-24816 error)
</extsrcrelease>
<changelog>
<release>
<version>
<release>2.1.2</release>
<api>2.1.2</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<license uri="http://www.php.net/license">PHP</license>
<notes>
This version is for PHP 7 only.
Fixed invalid handle error with Implicit Result Sets
Fixed bug #72524 (Binding null values triggers ORA-24816 error)
</notes>
</release>
<release>
<version>
<release>2.1.1</release>
+1 -1
View File
@@ -43,7 +43,7 @@
*/
#undef PHP_OCI8_VERSION
#endif
#define PHP_OCI8_VERSION "2.1.2"
#define PHP_OCI8_VERSION "2.1.3"
extern zend_module_entry oci8_module_entry;
#define phpext_oci8_ptr &oci8_module_entry
+1
View File
@@ -243,6 +243,7 @@ typedef struct {
typedef struct {
OCIBind *bind; /* bind handle */
zval *zval; /* value */
zval parameter; /* a copy of bound variable used for oci_bind_by_name */
dvoid *descriptor; /* used for binding of LOBS etc */
OCIStmt *statement; /* used for binding REFCURSORs */
php_oci_statement *parent_statement; /* pointer to the parent statement */
+191
View File
@@ -0,0 +1,191 @@
--TEST--
Bug #71448 (Binding reference overwritten on php7)
--SKIPIF--
<?php
$target_dbs = array('oracledb' => true, 'timesten' => true); // test runs on these DBs
require(dirname(__FILE__).'/skipif.inc');
?>
--FILE--
<?php
require(dirname(__FILE__).'/connect.inc');
// Initialize
$stmtarray = array(
"CREATE OR REPLACE FUNCTION bindfunc(var1 varchar2, var2 varchar2)
RETURN varchar2
AS var3 VARCHAR2(20);
BEGIN
var3 := CONCAT(var1, var2);
RETURN var3;
END;",
"CREATE OR REPLACE PROCEDURE bindproc(var1 IN string, var2 IN string, var3 IN OUT string) IS
BEGIN
var3 := CONCAT(var1, var3);
var3 := CONCAT(var3, var2);
END;"
);
oci8_test_sql_execute($c, $stmtarray);
// Run test
function bindvar($stmt, $name, $var)
{
oci_bind_by_name($stmt, $name, $var);
}
// Test 1: Bind input parameter in a local function
$sql = "select :var1, :var2 from dual";
$cache1 = "INSTR1";
$cache2 = "INSTR2";
echo "Test 1: Bind input parameter in a local function\n";
$stmt = oci_parse($c, $sql);
bindvar($stmt, ':var1', $cache1);
bindvar($stmt, ':var2', $cache2);
oci_execute($stmt);
var_dump(oci_fetch_assoc($stmt));
oci_free_statement($stmt);
// Test 2: Bind output parameter in a local function
$sql = "begin :output1 := 'OUTSTR1'; :output2 := 'OUTSTR2'; end;";
$cache1 = "xxxxxx";
$cache2 = "xxxxxx";
echo "\nTest 2: Bind output parameter in a local function\n";
$stmt = oci_parse($c, $sql);
bindvar($stmt, ':output1', $cache1);
bindvar($stmt, ':output2', $cache2);
oci_execute($stmt);
var_dump($cache1);
var_dump($cache2);
oci_free_statement($stmt);
// Test 3: Bind output parameter within the same scope of execute
$sql = "begin :output1 := 'OUTSTR1'; :output2 := 'OUTSTR2'; end;";
$cache1 = "xxxxxx";
$cache2 = "xxxxxx";
echo "\nTest 3: Bind output parameter within the same scope of execute\n";
$stmt = oci_parse($c, $sql);
oci_bind_by_name($stmt, ":output1", $cache1);
oci_bind_by_name($stmt, ":output2", $cache2);
oci_execute($stmt);
var_dump($cache1);
var_dump($cache2);
oci_free_statement($stmt);
// Test 4: Bind output parameter within the same scope of execute
$sql= "begin :output := bindfunc(:var1, :var2); end;";
$cache1 = "STR1";
$cache2 = "STR2";
echo "\nTest 4: Bind output parameter within the same scope of execute\n";
$stmt = oci_parse($c, $sql);
oci_bind_by_name($stmt, ":var1", $cache1, -1);
oci_bind_by_name($stmt, ":var2", $cache2, -1);
oci_bind_by_name($stmt, ":output", $cache3, 100);
oci_execute($stmt);
var_dump($cache3);
// Test 5: Bind IN OUT parameter in a local function
$sql = "call bindproc(:var1, :var2, :var3)";
$cache1 = 'STR1';
$cache2 = 'STR2';
$cache3 = ' ';
echo "\nTest 5: Bind IN OUT parameter in a local function\n";
$stmt = oci_parse($c, $sql);
bindvar($stmt, ':var1', $cache1);
bindvar($stmt, ':var2', $cache2);
bindvar($stmt, ':var3', $cache3);
oci_execute($stmt);
var_dump($cache1);
var_dump($cache2);
var_dump($cache3);
oci_free_statement($stmt);
// Test 6: Bind IN OUT parameter within the same scope of execute
$sql = "call bindproc(:var1, :var2, :var3)";
$cache1 = 'STR1';
$cache2 = 'STR2';
$cache3 = ' ';
echo "\nTest 6: Bind IN OUT parameter within the same scope of execute\n";
$stmt = oci_parse($c, $sql);
oci_bind_by_name($stmt, ":var1", $cache1, -1);
oci_bind_by_name($stmt, ":var2", $cache2, -1);
oci_bind_by_name($stmt, ":var3", $cache3, 100);
oci_execute($stmt);
var_dump($cache1);
var_dump($cache2);
var_dump($cache3);
// Cleanup
$stmtarray = array(
"DROP FUNCTION bindfunc",
"DROP PROCEDURE bindproc"
);
oci8_test_sql_execute($c, $stmtarray);
?>
===DONE===
<?php exit(0); ?>
--EXPECT--
Test 1: Bind input parameter in a local function
array(2) {
[":VAR1"]=>
string(6) "INSTR1"
[":VAR2"]=>
string(6) "INSTR2"
}
Test 2: Bind output parameter in a local function
string(6) "xxxxxx"
string(6) "xxxxxx"
Test 3: Bind output parameter within the same scope of execute
string(7) "OUTSTR1"
string(7) "OUTSTR2"
Test 4: Bind output parameter within the same scope of execute
string(8) "STR1STR2"
Test 5: Bind IN OUT parameter in a local function
string(4) "STR1"
string(4) "STR2"
string(1) " "
Test 6: Bind IN OUT parameter within the same scope of execute
string(4) "STR1"
string(4) "STR2"
string(9) "STR1 STR2"
===DONE===
+3 -3
View File
@@ -57,11 +57,11 @@ function get_attr($conn)
?>
--EXPECT--
**Test 1.1 - Default values for the attribute **************
The value of DRIVER_NAME is PHP OCI8 : 2.1.2
The value of DRIVER_NAME is PHP OCI8 : 2.1.3
***Test 1.2 - Get the values from different connections **************
Testing with oci_pconnect()
The value of DRIVER_NAME is PHP OCI8 : 2.1.2
The value of DRIVER_NAME is PHP OCI8 : 2.1.3
Testing with oci_new_connect()
The value of DRIVER_NAME is PHP OCI8 : 2.1.2
The value of DRIVER_NAME is PHP OCI8 : 2.1.3
Done
+21 -6
View File
@@ -619,27 +619,42 @@ static void accel_use_shm_interned_strings(void)
#ifndef ZEND_WIN32
static inline void kill_all_lockers(struct flock *mem_usage_check)
{
int tries = 10;
int success, tries;
/* so that other process won't try to force while we are busy cleaning up */
ZCSG(force_restart_time) = 0;
while (mem_usage_check->l_pid > 0) {
/* Clear previous errno, reset success and tries */
errno = 0;
success = 0;
tries = 10;
while (tries--) {
zend_accel_error(ACCEL_LOG_WARNING, "Killed locker %d", mem_usage_check->l_pid);
zend_accel_error(ACCEL_LOG_WARNING, "Attempting to kill locker %d", mem_usage_check->l_pid);
if (kill(mem_usage_check->l_pid, SIGKILL)) {
if (errno == ESRCH) {
/* Process died before the signal was sent */
success = 1;
zend_accel_error(ACCEL_LOG_WARNING, "Process %d died before SIGKILL was sent", mem_usage_check->l_pid);
}
break;
}
/* give it a chance to die */
usleep(20000);
if (kill(mem_usage_check->l_pid, 0)) {
/* can't kill it */
if (errno == ESRCH) {
/* successfully killed locker, process no longer exists */
success = 1;
zend_accel_error(ACCEL_LOG_WARNING, "Killed locker %d", mem_usage_check->l_pid);
}
break;
}
usleep(10000);
}
if (!tries) {
zend_accel_error(ACCEL_LOG_WARNING, "Can't kill %d after 10 tries!", mem_usage_check->l_pid);
if (!success) {
/* errno is not ESRCH or we ran out of tries to kill the locker */
ZCSG(force_restart_time) = time(NULL); /* restore forced restart request */
/* cannot kill the locker, bail out with error */
zend_accel_error(ACCEL_LOG_ERROR, "Cannot kill process %d: %s!", mem_usage_check->l_pid, strerror(errno));
}
mem_usage_check->l_type = F_WRLCK;
+19
View File
@@ -0,0 +1,19 @@
--TEST--
Test ACCEL_LOG_FATAL will cause the process to die even if not logged
--DESCRIPTION--
This test forces the opcache to error by setting memory_comsumption very large.
The resulting ACCEL_LOG_FATAL should cause php to die.
The process should die regardless of the log_verbosity_level.
--INI--
opcache.enable=1
opcache.enable_cli=1
opcache.memory_consumption=999999999
opcache.log_verbosity_level=-1
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
var_dump("Script should fail");
?>
--EXPECTF--
+35 -33
View File
@@ -30,22 +30,20 @@
void zend_accel_error(int type, const char *format, ...)
{
va_list args;
va_list args;
time_t timestamp;
char *time_string;
FILE * fLog = NULL;
if (type > ZCG(accel_directives).log_verbosity_level) {
return;
}
if (type <= ZCG(accel_directives).log_verbosity_level) {
timestamp = time(NULL);
time_string = asctime(localtime(&timestamp));
time_string[24] = 0;
if (!ZCG(accel_directives).error_log ||
!*ZCG(accel_directives).error_log ||
strcmp(ZCG(accel_directives).error_log, "stderr") == 0) {
!*ZCG(accel_directives).error_log ||
strcmp(ZCG(accel_directives).error_log, "stderr") == 0) {
fLog = stderr;
} else {
@@ -56,33 +54,40 @@ void zend_accel_error(int type, const char *format, ...)
}
#ifdef ZTS
fprintf(fLog, "%s (" ZEND_ULONG_FMT "): ", time_string, (zend_ulong)tsrm_thread_id());
fprintf(fLog, "%s (" ZEND_ULONG_FMT "): ", time_string, (zend_ulong)tsrm_thread_id());
#else
fprintf(fLog, "%s (%d): ", time_string, getpid());
fprintf(fLog, "%s (%d): ", time_string, getpid());
#endif
switch (type) {
case ACCEL_LOG_FATAL:
fprintf(fLog, "Fatal Error ");
break;
case ACCEL_LOG_ERROR:
fprintf(fLog, "Error ");
break;
case ACCEL_LOG_WARNING:
fprintf(fLog, "Warning ");
break;
case ACCEL_LOG_INFO:
fprintf(fLog, "Message ");
break;
case ACCEL_LOG_DEBUG:
fprintf(fLog, "Debug ");
break;
}
switch (type) {
case ACCEL_LOG_FATAL:
fprintf(fLog, "Fatal Error ");
break;
case ACCEL_LOG_ERROR:
fprintf(fLog, "Error ");
break;
case ACCEL_LOG_WARNING:
fprintf(fLog, "Warning ");
break;
case ACCEL_LOG_INFO:
fprintf(fLog, "Message ");
break;
case ACCEL_LOG_DEBUG:
fprintf(fLog, "Debug ");
break;
}
va_start(args, format);
vfprintf(fLog, format, args);
va_end(args);
fprintf(fLog, "\n");
va_start(args, format);
vfprintf(fLog, format, args);
va_end(args);
fprintf(fLog, "\n");
fflush(fLog);
if (fLog != stderr) {
fclose(fLog);
}
}
/* perform error handling even without logging the error */
switch (type) {
case ACCEL_LOG_ERROR:
zend_bailout();
@@ -91,8 +96,5 @@ void zend_accel_error(int type, const char *format, ...)
exit(-2);
break;
}
fflush(fLog);
if (fLog != stderr) {
fclose(fLog);
}
}
+15 -9
View File
@@ -5303,7 +5303,8 @@ PHP_FUNCTION(openssl_encrypt)
size_t data_len, method_len, password_len, iv_len = 0, max_iv_len;
const EVP_CIPHER *cipher_type;
EVP_CIPHER_CTX cipher_ctx;
int i=0, outlen, keylen;
int i=0, keylen;
size_t outlen;
zend_string *outbuf;
unsigned char *key;
zend_bool free_iv;
@@ -5334,7 +5335,7 @@ PHP_FUNCTION(openssl_encrypt)
}
free_iv = php_openssl_validate_iv(&iv, &iv_len, max_iv_len);
outlen = (int)data_len + EVP_CIPHER_block_size(cipher_type);
outlen = data_len + EVP_CIPHER_block_size(cipher_type);
outbuf = zend_string_alloc(outlen, 0);
EVP_EncryptInit(&cipher_ctx, cipher_type, NULL, NULL);
@@ -5386,7 +5387,8 @@ PHP_FUNCTION(openssl_decrypt)
size_t data_len, method_len, password_len, iv_len = 0;
const EVP_CIPHER *cipher_type;
EVP_CIPHER_CTX cipher_ctx;
int i, outlen, keylen;
int i, keylen;
size_t outlen;
zend_string *outbuf;
unsigned char *key;
zend_string *base64_str = NULL;
@@ -5410,7 +5412,7 @@ PHP_FUNCTION(openssl_decrypt)
}
if (!(options & OPENSSL_RAW_DATA)) {
base64_str = php_base64_decode((unsigned char*)data, (int)data_len);
base64_str = php_base64_decode((unsigned char*)data, data_len);
if (!base64_str) {
php_error_docref(NULL, E_WARNING, "Failed to base64 decode the input");
RETURN_FALSE;
@@ -5430,7 +5432,7 @@ PHP_FUNCTION(openssl_decrypt)
free_iv = php_openssl_validate_iv(&iv, &iv_len, EVP_CIPHER_iv_length(cipher_type));
outlen = (int)data_len + EVP_CIPHER_block_size(cipher_type);
outlen = data_len + EVP_CIPHER_block_size(cipher_type);
outbuf = zend_string_alloc(outlen, 0);
EVP_DecryptInit(&cipher_ctx, cipher_type, NULL, NULL);
@@ -5546,15 +5548,18 @@ PHP_FUNCTION(openssl_random_pseudo_bytes)
return;
}
if (buffer_length <= 0) {
RETURN_FALSE;
}
if (zstrong_result_returned) {
zval_dtor(zstrong_result_returned);
ZVAL_FALSE(zstrong_result_returned);
}
if (buffer_length <= 0
#ifndef PHP_WIN32
|| ZEND_LONG_INT_OVFL(buffer_length)
#endif
) {
RETURN_FALSE;
}
buffer = zend_string_alloc(buffer_length, 0);
#ifdef PHP_WIN32
@@ -5570,6 +5575,7 @@ PHP_FUNCTION(openssl_random_pseudo_bytes)
PHP_OPENSSL_CHECK_LONG_TO_INT(buffer_length, length);
PHP_OPENSSL_RAND_ADD_TIME();
/* FIXME loop if requested size > INT_MAX */
if (RAND_bytes((unsigned char*)ZSTR_VAL(buffer), (int)buffer_length) <= 0) {
zend_string_release(buffer);
if (zstrong_result_returned) {
+77
View File
@@ -0,0 +1,77 @@
--TEST--
void openssl_free_key ( resource $key_identifier );
--CREDITS--
marcosptf - <marcosptf@yahoo.com.br> - @phpsp - sao paulo - br
--SKIPIF--
<?php
if (!extension_loaded("openssl"))
die("skip");
if (!@openssl_pkey_new())
die("skip cannot create private key");
?>
--FILE--
<?php
echo "Creating private key\n";
/* stack up some entropy; performance is not critical,
* and being slow will most likely even help the test.
*/
for ($z = "", $i = 0; $i < 1024; $i++) {
$z .= $i * $i;
if (function_exists("usleep"))
usleep($i);
}
$privkey = openssl_pkey_new();
if ($privkey === false)
die("failed to create private key");
$passphrase = "banana";
$key_file_name = tempnam("/tmp", "ssl");
if ($key_file_name === false)
die("failed to get a temporary filename!");
echo "Export key to file\n";
openssl_pkey_export_to_file($privkey, $key_file_name, $passphrase) or die("failed to export to file $key_file_name");
echo "Load key from file - array syntax\n";
$loaded_key = openssl_pkey_get_private(array("file://$key_file_name", $passphrase));
if ($loaded_key === false)
die("failed to load key using array syntax");
openssl_free_key($loaded_key);
echo "Load key using direct syntax\n";
$loaded_key = openssl_pkey_get_private("file://$key_file_name", $passphrase);
if ($loaded_key === false)
die("failed to load key using direct syntax");
openssl_free_key($loaded_key);
echo "Load key manually and use string syntax\n";
$key_content = file_get_contents($key_file_name);
$loaded_key = openssl_pkey_get_private($key_content, $passphrase);
if ($loaded_key === false)
die("failed to load key using string syntax");
openssl_free_key($loaded_key);
echo "OK!\n";
@unlink($key_file_name);
?>
--EXPECT--
Creating private key
Export key to file
Load key from file - array syntax
Load key using direct syntax
Load key manually and use string syntax
OK!
+16 -18
View File
@@ -88,7 +88,7 @@ static void pcre_handle_exec_error(int pcre_code) /* {{{ */
case PCRE_ERROR_BADUTF8_OFFSET:
preg_code = PHP_PCRE_BAD_UTF8_OFFSET_ERROR;
break;
#ifdef HAVE_PCRE_JIT_SUPPORT
case PCRE_ERROR_JIT_STACKLIMIT:
preg_code = PHP_PCRE_JIT_STACKLIMIT_ERROR;
@@ -925,7 +925,7 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, int subjec
to achieve this, unless we're already at the end of the string. */
if (g_notempty != 0 && start_offset < subject_len) {
int unit_len = calculate_unit_length(pce, subject + start_offset);
offsets[0] = (int)start_offset;
offsets[1] = (int)(start_offset + unit_len);
} else
@@ -1125,7 +1125,6 @@ PHPAPI zend_string *php_pcre_replace_impl(pcre_cache_entry *pce, zend_string *su
int backref; /* Backreference number */
int start_offset; /* Where the new search starts */
int g_notempty=0; /* If the match should not be empty */
int replace_len=0; /* Length of replacement string */
char *replace=NULL, /* Replacement string */
*walkbuf, /* Location of current replacement in the result */
*walk, /* Used to walk the replacement string */
@@ -1133,7 +1132,7 @@ PHPAPI zend_string *php_pcre_replace_impl(pcre_cache_entry *pce, zend_string *su
*piece, /* The current piece of subject */
*replace_end=NULL, /* End of replacement string */
walk_last; /* Last walked character */
int result_len; /* Length of result */
size_t result_len; /* Length of result */
unsigned char *mark = NULL; /* Target for MARK name */
zend_string *result; /* Result of replacement */
zend_string *eval_result=NULL; /* Result of custom function */
@@ -1155,8 +1154,7 @@ PHPAPI zend_string *php_pcre_replace_impl(pcre_cache_entry *pce, zend_string *su
if (!is_callable_replace) {
replace = Z_STRVAL_P(replace_val);
replace_len = (int)Z_STRLEN_P(replace_val);
replace_end = replace + replace_len;
replace_end = replace + Z_STRLEN_P(replace_val);
}
/* Calculate the size of the offsets array, and allocate memory for it. */
@@ -1224,7 +1222,7 @@ PHPAPI zend_string *php_pcre_replace_impl(pcre_cache_entry *pce, zend_string *su
match = subject + offsets[0];
new_len = result_len + offsets[0] - start_offset; /* part before the match */
/* if (!is_callable_replace) */
if (EXPECTED(replace)) {
/* do regular substitution */
@@ -1250,7 +1248,7 @@ PHPAPI zend_string *php_pcre_replace_impl(pcre_cache_entry *pce, zend_string *su
}
if (new_len >= alloc_len) {
alloc_len = alloc_len + 2 * new_len;
alloc_len = zend_safe_address_guarded(2, new_len, alloc_len);
if (result == NULL) {
result = zend_string_alloc(alloc_len, 0);
} else {
@@ -1260,7 +1258,7 @@ PHPAPI zend_string *php_pcre_replace_impl(pcre_cache_entry *pce, zend_string *su
/* copy the part of the string before the match */
memcpy(&ZSTR_VAL(result)[result_len], piece, match-piece);
result_len += (int)(match-piece);
result_len += (match-piece);
/* copy replacement and backrefs */
walkbuf = ZSTR_VAL(result) + result_len;
@@ -1288,14 +1286,14 @@ PHPAPI zend_string *php_pcre_replace_impl(pcre_cache_entry *pce, zend_string *su
}
*walkbuf = '\0';
/* increment the result length by how much we've added to the string */
result_len += (int)(walkbuf - (ZSTR_VAL(result) + result_len));
result_len += (walkbuf - (ZSTR_VAL(result) + result_len));
} else {
/* Use custom function to get replacement string and its length. */
eval_result = preg_do_repl_func(replace_val, subject, offsets, subpat_names, count, mark);
ZEND_ASSERT(eval_result);
new_len += (int)ZSTR_LEN(eval_result);
new_len = zend_safe_address_guarded(1, ZSTR_LEN(eval_result), new_len);
if (new_len >= alloc_len) {
alloc_len = alloc_len + 2 * new_len;
alloc_len = zend_safe_address_guarded(2, new_len, alloc_len);
if (result == NULL) {
result = zend_string_alloc(alloc_len, 0);
} else {
@@ -1517,7 +1515,7 @@ static int preg_replace_impl(zval *return_value, zval *regex, zval *replace, zva
}
}
} ZEND_HASH_FOREACH_END();
} else {
} else {
/* if subject is not an array */
old_replace_count = replace_count;
if ((result = php_replace_in_subject(regex, replace, subject, limit_val, is_callable_replace, &replace_count)) != NULL) {
@@ -1528,7 +1526,7 @@ static int preg_replace_impl(zval *return_value, zval *regex, zval *replace, zva
}
}
}
return replace_count;
}
/* }}} */
@@ -1617,7 +1615,7 @@ static PHP_FUNCTION(preg_replace_callback_array)
Z_PARAM_LONG(limit)
Z_PARAM_ZVAL_EX(zcount, 0, 1)
ZEND_PARSE_PARAMETERS_END();
ZVAL_UNDEF(&zv);
ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(pattern), str_idx, replace) {
if (str_idx) {
@@ -1626,7 +1624,7 @@ static PHP_FUNCTION(preg_replace_callback_array)
php_error_docref(NULL, E_WARNING, "Delimiter must not be alphanumeric or backslash");
zval_ptr_dtor(return_value);
RETURN_NULL();
}
}
if (!zend_is_callable(replace, 0, &callback_name)) {
php_error_docref(NULL, E_WARNING, "'%s' is not a valid callback", ZSTR_VAL(callback_name));
@@ -1648,14 +1646,14 @@ static PHP_FUNCTION(preg_replace_callback_array)
zval_ptr_dtor(&regex);
if (Z_ISUNDEF(zv)) {
RETURN_NULL();
RETURN_NULL();
}
ZVAL_COPY_VALUE(return_value, &zv);
if (UNEXPECTED(EG(exception))) {
zval_ptr_dtor(return_value);
RETURN_NULL();
RETURN_NULL();
}
} ZEND_HASH_FOREACH_END();
+1
View File
@@ -2299,6 +2299,7 @@ void pdo_stmt_init(void)
pdo_row_ce->ce_flags |= ZEND_ACC_FINAL; /* when removing this a lot of handlers need to be redone */
pdo_row_ce->create_object = pdo_row_new;
pdo_row_ce->serialize = pdo_row_serialize;
pdo_row_ce->unserialize = zend_class_unserialize_deny;
}
PDO_API void php_pdo_free_statement(pdo_stmt_t *stmt)
+21 -18
View File
@@ -159,19 +159,14 @@ static int php_session_destroy(void) /* {{{ */
PHPAPI void php_add_session_var(zend_string *name) /* {{{ */
{
zval *sym_track = NULL;
IF_SESSION_VARS() {
sym_track = zend_hash_find(Z_ARRVAL_P(Z_REFVAL(PS(http_session_vars))), name);
} else {
return;
}
if (sym_track == NULL) {
zval empty_var;
ZVAL_NULL(&empty_var);
zend_hash_update(Z_ARRVAL_P(Z_REFVAL(PS(http_session_vars))), name, &empty_var);
zval *sess_var = Z_REFVAL(PS(http_session_vars));
SEPARATE_ARRAY(sess_var);
if (!zend_hash_exists(Z_ARRVAL_P(sess_var), name)) {
zval empty_var;
ZVAL_NULL(&empty_var);
zend_hash_update(Z_ARRVAL_P(sess_var), name, &empty_var);
}
}
}
/* }}} */
@@ -179,7 +174,9 @@ PHPAPI void php_add_session_var(zend_string *name) /* {{{ */
PHPAPI zval* php_set_session_var(zend_string *name, zval *state_val, php_unserialize_data_t *var_hash) /* {{{ */
{
IF_SESSION_VARS() {
return zend_hash_update(Z_ARRVAL_P(Z_REFVAL(PS(http_session_vars))), name, state_val);
zval *sess_var = Z_REFVAL(PS(http_session_vars));
SEPARATE_ARRAY(sess_var);
return zend_hash_update(Z_ARRVAL_P(sess_var), name, state_val);
}
return NULL;
}
@@ -2386,10 +2383,11 @@ static PHP_FUNCTION(session_unset)
}
IF_SESSION_VARS() {
HashTable *ht_sess_var = Z_ARRVAL_P(Z_REFVAL(PS(http_session_vars)));
zval *sess_var = Z_REFVAL(PS(http_session_vars));
SEPARATE_ARRAY(sess_var);
/* Clean $_SESSION. */
zend_hash_clean(ht_sess_var);
zend_hash_clean(Z_ARRVAL_P(sess_var));
}
}
/* }}} */
@@ -2923,9 +2921,12 @@ static void php_session_rfc1867_update(php_session_rfc1867_progress *progress, i
php_session_initialize();
PS(session_status) = php_session_active;
IF_SESSION_VARS() {
zval *sess_var = Z_REFVAL(PS(http_session_vars));
SEPARATE_ARRAY(sess_var);
progress->cancel_upload |= php_check_cancel_upload(progress);
if (Z_REFCOUNTED(progress->data)) Z_ADDREF(progress->data);
zend_hash_update(Z_ARRVAL_P(Z_REFVAL(PS(http_session_vars))), progress->key.s, &progress->data);
Z_TRY_ADDREF(progress->data);
zend_hash_update(Z_ARRVAL_P(sess_var), progress->key.s, &progress->data);
}
php_session_flush(1);
} /* }}} */
@@ -2935,7 +2936,9 @@ static void php_session_rfc1867_cleanup(php_session_rfc1867_progress *progress)
php_session_initialize();
PS(session_status) = php_session_active;
IF_SESSION_VARS() {
zend_hash_del(Z_ARRVAL_P(Z_REFVAL(PS(http_session_vars))), progress->key.s);
zval *sess_var = Z_REFVAL(PS(http_session_vars));
SEPARATE_ARRAY(sess_var);
zend_hash_del(Z_ARRVAL_P(sess_var), progress->key.s);
}
php_session_flush(1);
} /* }}} */
+17
View File
@@ -0,0 +1,17 @@
--TEST--
Bug #73273: session_unset() empties values from all variables in which is $_session stored
--SKIPIF--
<?php include('skipif.inc'); ?>
--FILE--
<?php
session_start();
$_SESSION['test'] = true;
$var = $_SESSION;
session_unset();
var_dump($var);
?>
--EXPECT--
array(1) {
["test"]=>
bool(true)
}
+6 -6
View File
@@ -142,7 +142,7 @@ PHP_MINFO_FUNCTION(shmop)
}
/* }}} */
/* {{{ proto int shmop_open (int key, string flags, int mode, int size)
/* {{{ proto resource shmop_open (int key, string flags, int mode, int size)
gets and attaches a shared memory segment */
PHP_FUNCTION(shmop_open)
{
@@ -223,7 +223,7 @@ err:
}
/* }}} */
/* {{{ proto string shmop_read (int shmid, int start, int count)
/* {{{ proto string shmop_read (resource shmid, int start, int count)
reads from a shm segment */
PHP_FUNCTION(shmop_read)
{
@@ -261,7 +261,7 @@ PHP_FUNCTION(shmop_read)
}
/* }}} */
/* {{{ proto void shmop_close (int shmid)
/* {{{ proto void shmop_close (resource shmid)
closes a shared memory segment */
PHP_FUNCTION(shmop_close)
{
@@ -281,7 +281,7 @@ PHP_FUNCTION(shmop_close)
}
/* }}} */
/* {{{ proto int shmop_size (int shmid)
/* {{{ proto int shmop_size (resource shmid)
returns the shm size */
PHP_FUNCTION(shmop_size)
{
@@ -300,7 +300,7 @@ PHP_FUNCTION(shmop_size)
}
/* }}} */
/* {{{ proto int shmop_write (int shmid, string data, int offset)
/* {{{ proto int shmop_write (resource shmid, string data, int offset)
writes to a shared memory segment */
PHP_FUNCTION(shmop_write)
{
@@ -335,7 +335,7 @@ PHP_FUNCTION(shmop_write)
}
/* }}} */
/* {{{ proto bool shmop_delete (int shmid)
/* {{{ proto bool shmop_delete (resource shmid)
mark segment for deletion */
PHP_FUNCTION(shmop_delete)
{
+16 -3
View File
@@ -1472,9 +1472,15 @@ SXE_METHOD(asXML)
if (node) {
if (node->parent && (XML_DOCUMENT_NODE == node->parent->type)) {
xmlDocDumpMemoryEnc((xmlDocPtr) sxe->document->ptr, &strval, &strval_len, (const char *) ((xmlDocPtr) sxe->document->ptr)->encoding);
RETVAL_STRINGL((char *)strval, strval_len);
if (!strval) {
RETVAL_FALSE;
} else {
RETVAL_STRINGL((char *)strval, strval_len);
}
xmlFree(strval);
} else {
char *return_content;
size_t return_len;
/* Should we be passing encoding information instead of NULL? */
outbuf = xmlAllocOutputBuffer(NULL);
@@ -1485,10 +1491,17 @@ SXE_METHOD(asXML)
xmlNodeDumpOutput(outbuf, (xmlDocPtr) sxe->document->ptr, node, 0, 0, (const char *) ((xmlDocPtr) sxe->document->ptr)->encoding);
xmlOutputBufferFlush(outbuf);
#ifdef LIBXML2_NEW_BUFFER
RETVAL_STRINGL((char *)xmlOutputBufferGetContent(outbuf), xmlOutputBufferGetSize(outbuf));
return_content = (char *)xmlOutputBufferGetContent(outbuf);
return_len = xmlOutputBufferGetSize(outbuf);
#else
RETVAL_STRINGL((char *)outbuf->buffer->content, outbuf->buffer->use);
return_content = (char *)outbuf->buffer->content;
return_len = outbuf->buffer->use;
#endif
if (!return_content) {
RETVAL_FALSE;
} else {
RETVAL_STRINGL(return_content, return_len);
}
xmlOutputBufferClose(outbuf);
}
} else {
+4 -2
View File
@@ -1230,7 +1230,7 @@ static void unset_zval_property(zval* object, char* name)
static void model_to_zval_any(zval *ret, xmlNodePtr node)
{
zval rv, arr, val;
zval rv, arr, val, keepVal;
zval* any = NULL;
char* name = NULL;
@@ -1259,6 +1259,7 @@ static void model_to_zval_any(zval *ret, xmlNodePtr node)
ZVAL_NULL(&val2);
master_to_zval(&val2, get_conversion(XSD_ANYXML), node->next);
if (Z_TYPE(val2) != IS_STRING || *Z_STRVAL(val) != '<') {
Z_TRY_DELREF(val2);
break;
}
concat_function(&val, &val, &val2);
@@ -1277,7 +1278,8 @@ static void model_to_zval_any(zval *ret, xmlNodePtr node)
any = &arr;
name = NULL;
} else {
any = &val;
ZVAL_COPY_VALUE(&keepVal, &val);
any = &keepVal;
}
} else {
/* Add array element */
+8 -1
View File
@@ -161,7 +161,7 @@ void http_context_headers(php_stream_context* context,
static php_stream* http_connect(zval* this_ptr, php_url *phpurl, int use_ssl, php_stream_context *context, int *use_proxy)
{
php_stream *stream;
zval *proxy_host, *proxy_port, *tmp;
zval *proxy_host, *proxy_port, *tmp, ssl_proxy_peer_name;
char *host;
char *name;
char *protocol;
@@ -241,6 +241,13 @@ static php_stream* http_connect(zval* this_ptr, php_url *phpurl, int use_ssl, ph
if (stream && *use_proxy && use_ssl) {
smart_str soap_headers = {0};
/* Set peer_name or name verification will try to use the proxy server name */
if (!context || (tmp = php_stream_context_get_option(context, "ssl", "peer_name")) == NULL) {
ZVAL_STRING(&ssl_proxy_peer_name, phpurl->host);
php_stream_context_set_option(PHP_STREAM_CONTEXT(stream), "ssl", "peer_name", &ssl_proxy_peer_name);
zval_ptr_dtor(&ssl_proxy_peer_name);
}
smart_str_append_const(&soap_headers, "CONNECT ");
smart_str_appends(&soap_headers, phpurl->host);
smart_str_appendc(&soap_headers, ':');
+2
View File
@@ -2368,6 +2368,8 @@ PHP_METHOD(SoapClient, SoapClient)
Z_TYPE_P(tmp) == IS_RESOURCE) {
context = php_stream_context_from_zval(tmp, 1);
Z_ADDREF_P(tmp);
} else {
context = php_stream_context_alloc();
}
if ((tmp = zend_hash_str_find(ht, "location", sizeof("location")-1)) != NULL &&
+46
View File
@@ -0,0 +1,46 @@
--TEST--
SOAP Bug #69137 - Peer verification fails when using a proxy with SoapClient
--SKIPIF--
<?php
require_once('skipif.inc');
if (getenv("SKIP_ONLINE_TESTS")) { die("skip test requiring internet connection"); }
if (!getenv('http_proxy')) { die("skip test unless an HTTP/HTTPS proxy server is specified in http_proxy environment variable"); }
?>
--INI--
soap.wsdl_cache_enabled=1
--FILE--
<?php
class IpLookup
{
public $licenseKey;
public $ipAddress;
}
list ($proxyHost, $proxyPort) = explode(':', str_replace('http://', '', $_ENV['http_proxy']));
// Prime the WSDL cache because that request sets peer_name on the HTTP context
// and masks the SOAP bug.
$testServiceWsdl = 'https://ws.cdyne.com/ip2geo/ip2geo.asmx?wsdl';
$client = new SoapClient($testServiceWsdl);
unset($client);
$parameters = [
'proxy_host' => $proxyHost,
'proxy_port' => $proxyPort,
'trace' => 1,
];
$client = new SoapClient($testServiceWsdl, $parameters);
$lookup = new IpLookup();
$lookup->licenseKey = 0;
$lookup->ipAddress = '72.52.91.14';
$result = $client->ResolveIP($lookup);
if ($result && is_object($result) && $result->ResolveIPResult && is_object($result->ResolveIPResult)) {
print "successful lookup";
}
?>
--EXPECT--
successful lookup
+180
View File
@@ -0,0 +1,180 @@
--TEST--
Bug #73037 SoapServer reports Bad Request when gzipped, var 0
--SKIPIF--
<?php
require_once('skipif.inc');
if (!extension_loaded("zlib")) {
echo "skip zlib is required for this test";
}
if (!file_exists(dirname(__FILE__) . "/../../../sapi/cli/tests/php_cli_server.inc")) {
echo "skip sapi/cli/tests/php_cli_server.inc required but not found";
}
?>
--FILE--
<?php
include dirname(__FILE__) . "/../../../sapi/cli/tests/php_cli_server.inc";
function get_data($max)
{
$piece = "<CD>
<TITLE>Empire Burlesque</TITLE>
<ARTIST>Bob Dylan</ARTIST>
<COUNTRY>USA</COUNTRY>
<COMPANY>Columbia</COMPANY>
<PRICE>10.90</PRICE>
<YEAR>1985</YEAR>
</CD>";
$begin = '<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><CATALOG>';
$end = '</CATALOG></soapenv:Body></soapenv:Envelope>';
$min = strlen($begin) + strlen($piece) + strlen($end);
$max = $max < $min ? $min : $max;
$data = $begin;
$data .= $piece;
while (strlen($data) + strlen($end) < $max) {
/* Randomize a bit, taking gzip in account. */
$tmp = str_replace(
array(
"Empire Burlesque",
"Bob Dylan",
),
array(
md5(uniqid()),
sha1(uniqid()),
),
$piece
);
if (strlen($begin) + strlen($tmp) + strlen($end) > $max) {
break;
}
$data .= $tmp;
}
$data .= $end;
return $data;
}
$router = "bug73037_server.php";
$args = substr(PHP_OS, 0, 3) == 'WIN' ? "-d extension_dir=" . ini_get("extension_dir") . " -d extension=php_soap.dll" : "";
$code = <<<'PHP'
$s = new SoapServer(NULL, array('uri' => 'http://here'));
$s->setObject(new stdclass());
$s->handle();
PHP;
php_cli_server_start($code, $router, $args);
foreach (array(1024-1, 1024*8-3, 1024*9+1, 1024*16-1, 1024*32-5, 1024*64+3, 1024*128-7) as $k => $i) {
echo "Iteration $k\n\n";
/* with and without compression */
foreach (array(false, true) as $b) {
$data = get_data($i);
if ($b) {
$data = gzencode($data);
}
$len = strlen($data);
//echo "len=$len\n";
$hdrs = <<<HDRS
POST /bug73037_server.php HTTP/1.1
Content-Type: application/soap+xml; charset=UTF-8
Accept: application/soap+xml, application/dime, multipart/related, text/*
SOAPAction: "urn:adressen#adressen#SetAda"
Expect: 100-continue
Content-Length: ${len}
HDRS;
if ($b) {
$hdrs .="\nContent-Encoding: gzip";
}
//echo "Headers sent:\n$hdrs\n\n";
$fp = fsockopen(PHP_CLI_SERVER_HOSTNAME, PHP_CLI_SERVER_PORT, $errno, $errstr, 5);
if (!$fp) {
die("connect failed");
}
if(fwrite($fp, "$hdrs\n\n$data")) {
$out = "";
while (!feof($fp)) {
$out .= fread($fp, 1024);
}
$pos = strpos($out, "<env:Text>");
if (false === $pos) {
echo $out;
goto cleanup;
}
$pos0 = $pos + strlen("<env:Text>");
$pos = strpos($out, "</env:Text>");
if (false === $pos) {
echo $out;
goto cleanup;
}
$len = $pos - $pos0;
echo substr($out, $pos0, $len);
}
cleanup:
fclose($fp);
echo "\n\n";
}
}
?>
==DONE==
--CLEAN--
<?php
unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "bug73037_server.php");
?>
--EXPECT--
Iteration 0
Function 'CATALOG' doesn't exist
Function 'CATALOG' doesn't exist
Iteration 1
Function 'CATALOG' doesn't exist
Function 'CATALOG' doesn't exist
Iteration 2
Function 'CATALOG' doesn't exist
Function 'CATALOG' doesn't exist
Iteration 3
Function 'CATALOG' doesn't exist
Function 'CATALOG' doesn't exist
Iteration 4
Function 'CATALOG' doesn't exist
Function 'CATALOG' doesn't exist
Iteration 5
Function 'CATALOG' doesn't exist
Function 'CATALOG' doesn't exist
Iteration 6
Function 'CATALOG' doesn't exist
Function 'CATALOG' doesn't exist
==DONE==
+65
View File
@@ -0,0 +1,65 @@
--TEST--
Bug #73237 "Any" data missing when result includes a struct
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--INI--
soap.wsdl_cache_enabled=0
--FILE--
<?php
class LocalSoapClient extends SoapClient {
function __doRequest($request, $location, $action, $version, $one_way = 0) {
return <<<EOF
<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="urn:test.example.org" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:sf="urn:object.test.example.org"><soapenv:Body><queryResponse><result xsi:type="QueryResult"><done>true</done><queryLocator xsi:nil="true"/><records xsi:type="sf:genericObject"><sf:type>CampaignMember</sf:type><sf:Id>00vi0000011VMgeAAG</sf:Id><sf:Id>00vi0000011VMgeAAG</sf:Id><sf:CampaignId>701i0000001lreeAAA</sf:CampaignId><sf:Status>Sent</sf:Status><sf:ContactId xsi:nil="true"/><sf:LeadId>00Qi000001UrbYFEAZ</sf:LeadId><sf:Contact xsi:nil="true"/><sf:Lead xsi:type="sf:genericObject"><sf:type>Lead</sf:type><sf:Id xsi:nil="true"/><sf:Email>angela.lansbury@cbs.com</sf:Email></sf:Lead></records><size>1</size></result></queryResponse></soapenv:Body></soapenv:Envelope>
EOF;
}
}
$client = new LocalSoapClient(dirname(__FILE__)."/bug73237.wsdl");
var_dump($client->query(""));
?>
--EXPECT--
object(stdClass)#2 (1) {
["result"]=>
object(stdClass)#3 (4) {
["done"]=>
string(4) "true"
["queryLocator"]=>
NULL
["records"]=>
object(SoapVar)#6 (4) {
["enc_type"]=>
int(0)
["enc_value"]=>
object(stdClass)#4 (3) {
["type"]=>
string(14) "CampaignMember"
["Id"]=>
array(2) {
[0]=>
string(18) "00vi0000011VMgeAAG"
[1]=>
string(18) "00vi0000011VMgeAAG"
}
["any"]=>
array(2) {
[0]=>
string(175) "<sf:CampaignId>701i0000001lreeAAA</sf:CampaignId><sf:Status>Sent</sf:Status><sf:ContactId xsi:nil="true"/><sf:LeadId>00Qi000001UrbYFEAZ</sf:LeadId><sf:Contact xsi:nil="true"/>"
["Lead"]=>
object(stdClass)#5 (3) {
["type"]=>
string(4) "Lead"
["Id"]=>
NULL
["any"]=>
string(44) "<sf:Email>angela.lansbury@cbs.com</sf:Email>"
}
}
}
["enc_stype"]=>
string(13) "genericObject"
["enc_ns"]=>
string(27) "urn:object.test.example.org"
}
["size"]=>
string(1) "1"
}
}
+78
View File
@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<definitions targetNamespace="urn:test.example.org"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:tns="urn:test.example.org"
xmlns:ens="urn:object.test.example.org">
<types>
<schema elementFormDefault="qualified" xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:object.test.example.org">
<import namespace="urn:test.example.org"/>
<complexType name="genericObject">
<sequence>
<element name="type" type="xsd:string"/>
<element name="fieldsToNull" type="xsd:string" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
<element name="Id" type="tns:ID" nillable="true" />
<any namespace="##targetNamespace" minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
</sequence>
</complexType>
</schema>
<schema elementFormDefault="qualified" xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:test.example.org">
<import namespace="urn:object.test.example.org"/>
<simpleType name="ID">
<restriction base="xsd:string">
<length value="18"/>
<pattern value='[a-zA-Z0-9]{18}'/>
</restriction>
</simpleType>
<element name="query">
<complexType>
<sequence>
<element name="queryString" type="xsd:string"/>
</sequence>
</complexType>
</element>
<element name="queryResponse">
<complexType>
<sequence>
<element name="result" type="tns:QueryResult"/>
</sequence>
</complexType>
</element>
</schema>
</types>
<message name="queryRequest">
<part element="tns:query" name="parameters"/>
</message>
<message name="queryResponse">
<part element="tns:queryResponse" name="parameters"/>
</message>
<portType name="Soap">
<operation name="query">
<documentation>Create a Query Cursor</documentation>
<input message="tns:queryRequest"/>
<output message="tns:queryResponse"/>
</operation>
</portType>
<binding name="SoapBinding" type="tns:Soap">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="query">
<soap:operation soapAction=""/>
<input>
<soap:body parts="parameters" use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="TestService">
<port binding="tns:SoapBinding" name="Soap">
<soap:address location="https://localhost/services/Soap/u/31.0"/>
</port>
</service>
</definitions>
+1 -1
View File
@@ -2810,7 +2810,7 @@ SPL_METHOD(CachingIterator, __toString)
if (Z_TYPE(intern->u.caching.zstr) == IS_STRING) {
RETURN_STR_COPY(Z_STR_P(&intern->u.caching.zstr));
} else {
RETURN_NULL();
RETURN_EMPTY_STRING();
}
} /* }}} */
@@ -13,4 +13,4 @@ $ci->__toString() // if conversion to string is done by echo, for example, an ex
);
?>
--EXPECTF--
NULL
string(0) ""
+9 -2
View File
@@ -579,13 +579,20 @@ PHP_METHOD(sqlite3, query)
static void sqlite_value_to_zval(sqlite3_stmt *stmt, int column, zval *data) /* {{{ */
{
sqlite3_int64 val;
switch (sqlite3_column_type(stmt, column)) {
case SQLITE_INTEGER:
if ((sqlite3_column_int64(stmt, column)) >= INT_MAX || sqlite3_column_int64(stmt, column) <= INT_MIN) {
val = sqlite3_column_int64(stmt, column);
#if LONG_MAX <= 2147483647
if (val > ZEND_LONG_MAX || val < ZEND_LONG_MIN) {
ZVAL_STRINGL(data, (char *)sqlite3_column_text(stmt, column), sqlite3_column_bytes(stmt, column));
} else {
ZVAL_LONG(data, sqlite3_column_int64(stmt, column));
#endif
ZVAL_LONG(data, val);
#if LONG_MAX <= 2147483647
}
#endif
break;
case SQLITE_FLOAT:
+1 -1
View File
@@ -24,4 +24,4 @@ var_dump($num,$result[0]);
?>
--EXPECT--
int(2147483647)
string(10) "2147483647"
int(2147483647)
+1 -1
View File
@@ -24,4 +24,4 @@ var_dump($num,$result[0]);
?>
--EXPECT--
int(100004313234244)
string(15) "100004313234244"
int(100004313234244)
+26
View File
@@ -0,0 +1,26 @@
--TEST--
Bug #73333 (2147483647 is fetched as string)
--SKIPIF--
<?php
if (!extension_loaded('sqlite3')) die('skip sqlite3 extension not available');
?>
--FILE--
<?php
if (!defined('PHP_INT_MIN')) define('PHP_INT_MIN', -PHP_INT_MAX-1);
$db = new SQLite3(':memory:');
$db->exec('CREATE TABLE foo (bar INT)');
foreach ([PHP_INT_MIN, PHP_INT_MAX] as $value) {
$db->exec("INSERT INTO foo VALUES ($value)");
}
$res = $db->query('SELECT bar FROM foo');
while (($row = $res->fetchArray(SQLITE3_NUM)) !== false) {
echo gettype($row[0]), PHP_EOL;
}
?>
===DONE===
--EXPECT--
integer
integer
===DONE===
+8 -12
View File
@@ -2932,17 +2932,10 @@ PHPAPI int php_array_merge_recursive(HashTable *dest, HashTable *src) /* {{{ */
return 0;
}
if (Z_ISREF_P(dest_entry)) {
if (Z_REFCOUNT_P(dest_entry) == 1) {
ZVAL_UNREF(dest_entry);
} else {
Z_DELREF_P(dest_entry);
ZVAL_DUP(dest_entry, dest_zval);
}
dest_zval = dest_entry;
} else {
SEPARATE_ZVAL(dest_zval);
}
ZEND_ASSERT(!Z_ISREF_P(dest_entry) || Z_REFCOUNT_P(dest_entry) > 1);
SEPARATE_ZVAL(dest_entry);
dest_zval = dest_entry;
if (Z_TYPE_P(dest_zval) == IS_NULL) {
convert_to_array_ex(dest_zval);
add_next_index_null(dest_zval);
@@ -3057,7 +3050,10 @@ PHPAPI int php_array_replace_recursive(HashTable *dest, HashTable *src) /* {{{ *
php_error_docref(NULL, E_WARNING, "recursion detected");
return 0;
}
SEPARATE_ZVAL(dest_zval);
ZEND_ASSERT(!Z_ISREF_P(dest_entry) || Z_REFCOUNT_P(dest_entry) > 1);
SEPARATE_ZVAL(dest_entry);
dest_zval = dest_entry;
if (ZEND_HASH_APPLY_PROTECTION(Z_ARRVAL_P(dest_zval))) {
Z_ARRVAL_P(dest_zval)->u.v.nApplyCount++;
+2 -2
View File
@@ -363,7 +363,7 @@ PHPAPI zend_string *php_escape_shell_cmd(char *str)
}
ZSTR_VAL(cmd)[y] = '\0';
if (y - 1 > cmd_max_len) {
if (y > cmd_max_len + 1) {
php_error_docref(NULL, E_ERROR, "Escaped command exceeds the allowed length of %d bytes", cmd_max_len);
zend_string_release(cmd);
return ZSTR_EMPTY_ALLOC();
@@ -450,7 +450,7 @@ PHPAPI zend_string *php_escape_shell_arg(char *str)
#endif
ZSTR_VAL(cmd)[y] = '\0';
if (y - 1 > cmd_max_len) {
if (y > cmd_max_len + 1) {
php_error_docref(NULL, E_ERROR, "Escaped argument exceeds the allowed length of %d bytes", cmd_max_len);
zend_string_release(cmd);
return ZSTR_EMPTY_ALLOC();
+5 -1
View File
@@ -90,7 +90,11 @@ static size_t php_stream_input_read(php_stream *stream, char *buf, size_t count)
}
}
php_stream_seek(input->body, input->position, SEEK_SET);
if (!input->body->readfilters.head) {
/* If the input stream contains filters, it's not really seekable. The
input->position is likely to be wrong for unfiltered data. */
php_stream_seek(input->body, input->position, SEEK_SET);
}
read = php_stream_read(input->body, buf, count);
if (!read || read == (size_t) -1) {
+6
View File
@@ -34,7 +34,13 @@ typedef struct {
#define php_random_bytes_throw(b, s) php_random_bytes((b), (s), 1)
#define php_random_bytes_silent(b, s) php_random_bytes((b), (s), 0)
#define php_random_int_throw(min, max, result) \
php_random_int((min), (max), (result), 1)
#define php_random_int_silent(min, max, result) \
php_random_int((min), (max), (result), 0)
PHPAPI int php_random_bytes(void *bytes, size_t size, zend_bool should_throw);
PHPAPI int php_random_int(zend_long min, zend_long max, zend_long *result, zend_bool should_throw);
#ifdef ZTS
# define RANDOM_G(v) ZEND_TSRMG(random_globals_id, php_random_globals *, v)
Loaded 100 of 155 files, more files were not shown because too many files have changed in this diff. Show more