Commit Graph

417 Commits

Author SHA1 Message Date
Nikita Popov
29433f9fd5 Make unserialize() ref unwrapping compatible with 7.0
Also fix output difference in merged test (unrelated).
2017-01-16 14:25:58 +01:00
Sammy Kaye Powers
dac6c639bb Update copyright headers to 2017 2017-01-04 11:23:42 -06:00
Nikita Popov
70ca40d30f Merge branch 'PHP-7.0' into PHP-7.1 2017-01-01 19:26:36 +01:00
Nikita Popov
4877641962 Fixed bug #73154
The object that is being serialized may be destroyed during the
execution of __sleep(), so operate on a copy instead.
2017-01-01 19:24:41 +01:00
Nikita Popov
c0762bd8c8 Merge branch 'PHP-7.0' into PHP-7.1 2016-11-05 23:10:19 +01:00
Nikita Popov
b2af4e8868 Complete the fix of bug #70172 for PHP 7 2016-11-05 23:06:27 +01:00
Nikita Popov
09f7bb2082 Followup for bug #72785
Fix incorrect handling of nesting ... need to reset to the old
value afterwards.
2016-09-06 12:59:35 +02:00
Stanislav Malyshev
747d21cfd2 Fix bug #72785 - allowed_classes only applies to outermost unserialize() 2016-09-05 19:56:36 -07:00
Nikita Popov
f7caa2bd8e Hide (un)serialize data from ABI
The (UN)SERIALIZE_INIT/DESTROY macros now go through non-inlined
functions, so any changes to them will apply to extensions without
rebuilds.

Additionally, the (un)serialize_data structures are now no longer
exported.

This means that we are allowed to change these structures in patch
releases without breaking the ABI.
2016-08-15 22:42:27 +02:00
Jakub Zelenka
3f13507dd2 Use one place to define max length of double
Introduce new constant PHP_DOUBLE_MAX_LENGTH for that purpose
2016-06-26 14:03:01 +01:00
Jakub Zelenka
71774c241e Add decimal point in double serialization 2016-06-26 13:26:43 +01:00
Yasuo Ohgaki
3043be3716 Avoid magic number. NUM_BUF_SIZE may be in header. Suggestions are appreciated 2016-06-26 13:26:43 +01:00
Yasuo Ohgaki
e3d9f1f4d8 Simply use ndigit for flag for zend_dtoa mode 2016-06-26 13:26:43 +01:00
Yasuo Ohgaki
f943daf2d7 Initial patch for 0 mode float conversion. The magic number is better to be improved. Any suggestion where to define it? 2016-06-26 13:26:42 +01:00
Dmitry Stogov
1616038698 Added ZEND_ATTRIBUTE_FORMAT to some middind functions.
"%p" replaced by ZEND_LONG_FMT to avoid compilation warnings.
Fixed most incorrect use cases of format specifiers.
2016-06-21 16:00:37 +03:00
Xinchen Hui
0c8879e3da Merge branch 'PHP-7.0'
* PHP-7.0:
  Let's only read-only here
2016-05-17 18:07:36 +08:00
Xinchen Hui
2eb7e75c25 Let's only read-only here 2016-05-17 18:07:20 +08:00
Xinchen Hui
60d743dd3b Merge branch 'PHP-7.0'
* PHP-7.0:
  Fixed bug #72229 (Wrong reference when serialize/unserialize an object)
2016-05-17 17:40:37 +08:00
Xinchen Hui
7989db975f Fixed bug #72229 (Wrong reference when serialize/unserialize an object) 2016-05-17 17:40:26 +08:00
Nikita Popov
64f91774f2 Remove IS_VAR_RET_REF flag
Instead decide whether a function returned by reference or by value
by checking whether the return value has REFERENCE type. This means
that functions returning by reference must always return a reference
and functions returning by value must not return a reference.
2016-04-15 15:32:20 +02:00
Xinchen Hui
5db4d9a71c Fixed bug #71995 (Returning the same var twice from __sleep() produces broken serialized data) 2016-04-09 10:01:04 -07:00
Xinchen Hui
c85907682a Improved fix for #71940 2016-04-07 19:28:54 +08:00
Xinchen Hui
a0fac47364 object->ce should not be NULL 2016-03-10 15:26:15 +08:00
Nikita Popov
c9357f82d3 Format string fixes
Conflicts:
	ext/pgsql/pgsql.c
