Commit Graph

951 Commits

Author SHA1 Message Date
Felipe Pena
565c484222 - Moved leak_variable() to zend_builtin_functions.c (Gustavo) 2010-11-15 17:06:27 +00:00
Gustavo André dos Santos Lopes
3a02cfb675 - Added leak_variable() function.
- Added mechanism to force outer streams to be closed before their inner ones.
- Fixed temp:// streams only handling correctly (through an ad hoc mechanism)  reverse closing order
  when the  inner stream is of type memory.
2010-11-15 03:05:32 +00:00
Gustavo André dos Santos Lopes
91727cb844 - Completed rewrite of html.c. Except for determine_charset, almost nothing
remains.
- Fixed bug on determine_charset that was preventing correct detection in
  combination with internal mbstring encoding "none", "pass" or "auto".
- Added profiles for entity encode/decode for HTMl 4.01, XHTML 1.0, XML 1.0
  and HTML 5. Added the constants ENT_HTML401, ENT_XML1, ENT_XHTML and
  ENT_HTML5.
- htmlentities()/htmlspecialchars(), when told not to double encode, verify
  the correctness of the existenting entities more thoroughly.
  It is checked whether the numerical entity represents a valid unicode code
  point (number is between 0 and 0x10FFFF). If using the flag ENT_DISALLOWED,
  it is also checked whether that numerical entity is valid in selected
  document. In HTML 4.01, all the numerical entities that represent a Unicode
  code point (< U+10FFFFFF) are valid, but that's not the case with other
  document types. If the entity is not valid, & is encoded to &amp;.
  For named entities, the check is also more thorough. While before the only
  check would be to determine if the entity was constituted by alphanumeric
  characters, now it is checked whether that entity is necessarily defined for
  the target document type. Otherwise, & is encoded to &amp;.
- For html_entity_decode(), only valid numerical and named entities (as defined
  above for htmlentities()/htmlspecialchars() + !double_encode) are decoded.
  But there is in this case one additional check. Entities that represent
  non-SGML or otherwise invalid characters are not decoded. Note that, in
  HTML5, U+000D is a valid literal character, but the entity &#x0D is not
  valid and is therefore not decoded.
- The hash tables lazily created for decoding in html_entity_decode() that were
  added recently were substituted by static hash tables. Instead of 1 hash
  table per encoding, there's only one hash table per document type defined in
  terms of unicode code points. This means that for charsets other than UTF-8
  and ISO-8859-1, a conversion to unicode code points is necessary before
  decoding.
- On the encoding side, the ad hoc ranges of entities of the translation
  tables, which mapped (in general) non-unicode code points to HTML entities
  were replaced by three-stage tables for HTML 4 and HTML 5. This mapping
  tables are defined only in terms of unicode code points, so a conversion
  is necessary for charsets other than UTF-8 and ISO-8859-1. Even so, the
  multi-stage table is much faster than the previous method, by a factor
  of 5; the conversion to unicode is a small penalty because it's just a
  simple table lookup.
  XML 1.0/htmlspecialchars() uses a simple table instead of a three-stage
  table.
- Added the flag ENT_SUBSTITUTE, which makes htmlentities()/htmlspecialchars()
  replace the invalid multibyte sequences with U+FFFD (UTF-8) or &#FFFD;
  (other encodings).
- Added the flag ENT_DISALLOWED. Implements FR #52860. Characters that cannot
  appear literally are replaced by U+FFFD (UTF-8) or &#FFFD; (otherwise).
  An alternative implementation would be to encode those characters into
  numerical entities, but that would only work in HTML 4.01 due to limitations
  on the values of numerical entities in other document types. See also the
  effects on htmlentities()/htmlspecialchars() with !double_encode above.
2010-10-24 15:01:02 +00:00
Gustavo André dos Santos Lopes
91f64706c2 - [DOC] Added a 5th parameter to dns_get_record, a boolean that tells whether to activate
"raw mode". In this mide, $type (2nd parameter) is the numeric type of the record, and
  the responses are not parsed -- the "type" element will be numeric and there will be
  a "data" element with the raw data of the response buffer, which the programmer will
  have to parse.
- Fixed bug in the Win32 implementation of dns_get_record, where the 3rd and 4th arguments
  would only be filled if the 2nd ($type) was DNS_ANY.
- [DOC] The 3rd and 4th parameters can now be NULL (changed their arginfo).
2010-10-11 02:48:23 +00:00
Gustavo André dos Santos Lopes
7aa43a8d83 - Revamp of the decoding portion of html.c.
- Dramatic improvements on the performance of html_entity_decode and htmlspecialchars_decode, as the
  string is now traversed only once. Speedups of 20 to 25 times with Windows release builds and a
  ~250 characters string (for 2nd and subsequent calls).
- Consistent behavior on html_entity_decode. For instance, the entity in "&&lt;" would be decoded,
  but not "&&#233;". Not anymore. The code path for "basic" and non-basic entities is now mostly
  shared.
- Code of html_entity_decode and htmlspecialchars_decode is now shared.
- [DOC] More consistent behavior of htmlspecialchars_decode. Instead of translating only &lt;, &gt;,
  &amp;, &quot;, &#039; and &#39;, now e.g. &#34;, &apos;, &#0039;, &#x27;, etc. are also decoded.
- [DOC] Previous translation of unicode code points in numerical entities was seriously broken. When
  the code points for some character were not the same in unicode and the target encoding, the
  behavior could be an erroneous translation (e.g. 0x80-0xA0 in win-1252) or no translation at all.
  Added unicode translation tables for all single-byte encodings. Entities are not translated for
  multi-byte entities, except for ASCII characters whose code points are shared. We could add
  the huge translation tables (several thousand elements) for those encodings in the future.
- Fixed numerical entities that after # had text accepted by strcol being accepted.
- Much more commented and well-structured code...
- Tests for get_html_translation_table()) are broken. I stared fixing the tests, but then I realized
  it was completely helpless because get_html_translation_table() is broken by not handling
  multi-byte characters correctly.
2010-10-10 19:04:59 +00:00
Kalle Sommer Nielsen
60f0599393 Skipped this one 2010-10-04 20:33:58 +00:00
Kalle Sommer Nielsen
f2552322e7 Revert for now 2010-10-04 20:26:50 +00:00
Michael Maclean
b30b0916bd Un-deprecate mt_rand and deprecate mt_getrandmax 2010-10-04 20:20:30 +00:00
Kalle Sommer Nielsen
d252a45e82 * Added PHP_RAND_MAX and PHP_MT_RAND_MAX constants
* Deprecated getrandmax() and mt_getrandmax() in favour of the new constants

# We should promote constants for static data like such instead of function calls
# maybe this was just an old left-over
2010-10-01 09:18:44 +00:00
Kalle Sommer Nielsen
1ac15b2f8e Added TSRMLS macros into php_get_current_user() 2010-09-23 04:13:36 +00:00
Kalle Sommer Nielsen
34b631f679 Pass the TSRMS pointers to sapi_module_struct.log_message, this saves some TSRMLS_FETCH() calls in a few of our SAPI's 2010-08-18 13:34:40 +00:00
Kalle Sommer Nielsen
a12f6d9312 Fixed the $context parameter on copy() to have an effect (approved for 5.3 by Johannes)
# To not change a PHPAPI in a point release, a new function have been added to support contexts:
# php_copy_file_ctx(), php_copy_file_ex() now simply wraps to that
2010-08-17 12:17:28 +00:00
Kalle Sommer Nielsen
ac73c9d8b4 Fixed the context parameter on copy() to actually have an effect
# After looking at the logs, Jani did a bad merge into 5.3, so that 
# the context parameter sent to copy() actually isn't used at all. This 
# relatively simple patch fixes that for trunk.
#
# See FR #42965

# internals:
# This changes the php_copy_*() decls to contain an additional parameter for stream contexts
2010-08-16 21:56:35 +00:00
Kalle Sommer Nielsen
4281addcb7 Implemented FR #52555 (Ability to get HTTP response code)
- Patch by Paul Dragoonis
2010-08-09 13:10:32 +00:00
Dmitry Stogov
a619b589b3 Use ZE API to modify/restore PG(magic_quotes_runtime). Removed overhead at request startup. 2010-07-05 14:32:29 +00:00
Felipe Pena
f9cc8faa3c - Added BG(serialize) and BG(unserialize) initialization 2010-06-03 15:08:06 +00:00
Michael Wallner
11d24c1593 * implement new output API, fixing some bugs and implementing some feature
requests--let's see what I can dig out of the bugtracker for NEWS--
  and while crossing the road:
   * implemented new zlib API
   * fixed up ext/tidy (what was "s&" in zend_parse_parameters() supposed to do?)

Thanks to Jani and Felipe for pioneering.
2010-05-31 10:29:43 +00:00
Felipe Pena
bcd9a87e2a - Fixed bug #51791 (constant() aborts execution when fail to check undefined constant) 2010-05-13 02:13:30 +00:00
Pierre Joye
b9730786a7 - #51063, implement getimagesizefromstring 2010-05-05 13:37:40 +00:00
Kalle Sommer Nielsen
dd8e59da8f Removed safe_mode
* Removed ini options, safe_mode*
 * Removed --enable-safe-mode --with-exec-dir configure options on Unix
 * Updated extensions, SAPI's and core
 * php_get_current_user() is now declared in main.c, thrus no need to include safe_mode.h anymore