2016-02-14 14:45:53 +01:00
Andrea Faulds
ae50a0c0be Fix bug #71314 2016-01-08 17:20:52 +00:00
Lior Kaplan
ed35de784f Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  Happy new year (Update copyright to 2016)
2016-01-01 19:48:25 +02:00
Lior Kaplan
49493a2dcf Happy new year (Update copyright to 2016) 2016-01-01 19:21:47 +02:00
Andrea Faulds
8d217db369 Fix bug #66179
This also fixes ext/standard/tests/general_functions/var_export-locale.phpt
to actually run the floating-point section.
2015-12-18 19:31:21 +00:00
Xinchen Hui
6313e16a04 Improved fix for bug (count on symbol table) 2015-11-23 06:12:03 -08:00
Xinchen Hui
e2d6090043 Fixed bug #70730 (Incorrect ArrayObject serialization if unset is called in serialize())
It's possible to fixed this in SPL side, but it will be ugly, and we
should make serialize more robust, so I prefer fix it in serialize side.
2015-10-17 05:28:49 -07:00
Xinchen Hui
b00a315806 Unused var 2015-09-09 15:15:43 +08:00
Stanislav Malyshev
9b1a224d4e Merge branch 'PHP-5.6'
* PHP-5.6: (21 commits)
  fix unit tests
  update NEWS
  add NEWS for fixes
  Improve fix for #70172
  Fix bug #70312 - HAVAL gives wrong hashes in specific cases
  fix test
  add test
  Fix bug #70366 - use-after-free vulnerability in unserialize() with SplDoublyLinkedList
  Fix bug #70365 - use-after-free vulnerability in unserialize() with SplObjectStorage
  Fix bug #70172 - Use After Free Vulnerability in unserialize()
  Fix bug #70388 - SOAP serialize_function_call() type confusion
  Fixed bug #70350: ZipArchive::extractTo allows for directory traversal when creating directories
  Improve fix for #70385
  Fix bug #70345 (Multiple vulnerabilities related to PCRE functions)
  Fix bug #70385 (Buffer over-read in exif_read_data with TIFF IFD tag byte value of 32 bytes)
  Fix bug #70219 (Use after free vulnerability in session deserializer)
  Fix bug ##70284 (Use after free vulnerability in unserialize() with GMP)
  Fix for bug #69782
  Add CVE IDs asigned (post release) to PHP 5.4.43
  Add CVE IDs asigned to #69085 (PHP 5.4.39)
  ...

Conflicts:
	ext/exif/exif.c
	ext/gmp/gmp.c
	ext/pcre/php_pcre.c
	ext/session/session.c
	ext/session/tests/session_decode_variation3.phpt
	ext/soap/soap.c
	ext/spl/spl_observer.c
	ext/standard/var.c
	ext/standard/var_unserializer.c
	ext/standard/var_unserializer.re
	ext/xsl/xsltprocessor.c
2015-09-02 00:37:20 -07:00
Stanislav Malyshev
c19d59c550 Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  update NEWS
  add NEWS for fixes
  Improve fix for #70172
  Fix bug #70312 - HAVAL gives wrong hashes in specific cases
  fix test
  add test
  Fix bug #70366 - use-after-free vulnerability in unserialize() with SplDoublyLinkedList
  Fix bug #70365 - use-after-free vulnerability in unserialize() with SplObjectStorage
  Fix bug #70172 - Use After Free Vulnerability in unserialize()
  Fix bug #70388 - SOAP serialize_function_call() type confusion
  Fixed bug #70350: ZipArchive::extractTo allows for directory traversal when creating directories
  Improve fix for #70385
  Fix bug #70345 (Multiple vulnerabilities related to PCRE functions)
  Fix bug #70385 (Buffer over-read in exif_read_data with TIFF IFD tag byte value of 32 bytes)
  Fix bug #70219 (Use after free vulnerability in session deserializer)
  Fix for bug #69782
  Add CVE IDs asigned (post release) to PHP 5.4.43
  Add CVE IDs asigned to #69085 (PHP 5.4.39)
  5.4.45 next

Conflicts:
	ext/pcre/php_pcre.c
	ext/standard/var_unserializer.c
	ext/standard/var_unserializer.re
	ext/zip/php_zip.c
2015-09-01 12:06:41 -07:00
Stanislav Malyshev
33d3acaae7 Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4:
  Improve fix for #70172
  Fix bug #70312 - HAVAL gives wrong hashes in specific cases
  fix test
  add test
  Fix bug #70366 - use-after-free vulnerability in unserialize() with SplDoublyLinkedList
  Fix bug #70365 - use-after-free vulnerability in unserialize() with SplObjectStorage
  Fix bug #70172 - Use After Free Vulnerability in unserialize()
  Fix bug #70388 - SOAP serialize_function_call() type confusion
  Fixed bug #70350: ZipArchive::extractTo allows for directory traversal when creating directories
  Improve fix for #70385
  Fix bug #70345 (Multiple vulnerabilities related to PCRE functions)
  Fix bug #70385 (Buffer over-read in exif_read_data with TIFF IFD tag byte value of 32 bytes)
  Fix bug #70219 (Use after free vulnerability in session deserializer)
  Fix for bug #69782
  Add CVE IDs asigned (post release) to PHP 5.4.43
  Add CVE IDs asigned to #69085 (PHP 5.4.39)
  5.4.45 next

Conflicts:
	configure.in
	ext/pcre/php_pcre.c
	ext/standard/var_unserializer.c
	ext/standard/var_unserializer.re
	main/php_version.h
2015-09-01 11:42:19 -07:00
Stanislav Malyshev
7c31203935 Improve fix for #70172 2015-09-01 11:38:39 -07:00
Dmitry Stogov
bb4b50636c Fixed one more problem related to bug #70187 (Notice: unserialize(): Unexpected end of serialized data) 2015-09-01 10:39:00 +03:00
Stanislav Malyshev
e8429400d4 Fix bug #70172 - Use After Free Vulnerability in unserialize() 2015-08-31 23:26:14 -07:00
Dmitry Stogov
25f9e25526 Fixed bug #70187 (Notice: unserialize(): Unexpected end of serialized data) 2015-08-26 03:27:05 +03:00
Xinchen Hui
a6b47e8d68 Merge branch 'zval_dump_consistent' of https://github.com/laruence/php-src 2015-07-30 13:14:38 +08:00
Xinchen Hui
add2b158e2 cleanup 2015-07-23 12:16:22 +08:00
Xinchen Hui
c55c7ef0ec Make debug_val_dump and var_dump prints int and float the same 2015-07-23 12:14:34 +08:00
Rasmus Lerdorf
73773c2175 unserialize() takes a 2nd optional arg and it can't be a bool 2015-07-15 09:59:31 -07:00
Dmitry Stogov
4a2e40bb86 Use ZSTR_ API to access zend_string elements (this is just renaming without semantick changes). 2015-06-30 04:05:24 +03:00
Rasmus Lerdorf
28d7bb97a1 Fix more proto comments 2015-06-23 17:46:20 -04:00
Nikita Popov
dc764bf644 Use object apply count in var_dump / print_r
Instead of using the array apply count on the debug_info array, use
the object apply count for recursion detection when dumping. This
handles recursion in a more generic way and does not require each
debug_info handler to deal with this.

This allows returning a temporary debug_info array, instead of
having to store it in the object (thus delaying destruction of the
values).

Switch SPL debug_info handlers to use a temporary array.
2015-04-15 22:00:12 +02:00
Xinchen Hui
1646e0e9d7 Fixed typo 2015-03-28 18:51:57 +08:00
Xinchen Hui
193de2a679 Fixed memleak
ext/standard/tests/serialize/bug69210.phpt
2015-03-28 14:35:14 +08:00
Juan Basso
3e7f47cb03 Renamed test case to match with reported bug 2015-03-22 20:34:59 -07:00
Juan Basso
4076a4d2a9 Fixed serialization of non string values on __sleep
Returning just N; (null) on the __sleep makes the number of fields/values be incomplete and corrupting the generated value from serialize, making impossible to unserialize it.

Conflicts:
	ext/standard/var.c
2015-03-22 20:31:40 -07:00
Stanislav Malyshev
b62eec67df Merge branch 'pull-request/1057'
* pull-request/1057:
  Renamed test case to match with reported bug
  Fixed serialization of non string values on __sleep
2015-03-22 20:27:35 -07:00