2010-04-26 23:53:30 +00:00
Kalle Sommer Nielsen
9d395a4a2b Removed import_request_variables(), this is not needed anymore without register_globals 2010-04-21 22:23:55 +00:00
Kalle Sommer Nielsen
3e6678de4d Added missing zend_parse_parameters_none() call to sys_getloadavg() 2010-04-21 22:04:19 +00:00
Pierre Joye
95fcd75af2 - [doc] add stream_set_read_buffer, equivalent of stream_set_write_buffer for read operations. Fixing possible bad effects while reading devices. full context support is under work. 2010-04-12 08:25:50 +00:00
Kalle Sommer Nielsen
8087be61d0 * Changed the way removed ini directives are shown so its easier to add new ones
* Removed define_syslog_variables and its associated functions
2010-04-12 01:52:55 +00:00
Jani Taskinen
af49e58f51 - Reverted r296062 and r296065 2010-03-12 10:28:59 +00:00
Jani Taskinen
06f072cb5e MFH: Improved / fixed output buffering (Michael Wallner) 2010-03-11 10:24:29 +00:00
Pierre Joye
e4065db32b - #50690, putenv does assign value when their length is one char 2010-01-24 13:49:47 +00:00
Pierre Joye
f386e268cd - make getservbyname on windows behaves like *nux when proto is an empty string 2010-01-24 13:36:08 +00:00
Sebastian Bergmann
de93d96de4 sed -i "s#1997-2008#1997-2010#g" **/*.c **/*.h 2010-01-07 11:02:39 +00:00
Mikko Koppanen
207d9133ca Changed stream_resolve_include_path to use zend_resolve_path
backported stream_resolve_include_path to PHP 5.3
backported stream_resolve_include_path test to PHP 5.3
2009-12-24 13:12:03 +00:00
Felipe Pena
a94558c855 - Added MAKE_COPY_ZVAL(ppzv, pzv) macro 2009-12-08 01:57:37 +00:00
Stanislav Malyshev
7beb1af8de add realpath cache inspect functions 2009-12-08 01:35:08 +00:00
Jani Taskinen
f395a2e34f - Fixed error_log() to be binary safe when using message_type 3 (message appended to file). 2009-11-22 18:31:01 +00:00
Ilia Alshanetsky
ef1731590a Fixed bug #49855 (import_request_variables() always returns NULL). 2009-10-15 12:26:54 +00:00
Ilia Alshanetsky
a3430a6b24 Fixed bug #49757 (long2ip() can return wrong value in a multi-threaded applications).
# original patch by Florian Anderiasch
2009-10-05 14:45:54 +00:00
Scott MacVicar
ce24f04694 Fix build on platforms where crypt isn't always available 2009-08-12 09:18:41 +00:00
Scott MacVicar
050653466f Merge chanes from head to improve DNS on OSX and allow usage of bind9 stuff with the bind8 compatibility layer. 2009-08-11 22:07:35 +00:00
Scott MacVicar
af5df4c813 Change dns.h to php_dns.h, part of my dns cleanup 2009-08-05 23:20:17 +00:00
Jani Taskinen
ae492897c6 - Removed unused code (replaced long time ago by url_scanner_ex.* 2009-07-26 22:59:46 +00:00
Kalle Sommer Nielsen
9fef343050 MFH: Fixed arginfo for array_map, patch by Matthew Fonda <matthewfonda@gmail.com> 2009-06-20 06:07:35 +00:00
Pierre Joye
e52e1fab4c - silent warning 2009-06-15 08:32:38 +00:00
Matt Wilmas
1fa3b21c15 MFH: Fixed error message grammar:
- "cannot" instead of "can not" (meaning "also can")
 - "than" instead of "then" (Hint: "then" should hardly be needed;
     you're not telling the order in which to do something)

... plus removed a couple ending. dots
2009-06-06 02:40:49 +00:00
Ilia Alshanetsky
7b064cf252 Fixed bug #47365 (ip2long() may allow some invalid values on certain 64bit
systems)
2009-04-28 22:27:00 +00:00
Felipe Pena
476ea1ad69 - MFH: Fixed bug #48087 (call_user_method() invalid free of arguments) 2009-04-27 12:52:31 +00:00
Arnaud Le Blanc
13061cf0a0 Removed deprecation warning for ticks 2009-03-27 02:32:57 +00:00
Pierre Joye
274dad3b83 - MFH:
- add nanosleep
 - expose nanosleep and usleep
 - [DOC] time_ nanosleep and time_ sleep_ until available on windows
 - change nanosleep signature to match posix one
2009-01-19 02:35:22 +00:00
Pierre Joye
59b6e456cb - symlink, hardlink & co support (2.1/2 :) 2009-01-16 01:01:04 +00:00
Ilia Alshanetsky
4093573e5c Fixed a bug inside mail() logging code that prevents log file from existing
outside of open_basedir
2009-01-13 21:29:12 +00:00
Pierre Joye
27b89ad09b - remove PHP_FE(dl) (actually removing the commented PHP_FE, was commited with my dns patch for win) 2009-01-07 08:53:47 +00:00
Pierre Joye
3c967db4a1 - [MFH]
- [DOC] add support for all DNS function on Windows
  - dns_check_record  (and its alias  checkdnsrr)
  - dns_get_record
   - IPV6 specific info not available yet:
     . AAAA info is available only on vista/2k8 for now
     . A6 info is not available
  - dns_get_mx (and its alias getmxrr)
2009-01-06 20:48:21 +00:00