Compare commits

..
1 Commits
484 changed files with 32725 additions and 30141 deletions

No files matched your search

+71 -109
View File
@@ -1,7 +1,8 @@
set $zts = 0
define ____executor_globals
if basic_functions_module.zts
set $tsrm_ls = ts_resource_ex(0, 0)
set $eg = ((zend_executor_globals) (*((void ***) $tsrm_ls))[executor_globals_id-1])
if $zts
set $eg = ((zend_executor_globals) (*((void ***) tsrm_ls))[executor_globals_id-1])
else
set $eg = executor_globals
end
@@ -9,7 +10,7 @@ end
document ____executor_globals
portable way of accessing executor_globals
ZTS detection is automatically based on ext/standard module struct
type "set $zts = 1" if you use --enable-maintainer-zts on your configure line
end
define dump_bt
@@ -43,33 +44,55 @@ document printzv
end
define ____printzv_contents
____executor_globals
set $zvalue = $arg0
set $type = $zvalue->type
printf "(refcount=%d) ", $zvalue->refcount
if $type == 0
printf "NULL"
if $zvalue.type == 0
set $typename = "NULL"
end
if $type == 1
printf "long: %ld", $zvalue->value.lval
if $zvalue.type == 1
set $typename = "long"
end
if $type == 2
printf "double: %lf", $zvalue->value.dval
if $zvalue.type == 2
set $typename = "double"
end
if $type == 3
printf "bool: "
if $zvalue->value.lval
printf "true"
else
printf "false"
end
if $zvalue.type == 3
set $typename = "string"
end
if $type == 4
printf "array(%d): ", $zvalue->value.ht->nNumOfElements
if $zvalue.type == 4
set $typename = "array"
end
if $zvalue.type == 5
set $typename = "object"
end
if $zvalue.type == 6
set $typename = "bool"
end
if $zvalue.type == 7
set $typename = "resource"
end
if $zvalue.type == 8
set $typename = "constant"
end
if $zvalue.type == 9
set $typename = "const_array"
end
printf "(refcount=%d) %s: ", $zvalue.refcount, $typename
if $zvalue.type == 1
printf "%ld", $zvalue.value.lval
end
if $zvalue->type == 2
printf "%lf", $zvalue.value.dval
end
if $zvalue.type == 3
printf "\"%s\"(%d)", $zvalue.value.str.val, $zvalue.value.str.len
end
if $zvalue.type == 4
if ! $arg1
printf "{\n"
set $ind = $ind + 1
____print_ht $zvalue->value.ht
____print_ht $zvalue.value.ht
set $ind = $ind - 1
set $i = $ind
while $i > 0
@@ -78,60 +101,34 @@ define ____printzv_contents
end
printf "}"
end
set $type = 0
end
if $type == 5
printf "object"
____executor_globals
set $handle = $zvalue->value.obj.handle
set $handlers = $zvalue->value.obj.handlers
if basic_functions_module.zts
set $zobj = zend_objects_get_address($zvalue, $tsrm_ls)
else
set $zobj = zend_objects_get_address($zvalue)
end
if $handlers->get_class_entry == &zend_std_object_get_class
set $cname = $zobj->ce.name
else
set $cname = "Unknown"
end
printf "(%s) #%d", $cname, $handle
if $zvalue.type == 5
if ! $arg1
if $handlers->get_properties == &zend_std_get_properties
set $ht = $zobj->properties
if $ht
printf "(%d): ", $ht->nNumOfElements
printf "{\n"
set $ind = $ind + 1
____print_ht $ht
set $ind = $ind - 1
set $i = $ind
while $i > 0
printf " "
set $i = $i - 1
end
printf "}"
else
echo "no properties found"
end
printf "(prop examination disabled due to a gdb bug)"
if $zvalue.value.obj.handlers->get_properties
# set $ht = $zvalue->value.obj.handlers->get_properties($zvalue)
# printf "{\n"
# set $ind = $ind + 1
# ____print_ht $ht
# set $ind = $ind - 1
# set $i = $ind
# while $i > 0
# printf " "
# set $i = $i - 1
# end
# printf "}"
end
end
set $type = 0
end
if $type == 6
printf "string(%d): \"%s\"", $zvalue->value.str.len, $zvalue->value.str.val
if $zvalue.type == 6
if $zvalue.value.lval
printf "true"
else
printf "false"
end
end
if $type == 7
printf "resource: #%d", $zvalue->value.lval
end
if $type == 8
printf "constant"
end
if $type == 9
printf "const_array"
end
if $type > 9
printf "unknown type %d", $type
if $zvalue.type == 7
printf "#%d", $zvalue.value.lval
end
printf "\n"
end
@@ -146,7 +143,7 @@ define ____printzv
printf "*uninitialized* "
end
set $zcontents = (zval*) $zvalue
set $zcontents = *(struct _zval_struct *) $zvalue
if $arg1
____printzv_contents $zcontents $arg1
else
@@ -159,7 +156,7 @@ define ____print_const_table
set $p = $ht->pListHead
while $p != 0
set $const = (zend_constant *) $p->pData
set $const = *(zend_constant *) $p->pData
set $i = $ind
while $i > 0
@@ -173,7 +170,7 @@ define ____print_const_table
printf "%d => ", $p->h
end
____printzv_contents &$const->value 0
____printzv_contents $const.value 0
set $p = $p->pListNext
end
end
@@ -190,7 +187,7 @@ define ____print_ht
set $p = $ht->pListHead
while $p != 0
set $zval = *(zval **)$p->pData
set $zval = *(struct _zval_struct **)$p->pData
set $i = $ind
while $i > 0
@@ -220,41 +217,6 @@ document print_ht
dumps elements of HashTable made of zval
end
define ____print_ft
set $ht = $arg0
set $p = $ht->pListHead
while $p != 0
set $func = (zend_function*)$p->pData
set $i = $ind
while $i > 0
printf " "
set $i = $i - 1
end
if $p->nKeyLength > 0
printf "\"%s\" => ", (char*)$p->arKey
else
printf "%d => ", $p->h
end
printf "\"%s\"\n", $func->common.function_name
set $p = $p->pListNext
end
end
define print_ft
set $ind = 1
printf "[0x%08x] {\n", $arg0
____print_ft $arg0
printf "}\n"
end
document print_ft
dumps a function table (HashTable)
end
define printzn
____executor_globals
set $ind = 0
+5 -5
View File
@@ -68,6 +68,11 @@ PRIMARY MAINTAINER: Alex Leigh <aleigh@php.net>
MAINTENANCE: Unknown
STATUS: Unknown
-------------------------------------------------------------------------------
EXTENSION: date
PRIMARY MAINTAINER: Derick Rethans <derick@php.net>
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: embed
PRIMARY MAINTAINER: Edin Kadribasic <edink@php.net>
MAINTENANCE: Maintained
@@ -302,11 +307,6 @@ MAINTENANCE: Maintained
STATUS: Working
SINCE: 4.0.2
-------------------------------------------------------------------------------
EXTENSION: date
PRIMARY MAINTAINER: Derick Rethans <derick@php.net>
MAINTENANCE: Maintained
STATUS: Working
-------------------------------------------------------------------------------
EXTENSION: exif
PRIMARY MAINTAINER: Marcus Boerger <helly@php.net>
MAINTENANCE: Maintained
+1 -1
View File
@@ -61,7 +61,7 @@ php_lcov.info: lcov-test
lcov-html: php_lcov.info
@echo "Generating lcov HTML"
@$(LTP_GENHTML) --legend --output-directory lcov_html/ --title "PHP Code Coverage" --show-details php_lcov.info
@$(LTP_GENHTML) --legend --no-prefix --output-directory lcov_html/ --title "PHP Code Coverage" --show-details php_lcov.info
lcov-clean:
rm -f php_lcov.info
+5 -5
View File
@@ -25,10 +25,10 @@ install: $(all_targets) $(install_targets)
install-sapi: $(OVERALL_TARGET)
@echo "Installing PHP SAPI module: $(PHP_SAPI)"
-@$(mkinstalldirs) $(INSTALL_ROOT)$(bindir)
-@if test ! -r $(phptempdir)/libphp5.$(SHLIB_DL_SUFFIX_NAME); then \
-@if test ! -r $(phptempdir)/libphp5.$(SHLIB_SUFFIX_NAME); then \
for i in 0.0.0 0.0 0; do \
if test -r $(phptempdir)/libphp5.$(SHLIB_DL_SUFFIX_NAME).$$i; then \
$(LN_S) $(phptempdir)/libphp5.$(SHLIB_DL_SUFFIX_NAME).$$i $(phptempdir)/libphp5.$(SHLIB_DL_SUFFIX_NAME); \
if test -r $(phptempdir)/libphp5.$(SHLIB_SUFFIX_NAME).$$i; then \
$(LN_S) $(phptempdir)/libphp5.$(SHLIB_SUFFIX_NAME).$$i $(phptempdir)/libphp5.$(SHLIB_SUFFIX_NAME); \
break; \
fi; \
done; \
@@ -44,13 +44,13 @@ install-modules: build-modules
install-headers:
-@if test "$(INSTALL_HEADERS)"; then \
for i in `echo $(INSTALL_HEADERS)`; do \
for i in $(INSTALL_HEADERS); do \
i=`$(top_srcdir)/build/shtool path -d $$i`; \
paths="$$paths $(INSTALL_ROOT)$(phpincludedir)/$$i"; \
done; \
$(mkinstalldirs) $$paths && \
echo "Installing header files: $(INSTALL_ROOT)$(phpincludedir)/" && \
for i in `echo $(INSTALL_HEADERS)`; do \
for i in $(INSTALL_HEADERS); do \
if test "$(PHP_PECL_EXTENSION)"; then \
src=`echo $$i | $(SED) -e "s#ext/$(PHP_PECL_EXTENSION)/##g"`; \
else \
-267
View File
@@ -1,272 +1,5 @@
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
04 May 2006, PHP 5.1.4
- Added "capture_peer_cert" and "capture_peer_cert_chain" context options
for SSL streams. (Wez).
- Added PDO::PARAM_EVT_* family of constants. (Sara)
- Fixed possible crash in highlight_string(). (Dmitry)
- Fixed bug #37291 (FastCGI now longer works with isapi_fcgi.dll). (Dmitry)
- Fixed bug #37277 (cloning Dom Documents or Nodes does not work). (Rob)
- Fixed bug #37276 (problems with $_POST array). (Dmitry)
- Fixed bug #36632 (bad error reporting for pdo_odbc exec UPDATE). (Wez).
- Fixed bug #35552 (crash when pdo_odbc prepare fails). (Wez).
28 Apr 2006, PHP 5.1.3
- Updated bundled PCRE library to version 6.6. (Andrei)
- Moved extensions to PECL:
. ext/msession (Derick)
- Reimplemented FastCGI interface. (Dmitry)
- Improved SPL: (Marcus)
- Fixed issues with not/double calling of constructors of SPL iterators.
- Fixed issues with info-class/file-class in SPL directory handling classes.
- Fixed ArrayIterator::seek().
- Added SimpleXMLIterator::count().
- Dropped erroneous RecursiveDirectoryIterator::getSubPathInfo().
- Improved SimpleXML: (Marcus, Rob)
. Added SimpleXMLElement::getName() to retrieve name of element.
. Added ability to create elements on the fly.
. Added addChild() method for element creation supporting namespaces.
. Added addAttribute() method for attribute creation supporting namespaces.
. Added ability to delete specific elements and attributes by offset.
- Improved Reflection API: (Marcus)
. Added ReflectionClass::newInstanceArgs($args).
. Added ability to analyze extension dependency.
. Added ReflectionFunction::isDeprecated() and constant IS_DEPRECATED.
. Added ReflectionParameter::getDeclaringClass().
. Changed reflection constants to be prefixed with IS_. (Johannes)
- Improved cURL extension: (Ilia)
. Added curl_setopt_array() function that allows setting of multiple
options via an associated array.
. Added the ability to retrieve the request message sent to the server.
- Improved GD extension: (Pierre)
. Added a weak/tolerant mode to the JPEG loader.
. Added filtering mode option to imagepng() to allow reducing file size.
. Fixed imagecolorallocate() and imagecolorallocatelapha() to return FALSE
on error.
- Changed get_headers() to retrieve headers also from non-200 responses.
(Ilia)
- Changed get_headers() to use the default context. (Ilia)
- Added lchown() and lchgrp() to change user/group ownership of symlinks.
(Derick)
- Added support for exif date format in strtotime(). (Derick)
- Added a check for special characters in the session name. (Ilia)
- Added "consumed" stream filter. (Marcus)
- Added new mysqli constants for BIT and NEW_DECIMAL field types:
MYSQLI_TYPE_NEWDECIMAL and MYSQLI_TYPE_BIT. FR #36007. (Georg)
- Added imap_savebody() that allows message body to be written to a
file. (Mike)
- Added overflow checks to wordwrap() function. (Ilia)
- Added support for BINARY_DOUBLE and BINARY_FLOAT to PDO_OCI and OCI8
(also fixes bug #36764). (Tony)
- Eliminated run-time constant fetching for TRUE, FALSE and NULL. (Dmitry)
- Removed the E_STRICT deprecation notice from "var". (Ilia)
- Fixed reading stream filters never notified about EOF. (Mike)
- Fixed tempnam() 2nd parameter to be checked against path components. (Ilia)
- Fixed a bug that would not fill in the fifth argument to preg_replace()
properly, if the variable was not declared previously. (Andrei)
- Fixed safe_mode check for source argument of the copy() function. (Ilia)
- Fixed mysqli bigint conversion under Windows (Georg)
- Fixed XSS inside phpinfo() with long inputs. (Ilia)
- Fixed Apache2 SAPIs header handler modifying header strings. (Mike)
- Fixed 'auto_globals_jit' to work together with 'register_argc_argv'. (Dmitry)
- Fixed offset/length parameter validation in substr_compare() function. (Ilia)
- Fixed debug_zval_dump() to support private and protected members. (Dmitry)
- Fixed SoapFault::getMessage(). (Dmitry)
- Fixed issue with iconv_mime_decode where the "encoding" would only allow
upper case specifiers. (Derick)
- Fixed tiger hash algorithm generating wrong results on big endian platforms.
(Mike)
- Fixed crash with DOMImplementation::createDocumentType("name:"). (Mike)
- Fixed bug #37205 (Serving binary content/images fails with "comm with server
aborted" FastCGI err). (Dmitry)
- Fixed bug #37192 (cc may complain about non-constant initializers in
hash_adler.c). (Mike)
- Fixed bug #37191 (chmod takes off sticky bit when safe_mode is On). (Tony)
- Fixed bug #37167 (PDO segfaults when throwing exception from the
fetch handler). (Tony)
- Fixed bug #37162 (wddx does not build as a shared extension).
(jdolecek at NetBSD dot org, Ilia)
- Fixed bug #37158 (fread behavior changes after calling
stream_wrapper_register). (Wez)
- Fixed bug #37138 (__autoload tries to load callback'ed self and parent).
(Dmitry)
- Fixed bug #37103 (libmbfl headers not installed). (Jani)
- Fixed bug #37062 (compile failure on ARM architecture). (Tony)
- Fixed bug #37061 (curl_exec() doesn't zero-terminate binary strings). (Tony)
- Fixed bug #37060 (Type of retval of Countable::count() is not checked).
(Johannes)
- Fixed bug #37059 (oci_bind_by_name() doesn't support RAW and LONG RAW
fields). (Tony)
- Fixed bug #37057 (xmlrpc_decode() may produce arrays with numeric strings,
which are unaccessible). (Tony)
- Fixed bug #37055 (incorrect reference counting for persistent OCI8
connections). (Tony)
- Fixed bug #37054 (SoapClient Error Fetching http headers). (Dmitry)
- Fixed bug #37053 (html_errors with internal classes produces wrong links).
(Tony)
- Fixed bug #37046 (foreach breaks static scope). (Dmitry)
- Fixed bug #37045 (Fixed check for special chars for http redirects). (Ilia)
- Fixed bug #37017 (strtotime fails before 13:00:00 with some time zones
identifiers). (Derick)
- Fixed bug #37002 (Have to quote literals in INI when concatenating with
vars). (Dmitry)z
- Fixed bug #36988 (mktime freezes on long numbers). (Derick)
- Fixed bug #36981 (SplFileObject->fgets() ignores max_length). (Tony)
- Fixed bug #36957 (serialize() does not handle recursion). (Ilia)
- Fixed bug #36944 (strncmp & strncasecmp do not return false on negative
string length). (Tony)
- Fixed bug #36941 (ArrayIterator does not clone itself). (Marcus)
- Fixed bug #36934 (OCILob->read() doesn't move internal pointer when
reading 0's). (Tony)
- Fixed bug #36908 (wsdl default value overrides value in soap request).
(Dmitry)
- Fixed bug #36898 (__set() leaks in classes extending internal ones).
(Tony, Dmitry)
- Fixed bug #36886 (User filters can leak buckets in some situations). (Ilia)
- Fixed bug #36878 (error messages are printed even though an exception has
been thrown). (Tony)
- Fixed bug #36875 (is_*() functions do not account for open_basedir). (Ilia)
- Fixed bug #36872 (session_destroy() fails after call to
session_regenerate_id(true)). (Ilia)
- Fixed bug #36869 (memory leak in output buffering when using chunked
output). (Tony)
- Fixed bug #36859 (DOMElement crashes when calling __construct when
cloning). (Tony)
- Fixed bug #36857 (Added support for partial content fetching to the
HTTP streams wrapper). (Ilia)
- Fixed bug #36851 (Documentation and code discrepancies for NULL
data in oci_fetch_*() functions). (Tony)
- Fixed bug #36825 (Exceptions thrown in ArrayObject::offsetGet cause
segfault). (Tony)
- Fixed bug #36820 (Privileged connection with an Oracle password file
fails). (Tony)
- Fixed bug #36809 (__FILE__ behavior changed). (Dmitry)
- Fixed bug #36808 (syslog ident becomes garbage between requests). (Tony)
- Fixed bug #36802 (mysqli_set_charset() crash with a non-open connection).
(Ilia)
- Fixed bug #36756 (DOMDocument::removeChild corrupts node). (Rob)
- Fixed bug #36749 (SOAP: 'Error Fetching http body' when using HTTP Proxy).
(Dmitry)
- Fixed bug #36745 (No error message when load data local file isn't found).
(Georg)
- Fixed bug #36743 (In a class extending XMLReader array properties are not
writable). (Tony)
- Fixed bug #36727 (segfault in pdo_pgsql bindValue() when no parameters are
defined). (Tony)
- Fixed bug #36721 (The SoapServer is not able to send a header that it didn't
receive). (Dmitry)
- Fixed bug #36697 (Transparency is lost when using imagecreatetruecolor).
(Pierre)
- Fixed bug #36689 (Removed arbitrary limit on the length of syslog messages).
(Ilia)
- Fixed bug #36656 (http_build_query generates invalid URIs due to use of
square brackets). (Mike)
- Fixed bug #36638 (strtotime() returns false when 2nd argument < 1). (Derick)
- Fixed bug #36629 (SoapServer::handle() exits on SOAP faults). (Dmitry)
- Fixed bug #36625 (pg_trace() does not work). (iakio at mono-space dot net)
- Fixed bug #36614 (Segfault when using Soap). (Dmitry)
- Fixed bug #36611 (assignment to SimpleXML object attribute changes argument
type to string). (Tony)
- Fixed bug #36606 (pg_query_params() changes arguments type to string). (Tony)
- Fixed bug #36599 (DATE_W3C format constant incorrect). (Derick)
- Fixed bug #36575 (SOAP: Incorrect complex type instantiation with
hierarchies). (Dmitry)
- Fixed bug #36572 (Added PDO::MYSQL_ATTR_DIRECT_QUERY constant that should
be set when executing internal queries like "show master status" via MySQL).
(Ilia)
- Fixed bug #36568 (memory_limit setting on win32 has no effect). (Dmitry)
- Fixed bug #36513 (comment will be outputted in last line). (Dmitry)
- Fixed bug #36510 (strtotime() fails to parse date strings with tabs).
(Ilia, Derick)
- Fixed bug #36459 (Incorrect adding PHPSESSID to links, which contains \r\n).
(Ilia)
- Fixed bug #36458 (sleep() accepts negative values). (Ilia)
- Fixed bug #36436 (DBA problem with Berkeley DB4). (Marcus)
- Fixed bug #36434 (Improper resolution of declaring class name of an
inherited property). (Ilia)
- Fixed bug #36420 (segfault when access result->num_rows after calling
result->close()). (Ilia,Tony)
- Fixed bug #36403 (oci_execute() no longer supports OCI_DESCRIBE_ONLY). (Tony)
- Fixed bug #36400 (Custom 5xx error does not return correct HTTP response error
code). (Tony)
- Fixed bug #36396 (strtotime() fails to parse dates in dd-mm-yyyy format).
(Derick)
- Fixed bug #36388 (ext/soap crashes when throwing exception and session
persistence). (David)
- Fixed bug #36382 (PDO/PgSQL's getColumnMeta() crashes). (Derick)
- Fixed bug #36359 (splFileObject::fwrite() doesn't write when no data
length specified). (Tony)
- Fixed bug #36351 (parse_url() does not parse numeric paths properly). (Ilia)
- Fixed bug #36345 (PDO/MySQL problem loading BLOB over 1MB). (Ilia)
- Fixed bug #36337 (ReflectionProperty fails to return correct visibility).
(Ilia)
- Fixed bug #36334 (Added missing documentation about realpath cache INI
settings). (Ilia)
- Fixed bug #36308 (ReflectionProperty::getDocComment() does not reflect
extended class commentary). (Ilia)
- Fixed bug #36306 (crc32() differ on 32-bit and 64-bit platforms)
(anight@eyelinkmedia dot com, Pierre)
- Fixed bug #36303 (foreach on error_zval produces segfault). (Dmitry)
- Fixed bug #36295 (typo in SplFileObject::flock() parameter name). (Tony)
- Fixed bug #36287 (Segfault with SplFileInfo conversion). (Marcus)
- Fixed bug #36283 (SOAPClient Compression Broken). (Dmitry)
- Fixed bug #36268 (Object destructors called even after fatal errors). (Dmitry)
- Fixed bug #36258 (SplFileObject::getPath() may lead to segfault). (Tony)
- Fixed bug #36250 (PHP causes ORA-07445 core dump in Oracle server 9.2.x).
(Tony)
- Fixed bug #36242 (Possible memory corruption in stream_select()). (Tony)
- Fixed bug #36235 (ocicolumnname returns false before a successful fetch).
(Tony)
- Fixed bug #36226 (Inconsistent handling when passing potential arrays).
(Dmitry)
- Fixed bug #36224 (date(DATE_ATOM) gives wrong results).
(Derick, Hannes Magnusson)
- Fixed bug #36222 (errorInfo in PDOException is always NULL). (Ilia)
- Fixed bug #36208 (symbol namespace conflicts using bundled gd). (Jakub Moc)
- Fixed bug #36205 (Memory leaks on duplicate cookies). (Dmitry)
- Fixed bug #36185 (str_rot13() crash on non-string parameter). (Pierre)
- Fixed bug #36176 (PDO_PGSQL - PDO::exec() does not return number of rows
affected by the operation). (Ilia)
- Fixed bug #36158 (SIGTERM is not handled correctly when running as a
FastCGI server). (Dmitry)
- Fixed bug #36152 (problems with curl+ssl and pgsql+ssl in same PHP). (Mike)
- Fixed bug #36148 (unpack("H*hex", $data) is adding an extra character to
the end of the string). (Ilia)
- Fixed bug #36134 (DirectoryIterator constructor failed to detect empty
directory names). (Ilia)
- Fixed bug #36113 (Reading records of unsupported type causes segfault).
(Tony)
- Fixed bug #36096 (oci_result() returns garbage after oci_fetch() failed).
(Tony)
- Fixed bug #36083 (SoapClient waits for responses on one-way operations).
(Dmitry)
- Fixed bug #36071 (Engine Crash related with 'clone'). (Dmitry)
- Fixed bug #36055 (possible OCI8 crash in multi-threaded environment). (Tony)
- Fixed bug #36046 (parse_ini_file() miscounts lines in multi-line values).
(Ilia)
- Fixed bug #36038 (ext/hash compile failure on Mac OSX). (Tony)
- Fixed bug #36037 (heredoc adds extra line number). (Dmitry)
- Fixed bug #36016 (realpath cache memleaks). (Dmitry, Nuno)
- Fixed bug #36011 (Strict errormsg wrong for call_user_func() and the likes).
(Marcus)
- Fixed bug #36010 (Segfault when re-creating and re-executing statements with
bound parameters). (Tony)
- Fixed bug #36006 (Problem with $this in __destruct()). (Dmitry)
- Fixed bug #35999 (recursive mkdir() does not work with relative path
like "foo/bar"). (Tony)
- Fixed bug #35998 (SplFileInfo::getPathname() returns unix style filenames
in win32). (Marcus)
- Fixed bug #35988 (Unknown persistent list entry type in module shutdown).
(Dmitry)
- Fixed bug #35954 (Fatal com_exception casting object). (Rob)
- Fixed bug #35900 (stream_select() should warning when tv_sec is negative).
(Ilia)
- Fixed bug #35785 (SimpleXML causes memory read error zend engine). (Marcus)
- Fixed bug #34272 (empty array onto COM object blows up). (Rob)
- Fixed bug #33292 (apache_get_modules() crashes on Windows). (Edin)
- Fixed bug #29476 (sqlite_fetch_column_types() locks the database forever).
(Ilia)
12 Jan 2006, PHP 5.1.2
- Updated libsqlite in ext/sqlite to 2.8.17. (Ilia)
- Updated libsqlite in ext/pdo_sqlite to 3.2.8. (Ilia)
-46
View File
@@ -480,52 +480,6 @@ void ts_free_thread(void)
}
/* frees all resources allocated for all threads except current */
void ts_free_worker_threads(void)
{
tsrm_tls_entry *thread_resources;
int i;
THREAD_T thread_id = tsrm_thread_id();
int hash_value;
tsrm_tls_entry *last=NULL;
tsrm_mutex_lock(tsmm_mutex);
hash_value = THREAD_HASH_OF(thread_id, tsrm_tls_table_size);
thread_resources = tsrm_tls_table[hash_value];
while (thread_resources) {
if (thread_resources->thread_id != thread_id) {
for (i=0; i<thread_resources->count; i++) {
if (resource_types_table[i].dtor) {
resource_types_table[i].dtor(thread_resources->storage[i], &thread_resources->storage);
}
}
for (i=0; i<thread_resources->count; i++) {
free(thread_resources->storage[i]);
}
free(thread_resources->storage);
if (last) {
last->next = thread_resources->next;
} else {
tsrm_tls_table[hash_value] = thread_resources->next;
}
free(thread_resources);
if (last) {
thread_resources = last->next;
} else {
thread_resources = tsrm_tls_table[hash_value];
}
} else {
if (thread_resources->next) {
last = thread_resources;
}
thread_resources = thread_resources->next;
}
}
tsrm_mutex_unlock(tsmm_mutex);
}
/* deallocates all occurrences of a given id */
void ts_free_id(ts_rsrc_id id)
{
-3
View File
@@ -106,9 +106,6 @@ TSRM_API void *ts_resource_ex(ts_rsrc_id id, THREAD_T *th_id);
/* frees all resources allocated for the current thread */
TSRM_API void ts_free_thread(void);
/* frees all resources allocated for all threads except current */
void ts_free_worker_threads(void);
/* deallocates all occurrences of a given id */
TSRM_API void ts_free_id(ts_rsrc_id id);
+20 -36
View File
@@ -163,15 +163,18 @@ static int php_is_file_ok(const cwd_state *state)
static void cwd_globals_ctor(virtual_cwd_globals *cwd_globals TSRMLS_DC)
{
CWD_STATE_COPY(&cwd_globals->cwd, &main_cwd_state);
#ifdef REALPATH_CACHE
cwd_globals->realpath_cache_size = 0;
cwd_globals->realpath_cache_size_limit = REALPATH_CACHE_SIZE;
cwd_globals->realpath_cache_ttl = REALPATH_CACHE_TTL;
memset(cwd_globals->realpath_cache, 0, sizeof(cwd_globals->realpath_cache));
#endif
}
static void cwd_globals_dtor(virtual_cwd_globals *cwd_globals TSRMLS_DC)
{
CWD_STATE_FREE(&cwd_globals->cwd);
#ifdef REALPATH_CACHE
{
int i;
@@ -184,6 +187,7 @@ static void cwd_globals_dtor(virtual_cwd_globals *cwd_globals TSRMLS_DC)
}
}
}
#endif
}
static char *tsrm_strndup(const char *s, size_t length)
@@ -304,6 +308,7 @@ CWD_API char *virtual_getcwd(char *buf, size_t size TSRMLS_DC)
return buf;
}
#ifdef REALPATH_CACHE
static inline unsigned long realpath_cache_key(const char *path, int path_len)
{
register unsigned long h;
@@ -347,18 +352,19 @@ static inline realpath_cache_bucket* realpath_cache_find(const char *path, int p
while (*bucket != NULL) {
if (CWDG(realpath_cache_ttl) && (*bucket)->expires < t) {
realpath_cache_bucket *r = *bucket;
*bucket = (*bucket)->next;
CWDG(realpath_cache_size) -= sizeof(realpath_cache_bucket) + r->path_len + 1 + r->realpath_len + 1;
free(r);
*bucket = (*bucket)->next;
CWDG(realpath_cache_size) -= sizeof(realpath_cache_bucket) + r->path_len + 1 + r->realpath_len + 1;
free(r);
} else if (key == (*bucket)->key && path_len == (*bucket)->path_len &&
memcmp(path, (*bucket)->path, path_len) == 0) {
return *bucket;
} else {
bucket = &(*bucket)->next;
*bucket = (*bucket)->next;
}
}
return NULL;
}
#endif
/* Resolve path relatively to state and put the real path into state */
@@ -379,17 +385,20 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func
#else
char *new_path;
#endif
#ifdef REALPATH_CACHE
char orig_path[MAXPATHLEN];
int orig_path_len = 0;
int orig_path_len;
realpath_cache_bucket *bucket;
time_t t = 0;
time_t t;
TSRMLS_FETCH();
#endif
if (path_length == 0)
return (0);
if (path_length >= MAXPATHLEN)
return (1);
#ifdef REALPATH_CACHE
if (use_realpath && CWDG(realpath_cache_size_limit)) {
if (IS_ABSOLUTE_PATH(path, path_length) || (state->cwd_length < 1)) {
memcpy(orig_path, path, path_length+1);
@@ -421,6 +430,7 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func
}
}
}
#endif
#if !defined(TSRM_WIN32) && !defined(NETWARE)
/* cwd_length can be 0 when getcwd() fails.
* This can happen under solaris when a dir does not have read permissions
@@ -599,9 +609,11 @@ php_failed_getlongpath:
#endif
free(free_path);
#ifdef REALPATH_CACHE
if (use_realpath && CWDG(realpath_cache_size_limit)) {
realpath_cache_add(orig_path, orig_path_len, state->cwd, state->cwd_length, t TSRMLS_CC);
}
#endif
if (verify_path && verify_path(state)) {
CWD_STATE_FREE(state);
@@ -765,7 +777,7 @@ CWD_API int virtual_chmod(const char *filename, mode_t mode TSRMLS_DC)
}
#if !defined(TSRM_WIN32) && !defined(NETWARE)
CWD_API int virtual_chown(const char *filename, uid_t owner, gid_t group, int link TSRMLS_DC)
CWD_API int virtual_chown(const char *filename, uid_t owner, gid_t group TSRMLS_DC)
{
cwd_state new_state;
int ret;
@@ -773,15 +785,7 @@ CWD_API int virtual_chown(const char *filename, uid_t owner, gid_t group, int li
CWD_STATE_COPY(&new_state, &CWDG(cwd));
virtual_file_ex(&new_state, filename, NULL, 0);
if (link) {
#if HAVE_LCHOWN
ret = lchown(new_state.cwd, owner, group);
#else
ret = -1;
#endif
} else {
ret = chown(new_state.cwd, owner, group);
}
ret = chown(new_state.cwd, owner, group);
CWD_STATE_FREE(&new_state);
return ret;
@@ -1043,26 +1047,6 @@ CWD_API FILE *virtual_popen(const char *command, const char *type TSRMLS_DC)
#endif
/* On AIX & Tru64 when a file does not exist realpath() returns
* NULL, and sets errno to ENOENT. Unlike in other libc implementations
* the destination is not filled and remains undefined. Therefor, we
* must populate it manually using strcpy as done on systems with no
* realpath() function.
*/
#if defined(__osf__) || defined(_AIX)
char *php_realpath_hack(char *src, char *dest)
{
char *ret;
if ((ret = realpath(src, dest)) == NULL && errno == ENOENT) {
return strcpy(dest, src);
} else {
return ret;
}
}
#endif
/*
* Local variables:
+23 -9
View File
@@ -166,8 +166,23 @@ CWD_API int virtual_access(const char *pathname, int mode TSRMLS_DC);
#endif
#endif
/* On AIX & Tru64 when a file does not exist realpath() returns
* NULL, and sets errno to ENOENT. Unlike in other libc implementations
* the destination is not filled and remains undefined. Therefor, we
* must populate it manually using strcpy as done on systems with no
* realpath() function.
*/
#if defined(__osf__) || defined(_AIX)
char *php_realpath_hack(char *src, char *dest);
static char *php_realpath_hack(char *src, char *dest)
{
char *ret;
if ((ret = realpath(src, dest)) == NULL && errno == ENOENT) {
return strcpy(dest, src);
} else {
return ret;
}
}
#endif
#if HAVE_UTIME
@@ -175,14 +190,16 @@ CWD_API int virtual_utime(const char *filename, struct utimbuf *buf TSRMLS_DC);
#endif
CWD_API int virtual_chmod(const char *filename, mode_t mode TSRMLS_DC);
#if !defined(TSRM_WIN32) && !defined(NETWARE)
CWD_API int virtual_chown(const char *filename, uid_t owner, gid_t group, int link TSRMLS_DC);
CWD_API int virtual_chown(const char *filename, uid_t owner, gid_t group TSRMLS_DC);
#endif
CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func verify_path, int use_realpath);
#define REALPATH_CACHE
#define REALPATH_CACHE_TTL (2*60) /* 2 minutes */
#define REALPATH_CACHE_SIZE 0 /* disabled while php.ini isn't loaded */
#ifdef REALPATH_CACHE
typedef struct _realpath_cache_bucket {
unsigned long key;
char *path;
@@ -192,13 +209,16 @@ typedef struct _realpath_cache_bucket {
time_t expires;
struct _realpath_cache_bucket *next;
} realpath_cache_bucket;
#endif
typedef struct _virtual_cwd_globals {
cwd_state cwd;
#ifdef REALPATH_CACHE
long realpath_cache_size;
long realpath_cache_size_limit;
long realpath_cache_ttl;
realpath_cache_bucket *realpath_cache[1024];
#endif
} virtual_cwd_globals;
#ifdef ZTS
@@ -242,10 +262,7 @@ extern virtual_cwd_globals cwd_globals;
#endif
#define VCWD_CHMOD(path, mode) virtual_chmod(path, mode TSRMLS_CC)
#if !defined(TSRM_WIN32) && !defined(NETWARE)
#define VCWD_CHOWN(path, owner, group) virtual_chown(path, owner, group, 0 TSRMLS_CC)
#if HAVE_LCHOWN
#define VCWD_LCHOWN(path, owner, group) virtual_chown(path, owner, group, 1 TSRMLS_CC)
#endif
#define VCWD_CHOWN(path, owner, group) virtual_chown(path, owner, group TSRMLS_CC)
#endif
#else
@@ -288,9 +305,6 @@ extern virtual_cwd_globals cwd_globals;
#define VCWD_CHMOD(path, mode) chmod(path, mode)
#if !defined(TSRM_WIN32) && !defined(NETWARE)
#define VCWD_CHOWN(path, owner, group) chown(path, owner, group)
#if HAVE_LCHOWN
#define VCWD_LCHOWN(path, owner, group) lchown(path, owner, group)
#endif
#endif
#endif
+3 -3
View File
@@ -179,7 +179,7 @@ function fibo($n) {
/****/
function hash1($n) {
function hash($n) {
for ($i = 1; $i <= $n; $i++) {
$X[dechex($i)] = $i;
}
@@ -401,8 +401,8 @@ ary3(2000);
$t = end_test($t, "ary3(2000)");
fibo(30);
$t = end_test($t, "fibo(30)");
hash1(50000);
$t = end_test($t, "hash1(50000)");
hash(50000);
$t = end_test($t, "hash(50000)");
hash2(500);
$t = end_test($t, "hash2(500)");
heapsort(20000);
+8
View File
@@ -92,7 +92,11 @@ $object->test();
--EXPECTF--
test_func1
test_func2
Strict Standards: Non-static method test_class::test_func3() cannot be called statically, assuming $this from compatible context test_class in %sbug29210.php on line %d
test_func3
Strict Standards: Non-static method test_class::test_func4() cannot be called statically, assuming $this from compatible context test_class in %sbug29210.php on line %d
test_func4
test_func1 isn't callable from outside
test_func2 isn't callable from outside
@@ -100,5 +104,9 @@ test_func3 isn't callable from outside
test_func4 isn't callable from outside
test_func1 isn't callable from child
test_func2
Strict Standards: Non-static method test_class::test_func3() cannot be called statically, assuming $this from compatible context foo in %sbug29210.php on line %d
test_func3 isn't callable from child
Strict Standards: Non-static method test_class::test_func4() cannot be called statically, assuming $this from compatible context foo in %sbug29210.php on line %d
test_func4
+1 -1
View File
@@ -1,5 +1,5 @@
--TEST--
Bug #34873 (Segmentation Fault on foreach in object)
bug #34873 (Segmentation Fault on foreach in object)
--FILE--
<?php
class pwa {
+4 -12
View File
@@ -237,19 +237,11 @@ ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_cop
} else {
if(Z_OBJ_HANDLER_P(expr, get)) {
zval *z = Z_OBJ_HANDLER_P(expr, get)(expr TSRMLS_CC);
z->refcount++;
if(Z_TYPE_P(z) != IS_OBJECT) {
zend_make_printable_zval(z, expr_copy, use_copy);
if (*use_copy) {
zval_ptr_dtor(&z);
} else {
ZVAL_ZVAL(expr_copy, z, 0, 1);
*use_copy = 1;
}
FREE_ZVAL(z);
return;
}
zval_ptr_dtor(&z);
}
}
if (EG(exception)) {
@@ -877,7 +869,7 @@ static int exec_done_cb(zend_module_entry *module TSRMLS_DC)
void zend_post_deactivate_modules(TSRMLS_D)
{
zend_hash_apply(&module_registry, (apply_func_t) exec_done_cb TSRMLS_CC);
zend_hash_reverse_apply(&module_registry, (apply_func_t) module_registry_unload_temp TSRMLS_CC);
zend_hash_apply(&module_registry, (apply_func_t) module_registry_unload_temp TSRMLS_CC);
}
@@ -1025,7 +1017,7 @@ ZEND_API void zend_error(int type, const char *format, ...)
}
zval_ptr_dtor(&retval);
}
} else if (!EG(exception)) {
} else {
/* The user error handler failed, use built-in error handler */
zend_error_cb(type, error_filename, error_lineno, format, args);
}
@@ -1054,7 +1046,7 @@ ZEND_API void zend_error(int type, const char *format, ...)
}
}
#if defined(__GNUC__) && !defined(__INTEL_COMPILER) && !defined(DARWIN) && !defined(__hpux) && !defined(_AIX)
#if defined(__GNUC__) && !defined(__INTEL_COMPILER) && !defined(DARWIN) && !defined(__hpux)
void zend_error_noreturn(int type, const char *format, ...) __attribute__ ((alias("zend_error"),noreturn));
#endif
+2 -2
View File
@@ -91,7 +91,7 @@ const char *zend_mh_bundle_error(void);
#endif /* HAVE_MACH_O_DYLD_H */
#if defined(HAVE_LIBDL) && !defined(HAVE_MACH_O_DYLD_H) && !defined(ZEND_WIN32)
#if defined(HAVE_LIBDL) && !defined(HAVE_MACH_O_DYLD_H)
# ifndef RTLD_LAZY
# define RTLD_LAZY 1 /* Solaris 1, FreeBSD's (2.1.7.1 and older) */
@@ -250,7 +250,7 @@ char *alloca ();
#define INTERNAL_FUNCTION_PARAMETERS int ht, zval *return_value, zval **return_value_ptr, zval *this_ptr, int return_value_used TSRMLS_DC
#define INTERNAL_FUNCTION_PARAM_PASSTHRU ht, return_value, return_value_ptr, this_ptr, return_value_used TSRMLS_CC
#if defined(__GNUC__) && !defined(__INTEL_COMPILER) && !defined(DARWIN) && !defined(__hpux) && !defined(_AIX)
#if defined(__GNUC__) && !defined(__INTEL_COMPILER) && !defined(DARWIN) && !defined(__hpux)
# define ZEND_VM_ALWAYS_INLINE __attribute__ ((always_inline))
void zend_error_noreturn(int type, const char *format, ...) __attribute__ ((noreturn));
#else
+43 -105
View File
@@ -271,7 +271,7 @@ ZEND_API int zend_get_object_classname(zval *object, char **class_name, zend_uin
}
static char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, char **spec TSRMLS_DC)
static char *zend_parse_arg_impl(zval **arg, va_list *va, char **spec TSRMLS_DC)
{
char *spec_walk = *spec;
char c = *spec_walk++;
@@ -445,21 +445,6 @@ static char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, char **sp
}
break;
case 'h':
{
HashTable **p = va_arg(*va, HashTable **);
if (Z_TYPE_PP(arg) != IS_ARRAY) {
if (Z_TYPE_PP(arg) == IS_NULL && return_null) {
*p = NULL;
} else {
return "array";
}
} else {
*p = Z_ARRVAL_PP(arg);
}
}
break;
case 'o':
{
zval **p = va_arg(*va, zval **);
@@ -492,41 +477,6 @@ static char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, char **sp
}
break;
case 'C':
{
zend_class_entry **lookup, **pce = va_arg(*va, zend_class_entry **);
zend_class_entry *ce_base = *pce;
convert_to_string_ex(arg);
if (zend_lookup_class(Z_STRVAL_PP(arg), Z_STRLEN_PP(arg), &lookup TSRMLS_CC) == FAILURE) {
*pce = NULL;
} else {
*pce = *lookup;
}
if (ce_base) {
if ((!*pce || !instanceof_function(*pce, ce_base TSRMLS_CC)) && !return_null) {
char *space;
char *class_name = get_active_class_name(&space TSRMLS_CC);
zend_error(E_WARNING, "%s%s%s() expects parameter %d to be a class name derived from %s, '%s' given",
class_name, space, get_active_function_name(TSRMLS_C),
arg_num, ce_base->name, Z_STRVAL_PP(arg));
*pce = NULL;
return "";
}
}
if (!*pce && !return_null) {
char *space;
char *class_name = get_active_class_name(&space TSRMLS_CC);
zend_error(E_WARNING, "%s%s%s() expects parameter %d to be a valid class name, '%s' given",
class_name, space, get_active_function_name(TSRMLS_C),
arg_num, Z_STRVAL_PP(arg));
return "";
}
break;
}
break;
case 'z':
{
zval **p = va_arg(*va, zval **);
@@ -560,7 +510,7 @@ static int zend_parse_arg(int arg_num, zval **arg, va_list *va, char **spec, int
{
char *expected_type = NULL;
expected_type = zend_parse_arg_impl(arg_num, arg, va, spec TSRMLS_CC);
expected_type = zend_parse_arg_impl(arg, va, spec TSRMLS_CC);
if (expected_type) {
if (!quiet) {
char *space;
@@ -595,7 +545,6 @@ static int zend_parse_va_args(int num_args, char *type_spec, va_list *va, int fl
case 'r': case 'a':
case 'o': case 'O':
case 'z': case 'Z':
case 'C': case 'h':
max_num_args++;
break;
@@ -811,7 +760,6 @@ ZEND_API void zend_update_class_constants(zend_class_entry *class_type TSRMLS_DC
zend_class_entry *old_scope = *scope;
*scope = class_type;
zend_hash_apply_with_argument(&class_type->constants_table, (apply_func_arg_t) zval_update_constant, (void*)1 TSRMLS_CC);
zend_hash_apply_with_argument(&class_type->default_properties, (apply_func_arg_t) zval_update_constant, (void *) 1 TSRMLS_CC);
if (!CE_STATIC_MEMBERS(class_type)) {
@@ -1546,8 +1494,8 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, zend_function_entr
zend_function *ctor = NULL, *dtor = NULL, *clone = NULL, *__get = NULL, *__set = NULL, *__unset = NULL, *__isset = NULL, *__call = NULL;
char *lowercase_name;
int fname_len;
char *lc_class_name = NULL;
int class_name_len = 0;
char *lc_class_name;
int class_name_len;
if (type==MODULE_PERSISTENT) {
error_type = E_CORE_WARNING;
@@ -1590,10 +1538,8 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, zend_function_entr
}
if (ptr->flags) {
if (!(ptr->flags & ZEND_ACC_PPP_MASK)) {
if (ptr->flags != ZEND_ACC_DEPRECATED || scope) {
zend_error(error_type, "Invalid access level for %s%s%s() - access must be exactly one of public, protected or private", scope ? scope->name : "", scope ? "::" : "", ptr->fname);
}
internal_function->fn_flags = ZEND_ACC_PUBLIC | ptr->flags;
zend_error(error_type, "Invalid access level for %s%s%s() - access must be exactly one of public, protected or private", scope ? scope->name : "", scope ? "::" : "", ptr->fname);
internal_function->fn_flags = ZEND_ACC_PUBLIC;
} else {
internal_function->fn_flags = ptr->flags;
}
@@ -1855,7 +1801,11 @@ int module_registry_cleanup(zend_module_entry *module TSRMLS_DC)
int module_registry_unload_temp(zend_module_entry *module TSRMLS_DC)
{
return (module->type == MODULE_TEMPORARY) ? ZEND_HASH_APPLY_REMOVE : ZEND_HASH_APPLY_STOP;
switch (module->type) {
case MODULE_TEMPORARY:
return 1;
}
return 0;
}
@@ -2024,7 +1974,7 @@ ZEND_API int zend_disable_class(char *class_name, uint class_name_length TSRMLS_
return 1;
}
static int zend_is_callable_check_func(int check_flags, zval ***zobj_ptr_ptr, zend_class_entry *ce_org, zval *callable, zend_class_entry **ce_ptr, zend_function **fptr_ptr TSRMLS_DC)
static int zend_is_callable_check_func(int check_flags, zval **zobj_ptr, zend_class_entry *ce_org, zval *callable, zend_class_entry **ce_ptr, zend_function **fptr_ptr TSRMLS_DC)
{
int retval;
char *lcname, *lmname, *colon;
@@ -2039,16 +1989,18 @@ static int zend_is_callable_check_func(int check_flags, zval ***zobj_ptr_ptr, ze
if ((colon = strstr(Z_STRVAL_P(callable), "::")) != NULL) {
clen = colon - Z_STRVAL_P(callable);
mlen = Z_STRLEN_P(callable) - clen - 2;
lcname = zend_str_tolower_dup(Z_STRVAL_P(callable), clen);
/* caution: lcname is not '\0' terminated */
if (clen == sizeof("self") - 1 && memcmp(lcname, "self", sizeof("self") - 1) == 0) {
*ce_ptr = EG(scope);
} else if (clen == sizeof("parent") - 1 && memcmp(lcname, "parent", sizeof("parent") - 1) == 0 && EG(active_op_array)->scope) {
*ce_ptr = EG(scope) ? EG(scope)->parent : NULL;
} else if (zend_lookup_class(Z_STRVAL_P(callable), clen, &pce TSRMLS_CC) == SUCCESS) {
if (zend_lookup_class(Z_STRVAL_P(callable), clen, &pce TSRMLS_CC) == SUCCESS) {
*ce_ptr = *pce;
} else {
lcname = zend_str_tolower_dup(Z_STRVAL_P(callable), clen);
/* caution: lcname is not '\0' terminated */
if (clen == sizeof("self") - 1 && memcmp(lcname, "self", sizeof("self") - 1) == 0) {
*ce_ptr = EG(scope);
} else if (clen == sizeof("parent") - 1 && memcmp(lcname, "parent", sizeof("parent") - 1) == 0 && EG(active_op_array)->scope) {
*ce_ptr = EG(scope) ? EG(scope)->parent : NULL;
}
efree(lcname);
}
efree(lcname);
if (!*ce_ptr) {
return 0;
}
@@ -2071,28 +2023,23 @@ static int zend_is_callable_check_func(int check_flags, zval ***zobj_ptr_ptr, ze
retval = zend_hash_find(ftable, lmname, mlen+1, (void**)&fptr) == SUCCESS ? 1 : 0;
if (!retval) {
if (*zobj_ptr_ptr && *ce_ptr && (*ce_ptr)->__call != 0) {
if (zobj_ptr && *ce_ptr && (*ce_ptr)->__call != 0) {
retval = (*ce_ptr)->__call != NULL;
*fptr_ptr = (*ce_ptr)->__call;
}
} else {
*fptr_ptr = fptr;
if (*ce_ptr) {
if (!*zobj_ptr_ptr && !(fptr->common.fn_flags & ZEND_ACC_STATIC)) {
if (!zobj_ptr && !(fptr->common.fn_flags & ZEND_ACC_STATIC)) {
if ((check_flags & IS_CALLABLE_CHECK_IS_STATIC) != 0) {
retval = 0;
} else {
if (EG(This) && instanceof_function(Z_OBJCE_P(EG(This)), *ce_ptr TSRMLS_CC)) {
*zobj_ptr_ptr = &EG(This);
zend_error(E_STRICT, "Non-static method %s::%s() cannot be called statically, assuming $this from compatible context %s", (*ce_ptr)->name, fptr->common.function_name, Z_OBJCE_P(EG(This))->name);
} else {
zend_error(E_STRICT, "Non-static method %s::%s() cannot be called statically", (*ce_ptr)->name, fptr->common.function_name);
}
zend_error(E_STRICT, "Non-static method %s::%s() cannot be called statically", (*ce_ptr)->name, fptr->common.function_name);
}
}
if (retval && (check_flags & IS_CALLABLE_CHECK_NO_ACCESS) == 0) {
if (fptr->op_array.fn_flags & ZEND_ACC_PRIVATE) {
if (!zend_check_private(fptr, *zobj_ptr_ptr ? Z_OBJCE_PP(*zobj_ptr_ptr) : EG(scope), lmname, mlen TSRMLS_CC)) {
if (!zend_check_private(fptr, zobj_ptr ? Z_OBJCE_PP(zobj_ptr) : EG(scope), lmname, mlen TSRMLS_CC)) {
retval = 0;
}
} else if ((fptr->common.fn_flags & ZEND_ACC_PROTECTED)) {
@@ -2116,9 +2063,6 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char **
zend_function *fptr_local;
zval **zobj_ptr_local;
if (callable_name) {
*callable_name = NULL;
}
if (callable_name_len == NULL) {
callable_name_len = &callable_name_len_local;
}
@@ -2145,7 +2089,7 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char **
return 1;
}
retval = zend_is_callable_check_func(check_flags|IS_CALLABLE_CHECK_IS_STATIC, zobj_ptr_ptr, NULL, callable, ce_ptr, fptr_ptr TSRMLS_CC);
retval = zend_is_callable_check_func(check_flags|IS_CALLABLE_CHECK_IS_STATIC, NULL, NULL, callable, ce_ptr, fptr_ptr TSRMLS_CC);
break;
case IS_ARRAY:
@@ -2177,15 +2121,23 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char **
return 1;
}
lcname = zend_str_tolower_dup(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj));
if (Z_STRLEN_PP(obj) == sizeof("self") - 1 && memcmp(lcname, "self", sizeof("self")) == 0) {
ce = EG(active_op_array)->scope;
} else if (Z_STRLEN_PP(obj) == sizeof("parent") - 1 && memcmp(lcname, "parent", sizeof("parent")) == 0 && EG(active_op_array)->scope) {
ce = EG(active_op_array)->scope->parent;
} else if (zend_lookup_class(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj), &pce TSRMLS_CC) == SUCCESS) {
if (zend_lookup_class(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj), &pce TSRMLS_CC) == SUCCESS) {
ce = *pce;
} else if (EG(active_op_array)) {
lcname = zend_str_tolower_dup(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj));
if (Z_STRLEN_PP(obj) == sizeof("self") - 1 && memcmp(lcname, "self", sizeof("self")) == 0) {
ce = EG(active_op_array)->scope;
} else if (Z_STRLEN_PP(obj) == sizeof("parent") - 1 && memcmp(lcname, "parent", sizeof("parent")) == 0 && EG(active_op_array)->scope) {
ce = EG(active_op_array)->scope->parent;
}
efree(lcname);
}
if (EG(This)) {
if (instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) {
*zobj_ptr_ptr = &EG(This);
zend_error(E_STRICT, "Non-static method %s::%s() cannot be called statically, assuming $this from compatible context %s", ce->name, Z_STRVAL_PP(method), Z_OBJCE_P(EG(This))->name);
}
}
efree(lcname);
} else {
ce = Z_OBJCE_PP(obj); /* TBFixed: what if it's overloaded? */
@@ -2210,7 +2162,7 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char **
}
if (ce) {
retval = zend_is_callable_check_func(check_flags, zobj_ptr_ptr, ce, *method, ce_ptr, fptr_ptr TSRMLS_CC);
retval = zend_is_callable_check_func(check_flags, *zobj_ptr_ptr, ce, *method, ce_ptr, fptr_ptr TSRMLS_CC);
}
} else if (callable_name) {
*callable_name = estrndup("Array", sizeof("Array")-1);
@@ -2443,20 +2395,6 @@ ZEND_API int zend_declare_class_constant(zend_class_entry *ce, char *name, size_
return zend_hash_update(&ce->constants_table, name, name_length+1, &value, sizeof(zval *), NULL);
}
ZEND_API int zend_declare_class_constant_null(zend_class_entry *ce, char *name, size_t name_length TSRMLS_DC)
{
zval *constant;
if (ce->type & ZEND_INTERNAL_CLASS) {
constant = malloc(sizeof(zval));
} else {
ALLOC_ZVAL(constant);
}
ZVAL_NULL(constant);
INIT_PZVAL(constant);
return zend_declare_class_constant(ce, name, name_length, constant TSRMLS_CC);
}
ZEND_API int zend_declare_class_constant_long(zend_class_entry *ce, char *name, size_t name_length, long value TSRMLS_DC)
{
zval *constant;
-3
View File
@@ -50,9 +50,7 @@ typedef struct _zend_function_entry {
#define ZEND_NAMED_FE(zend_name, name, arg_info) ZEND_FENTRY(zend_name, name, arg_info, 0)
#define ZEND_FE(name, arg_info) ZEND_FENTRY(name, ZEND_FN(name), arg_info, 0)
#define ZEND_DEP_FE(name, arg_info) ZEND_FENTRY(name, ZEND_FN(name), arg_info, ZEND_ACC_DEPRECATED)
#define ZEND_FALIAS(name, alias, arg_info) ZEND_FENTRY(name, ZEND_FN(alias), arg_info, 0)
#define ZEND_DEP_FALIAS(name, alias, arg_info) ZEND_FENTRY(name, ZEND_FN(alias), arg_info, ZEND_ACC_DEPRECATED)
#define ZEND_ME(classname, name, arg_info, flags) ZEND_FENTRY(name, ZEND_FN(classname##_##name), arg_info, flags)
#define ZEND_ABSTRACT_ME(classname, name, arg_info) ZEND_FENTRY(name, NULL, arg_info, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT)
#define ZEND_MALIAS(classname, name, alias, arg_info, flags) \
@@ -223,7 +221,6 @@ ZEND_API int zend_declare_property_string(zend_class_entry *ce, char *name, int
ZEND_API int zend_declare_property_stringl(zend_class_entry *ce, char *name, int name_length, char *value, int value_len, int access_type TSRMLS_DC);
ZEND_API int zend_declare_class_constant(zend_class_entry *ce, char *name, size_t name_length, zval *value TSRMLS_DC);
ZEND_API int zend_declare_class_constant_null(zend_class_entry *ce, char *name, size_t name_length TSRMLS_DC);
ZEND_API int zend_declare_class_constant_long(zend_class_entry *ce, char *name, size_t name_length, long value TSRMLS_DC);
ZEND_API int zend_declare_class_constant_bool(zend_class_entry *ce, char *name, size_t name_length, zend_bool value TSRMLS_DC);
ZEND_API int zend_declare_class_constant_double(zend_class_entry *ce, char *name, size_t name_length, double value TSRMLS_DC);
-8
View File
@@ -40,14 +40,6 @@ ZEND_BEGIN_ARG_INFO(fourth_arg_force_ref, 0)
ZEND_ARG_PASS_INFO(1)
ZEND_END_ARG_INFO();
ZEND_BEGIN_ARG_INFO(fifth_arg_force_ref, 0)
ZEND_ARG_PASS_INFO(0)
ZEND_ARG_PASS_INFO(0)
ZEND_ARG_PASS_INFO(0)
ZEND_ARG_PASS_INFO(0)
ZEND_ARG_PASS_INFO(1)
ZEND_END_ARG_INFO();
ZEND_BEGIN_ARG_INFO(all_args_by_ref, 1)
ZEND_END_ARG_INFO();
+4 -23
View File
@@ -314,12 +314,6 @@ ZEND_FUNCTION(strncmp)
convert_to_string_ex(s1);
convert_to_string_ex(s2);
convert_to_long_ex(s3);
if (Z_LVAL_PP(s3) < 0) {
zend_error(E_WARNING, "Length must be greater than or equal to 0");
RETURN_FALSE;
}
RETURN_LONG(zend_binary_zval_strncmp(*s1, *s2, *s3));
}
/* }}} */
@@ -353,12 +347,6 @@ ZEND_FUNCTION(strncasecmp)
convert_to_string_ex(s1);
convert_to_string_ex(s2);
convert_to_long_ex(s3);
if (Z_LVAL_PP(s3) < 0) {
zend_error(E_WARNING, "Length must be greater than or equal to 0");
RETURN_FALSE;
}
RETURN_LONG(zend_binary_zval_strncasecmp(*s1, *s2, *s3));
}
/* }}} */
@@ -780,16 +768,11 @@ ZEND_FUNCTION(get_object_vars)
RETURN_FALSE;
}
properties = Z_OBJ_HT_PP(obj)->get_properties(*obj TSRMLS_CC);
if (properties == NULL) {
RETURN_FALSE;
}
instanceof = EG(This) && instanceof_function(Z_OBJCE_P(EG(This)), Z_OBJCE_PP(obj) TSRMLS_CC);
array_init(return_value);
properties = Z_OBJ_HT_PP(obj)->get_properties(*obj TSRMLS_CC);
zend_hash_internal_pointer_reset_ex(properties, &pos);
while (zend_hash_get_current_data_ex(properties, (void **) &value, &pos) == SUCCESS) {
@@ -1710,6 +1693,8 @@ ZEND_FUNCTION(debug_print_backtrace)
}
}
array_init(return_value);
while (ptr) {
char *free_class_name = NULL;
@@ -1816,11 +1801,7 @@ ZEND_FUNCTION(debug_print_backtrace)
debug_print_backtrace_args(arg_array TSRMLS_CC);
zval_ptr_dtor(&arg_array);
}
if (filename) {
zend_printf(") called at [%s:%d]\n", filename, lineno);
} else {
ZEND_PUTS(")\n");
}
zend_printf(") called at [%s:%d]\n", filename, lineno);
include_filename = filename;
ptr = skip->prev_execute_data;
++indent;
+10 -39
View File
@@ -154,7 +154,6 @@ void zend_init_compiler_data_structures(TSRMLS_D)
void init_compiler(TSRMLS_D)
{
CG(active_op_array) = NULL;
zend_init_compiler_data_structures(TSRMLS_C);
zend_init_rsrc_list(TSRMLS_C);
zend_hash_init(&CG(filenames_table), 5, NULL, (dtor_func_t) free_estring, 0);
@@ -2941,7 +2940,13 @@ void zend_do_declare_class_constant(znode *var_name, znode *value TSRMLS_DC)
}
ALLOC_ZVAL(property);
*property = value->u.constant;
if (value) {
*property = value->u.constant;
} else {
INIT_PZVAL(property);
property->type = IS_NULL;
}
if (zend_hash_add(&CG(active_class_entry)->constants_table, var_name->u.constant.value.str.val, var_name->u.constant.value.str.len+1, &property, sizeof(zval *), NULL)==FAILURE) {
FREE_ZVAL(property);
@@ -3090,33 +3095,6 @@ void zend_do_end_new_object(znode *result, znode *new_token, znode *argument_lis
*result = CG(active_op_array)->opcodes[new_token->u.opline_num].result;
}
static int zend_constant_ct_subst(znode *result, zval *const_name TSRMLS_DC)
{
zend_constant *c = NULL;
if (zend_hash_find(EG(zend_constants), Z_STRVAL_P(const_name), Z_STRLEN_P(const_name)+1, (void **) &c) == FAILURE) {
char *lookup_name = zend_str_tolower_dup(Z_STRVAL_P(const_name), Z_STRLEN_P(const_name));
if (zend_hash_find(EG(zend_constants), lookup_name, Z_STRLEN_P(const_name)+1, (void **) &c)==SUCCESS) {
if ((c->flags & CONST_CS) && memcmp(c->name, Z_STRVAL_P(const_name), Z_STRLEN_P(const_name))!=0) {
c = NULL;
}
} else {
c = NULL;
}
efree(lookup_name);
}
if (c && (c->flags & CONST_CT_SUBST)) {
zval_dtor(const_name);
result->op_type = IS_CONST;
result->u.constant = c->value;
zval_copy_ctor(&result->u.constant);
INIT_PZVAL(&result->u.constant);
return 1;
}
return 0;
}
void zend_do_fetch_constant(znode *result, znode *constant_container, znode *constant_name, int mode TSRMLS_DC)
{
switch (mode) {
@@ -3124,15 +3102,13 @@ void zend_do_fetch_constant(znode *result, znode *constant_container, znode *con
if (constant_container) {
zend_do_fetch_class_name(NULL, constant_container, constant_name TSRMLS_CC);
*result = *constant_container;
result->u.constant.type = IS_CONSTANT;
} else if (!zend_constant_ct_subst(result, &constant_name->u.constant TSRMLS_CC)) {
} else {
*result = *constant_name;
result->u.constant.type = IS_CONSTANT;
}
result->u.constant.type = IS_CONSTANT;
break;
case ZEND_RT:
if (constant_container ||
!zend_constant_ct_subst(result, &constant_name->u.constant TSRMLS_CC)) {
{
zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
opline->opcode = ZEND_FETCH_CONSTANT;
@@ -3251,9 +3227,6 @@ void zend_do_add_static_array_element(znode *result, znode *offset, znode *expr)
case IS_DOUBLE:
zend_hash_index_update(result->u.constant.value.ht, (long)offset->u.constant.value.dval, &element, sizeof(zval *), NULL);
break;
case IS_CONSTANT_ARRAY:
zend_error(E_ERROR, "Illegal offset type");
break;
}
} else {
zend_hash_next_index_insert(result->u.constant.value.ht, &element, sizeof(zval *), NULL);
@@ -3782,8 +3755,6 @@ void zend_do_declare_stmt(znode *var, znode *val TSRMLS_DC)
}
efree(val->u.constant.value.str.val);
#endif /* ZEND_MULTIBYTE */
} else {
zval_dtor(&val->u.constant);
}
zval_dtor(&var->u.constant);
}
-4
View File
@@ -136,9 +136,6 @@ typedef struct _zend_try_catch_element {
/* shadow of parent's private method/property */
#define ZEND_ACC_SHADOW 0x20000
/* deprecation flag */
#define ZEND_ACC_DEPRECATED 0x40000
char *zend_visibility_string(zend_uint fn_flags);
@@ -517,7 +514,6 @@ ZEND_API void zend_destroy_file_handle(zend_file_handle *file_handle TSRMLS_DC);
ZEND_API void zend_file_handle_dtor(zend_file_handle *fh);
ZEND_API int zend_cleanup_class_data(zend_class_entry **pce TSRMLS_DC);
ZEND_API int zend_cleanup_function_data(zend_function *function TSRMLS_DC);
ZEND_API int zend_cleanup_function_data_full(zend_function *function TSRMLS_DC);
ZEND_API void destroy_zend_function(zend_function *function TSRMLS_DC);
ZEND_API void zend_function_dtor(zend_function *function);
+14 -5
View File
@@ -5,7 +5,7 @@
| Copyright (c) 1998-2006 Zend Technologies Ltd. (http://www.zend.com) |
+----------------------------------------------------------------------+
| This source file is subject to version 2.00 of the Zend license, |
| that is bundled with this package in the file LICENSE, and is |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.zend.com/license/2_00.txt. |
| If you did not receive a copy of the Zend license and are unable to |
@@ -23,9 +23,8 @@
#define ZEND_CONFIG_W32_H
#define USE_ZEND_ALLOC 1
#include <../main/config.w32.h>
#define HAVE_ALLOCA 1
#define HAVE_LIMITS_H 1
#define _CRTDBG_MAP_ALLOC
#include <malloc.h>
@@ -45,9 +44,19 @@
typedef unsigned long ulong;
typedef unsigned int uint;
#undef HAVE_KILL
#define HAVE_GETPID 1
/* #define HAVE_ALLOCA_H 1 */
#define HAVE_MEMCPY 1
#define HAVE_STRDUP 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_STDIOSTR_H 1
#define HAVE_CLASS_ISTDIOSTREAM
#define istdiostream stdiostream
#define HAVE_STDARG_H 1
#define HAVE_SNPRINTF 1
#define HAVE_VSNPRINTF 1
#define HAVE_STRCOLL 1
#define snprintf _snprintf
#define vsnprintf _vsnprintf
@@ -78,7 +87,7 @@ typedef unsigned int uint;
#define ZEND_DLEXPORT __declspec(dllexport)
#define ZEND_DLIMPORT __declspec(dllimport)
/* 0x00200000L is MB_SERVICE_NOTIFICATION, which is only supported under Windows NT
/* 0x00200000L is MB_SERVICE_NOTIFICATION, which is only supported under Windows NT
* (and requires _WIN32_WINNT to be defined, which prevents the resulting executable
* from running under Windows 9x
* Windows 9x should silently ignore it, so it's being used here directly
+15 -18
View File
@@ -55,13 +55,11 @@ void zend_copy_constants(HashTable *target, HashTable *source)
static int clean_non_persistent_constant(zend_constant *c TSRMLS_DC)
{
return (c->flags & CONST_PERSISTENT) ? ZEND_HASH_APPLY_STOP : ZEND_HASH_APPLY_REMOVE;
}
static int clean_non_persistent_constant_full(zend_constant *c TSRMLS_DC)
{
return (c->flags & CONST_PERSISTENT) ? 0 : 1;
if (c->flags & CONST_PERSISTENT) {
return EG(full_tables_cleanup) ? 0 : ZEND_HASH_APPLY_STOP;
} else {
return EG(full_tables_cleanup) ? 1 : ZEND_HASH_APPLY_REMOVE;
}
}
@@ -114,7 +112,8 @@ void zend_register_standard_constants(TSRMLS_D)
{
zend_constant c;
c.flags = CONST_PERSISTENT | CONST_CT_SUBST;
c.value.type = IS_BOOL;
c.flags = CONST_PERSISTENT;
c.module_number = 0;
c.name = zend_strndup(ZEND_STRL("TRUE"));
@@ -129,18 +128,16 @@ void zend_register_standard_constants(TSRMLS_D)
c.value.type = IS_BOOL;
zend_register_constant(&c TSRMLS_CC);
c.name = zend_strndup(ZEND_STRL("NULL"));
c.name_len = sizeof("NULL");
c.value.type = IS_NULL;
zend_register_constant(&c TSRMLS_CC);
c.flags = CONST_PERSISTENT;
c.name = zend_strndup(ZEND_STRL("ZEND_THREAD_SAFE"));
c.name_len = sizeof("ZEND_THREAD_SAFE");
c.value.value.lval = ZTS_V;
c.value.type = IS_BOOL;
zend_register_constant(&c TSRMLS_CC);
c.name = zend_strndup(ZEND_STRL("NULL"));
c.name_len = sizeof("NULL");
c.value.type = IS_NULL;
zend_register_constant(&c TSRMLS_CC);
}
}
@@ -156,7 +153,7 @@ int zend_shutdown_constants(TSRMLS_D)
void clean_non_persistent_constants(TSRMLS_D)
{
if (EG(full_tables_cleanup)) {
zend_hash_apply(EG(zend_constants), (apply_func_t) clean_non_persistent_constant_full TSRMLS_CC);
zend_hash_apply(EG(zend_constants), (apply_func_t) clean_non_persistent_constant TSRMLS_CC);
} else {
zend_hash_reverse_apply(EG(zend_constants), (apply_func_t) clean_non_persistent_constant TSRMLS_CC);
}
@@ -312,8 +309,8 @@ ZEND_API int zend_register_constant(zend_constant *c TSRMLS_DC)
if (!(c->flags & CONST_CS)) {
/* keep in mind that c->name_len already contains the '\0' */
lowercase_name = estrndup(c->name, c->name_len-1);
zend_str_tolower(lowercase_name, c->name_len-1);
lowercase_name = estrndup(c->name, c->name_len);
zend_str_tolower(lowercase_name, c->name_len);
name = lowercase_name;
} else {
name = c->name;
-1
View File
@@ -26,7 +26,6 @@
#define CONST_CS (1<<0) /* Case Sensitive */
#define CONST_PERSISTENT (1<<1) /* Persistent */
#define CONST_CT_SUBST (2<<1) /* Allow compile-time substitution */
#define PHP_USER_CONSTANT INT_MAX /* a constant defined in user space */
+3 -13
View File
@@ -177,8 +177,8 @@ static inline zval *_get_zval_ptr_var(znode *node, temp_variable *Ts, zend_free_
should_free->var = ptr;
if (T->str_offset.str->type != IS_STRING
|| ((int)T->str_offset.offset < 0)
|| (T->str_offset.str->value.str.len <= (int)T->str_offset.offset)) {
|| ((int)T->str_offset.offset<0)
|| (T->str_offset.str->value.str.len <= T->str_offset.offset)) {
zend_error(E_NOTICE, "Uninitialized string offset: %d", T->str_offset.offset);
ptr->value.str.val = STR_EMPTY_ALLOC();
ptr->value.str.len = 0;
@@ -545,16 +545,6 @@ static inline void zend_assign_to_object(znode *result, zval **object_ptr, znode
zval *value = get_zval_ptr(value_op, Ts, &free_value, BP_VAR_R);
zval **retval = &T(result->u.var).var.ptr;
if (*object_ptr == EG(error_zval_ptr)) {
FREE_OP(free_op2);
if (!RETURN_VALUE_UNUSED(result)) {
*retval = EG(uninitialized_zval_ptr);
PZVAL_LOCK(*retval);
}
FREE_OP(free_value);
return;
}
make_real_object(object_ptr TSRMLS_CC); /* this should modify object only if it's empty */
object = *object_ptr;
@@ -658,7 +648,7 @@ static inline void zend_assign_to_variable(znode *result, znode *op1, znode *op2
zend_error(E_WARNING, "Illegal string offset: %d", T->str_offset.offset);
break;
}
if ((int)T->str_offset.offset >= T->str_offset.str->value.str.len) {
if (T->str_offset.offset >= T->str_offset.str->value.str.len) {
zend_uint i;
if (T->str_offset.str->value.str.len==0) {
+29 -60
View File
@@ -51,7 +51,7 @@ static DWORD timeout_thread_id;
static int timeout_thread_initialized=0;
#endif
#if 0&&ZEND_DEBUG
#if ZEND_DEBUG
static void (*original_sigsegv_handler)(int);
static void zend_handle_sigsegv(int dummy)
{
@@ -95,27 +95,23 @@ static void zend_extension_deactivator(zend_extension *extension TSRMLS_DC)
}
static int clean_non_persistent_function(zend_function *function TSRMLS_DC)
static int is_not_internal_function(zend_function *function TSRMLS_DC)
{
return (function->type == ZEND_INTERNAL_FUNCTION) ? ZEND_HASH_APPLY_STOP : ZEND_HASH_APPLY_REMOVE;
if (function->type == ZEND_INTERNAL_FUNCTION) {
return EG(full_tables_cleanup) ? 0 : ZEND_HASH_APPLY_STOP;
} else {
return EG(full_tables_cleanup) ? 1 : ZEND_HASH_APPLY_REMOVE;
}
}
static int clean_non_persistent_function_full(zend_function *function TSRMLS_DC)
static int is_not_internal_class(zend_class_entry **ce TSRMLS_DC)
{
return (function->type != ZEND_INTERNAL_FUNCTION);
}
static int clean_non_persistent_class(zend_class_entry **ce TSRMLS_DC)
{
return ((*ce)->type == ZEND_INTERNAL_CLASS) ? ZEND_HASH_APPLY_STOP : ZEND_HASH_APPLY_REMOVE;
}
static int clean_non_persistent_class_full(zend_class_entry **ce TSRMLS_DC)
{
return ((*ce)->type != ZEND_INTERNAL_CLASS);
if ((*ce)->type == ZEND_INTERNAL_CLASS) {
return EG(full_tables_cleanup) ? 0 : ZEND_HASH_APPLY_STOP;
} else {
return EG(full_tables_cleanup) ? 1 : ZEND_HASH_APPLY_REMOVE;
}
}
@@ -255,22 +251,18 @@ void shutdown_executor(TSRMLS_D)
So we want first of all to clean up all data and then move to tables destruction.
Note that only run-time accessed data need to be cleaned up, pre-defined data can
not contain objects and thus are not probelmatic */
if (EG(full_tables_cleanup)) {
zend_hash_apply(EG(function_table), (apply_func_t) zend_cleanup_function_data_full TSRMLS_CC);
} else {
zend_hash_reverse_apply(EG(function_table), (apply_func_t) zend_cleanup_function_data TSRMLS_CC);
}
zend_hash_apply(EG(function_table), (apply_func_t) zend_cleanup_function_data TSRMLS_CC);
zend_hash_apply(EG(class_table), (apply_func_t) zend_cleanup_class_data TSRMLS_CC);
zend_ptr_stack_destroy(&EG(argument_stack));
/* Destroy all op arrays */
if (EG(full_tables_cleanup)) {
zend_hash_apply(EG(function_table), (apply_func_t) clean_non_persistent_function_full TSRMLS_CC);
zend_hash_apply(EG(class_table), (apply_func_t) clean_non_persistent_class_full TSRMLS_CC);
zend_hash_apply(EG(function_table), (apply_func_t) is_not_internal_function TSRMLS_CC);
zend_hash_apply(EG(class_table), (apply_func_t) is_not_internal_class TSRMLS_CC);
} else {
zend_hash_reverse_apply(EG(function_table), (apply_func_t) clean_non_persistent_function TSRMLS_CC);
zend_hash_reverse_apply(EG(class_table), (apply_func_t) clean_non_persistent_class TSRMLS_CC);
zend_hash_reverse_apply(EG(function_table), (apply_func_t) is_not_internal_function TSRMLS_CC);
zend_hash_reverse_apply(EG(class_table), (apply_func_t) is_not_internal_class TSRMLS_CC);
}
while (EG(symtable_cache_ptr)>=EG(symtable_cache)) {
@@ -286,7 +278,7 @@ void shutdown_executor(TSRMLS_D)
} zend_end_try();
zend_try {
#if 0&&ZEND_DEBUG
#if ZEND_DEBUG
signal(SIGSEGV, original_sigsegv_handler);
#endif
@@ -490,7 +482,7 @@ ZEND_API int zval_update_constant(zval **pp, void *arg TSRMLS_DC)
continue;
}
if (const_value.type == IS_STRING && const_value.value.str.len == (int)str_index_len-1 &&
if (const_value.type == IS_STRING && const_value.value.str.len == str_index_len-1 &&
!strncmp(const_value.value.str.val, str_index, str_index_len)) {
/* constant value is the same as its name */
zval_dtor(&const_value);
@@ -590,7 +582,6 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
zend_op **original_opline_ptr;
zend_class_entry *current_scope;
zend_class_entry *calling_scope = NULL;
zend_class_entry *check_scope_or_static = NULL;
zval *current_this;
zend_execute_data execute_data;
zval *method_name;
@@ -616,7 +607,6 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
execute_data = *EG(current_execute_data);
EX(op_array) = NULL;
EX(opline) = NULL;
EX(object) = NULL;
} else {
/* This only happens when we're called outside any execute()'s
* It shouldn't be strictly necessary to NULL execute_data out,
@@ -672,7 +662,6 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
ce = &(EG(active_op_array)->scope);
found = (*ce != NULL?SUCCESS:FAILURE);
fci->object_pp = EG(This)?&EG(This):NULL;
EX(object) = EG(This);
} else if (strcmp(Z_STRVAL_PP(fci->object_pp), "parent") == 0 && EG(active_op_array)) {
if (!EG(active_op_array)->scope) {
@@ -684,7 +673,6 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
ce = &(EG(active_op_array)->scope->parent);
found = (*ce != NULL?SUCCESS:FAILURE);
fci->object_pp = EG(This)?&EG(This):NULL;
EX(object) = EG(This);
} else {
zend_class_entry *scope;
scope = EG(active_op_array) ? EG(active_op_array)->scope : NULL;
@@ -697,7 +685,6 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
instanceof_function(Z_OBJCE_P(EG(This)), scope TSRMLS_CC) &&
instanceof_function(scope, *ce TSRMLS_CC)) {
fci->object_pp = &EG(This);
EX(object) = EG(This);
} else {
fci->object_pp = NULL;
}
@@ -726,18 +713,16 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
if (calling_scope && (colon = strstr(fname, "::")) != NULL) {
int clen = colon - fname;
int mlen = fname_len - clen - 2;
zend_class_entry **pce, *ce_child = NULL;
zend_class_entry **pce, *ce_child;
if (zend_lookup_class(fname, clen, &pce TSRMLS_CC) == SUCCESS) {
ce_child = *pce;
} else {
char *lcname = zend_str_tolower_dup(fname, clen);
/* caution: lcname is not '\0' terminated */
if (calling_scope) {
if (clen == sizeof("self") - 1 && memcmp(lcname, "self", sizeof("self") - 1) == 0) {
ce_child = EG(active_op_array) ? EG(active_op_array)->scope : NULL;
} else if (clen == sizeof("parent") - 1 && memcmp(lcname, "parent", sizeof("parent") - 1) == 0 && EG(active_op_array)->scope) {
ce_child = EG(active_op_array) && EG(active_op_array)->scope ? EG(scope)->parent : NULL;
}
if (clen == sizeof("self") - 1 && memcmp(lcname, "self", sizeof("self") - 1) == 0) {
ce_child = EG(active_op_array) ? EG(active_op_array)->scope : NULL;
} else if (clen == sizeof("parent") - 1 && memcmp(lcname, "parent", sizeof("parent") - 1) == 0 && EG(active_op_array)->scope) {
ce_child = EG(active_op_array) && EG(active_op_array)->scope ? EG(scope)->parent : NULL;
}
efree(lcname);
}
@@ -745,7 +730,10 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
zend_error(E_ERROR, "Cannot call method %s() or method does not exist", fname);
return FAILURE;
}
check_scope_or_static = calling_scope;
if (!instanceof_function(calling_scope, ce_child TSRMLS_CC)) {
zend_error(E_ERROR, "Cannot call method %s() of class %s which is not a derived from %s", fname, ce_child->name, calling_scope->name);
return 0;
}
fci->function_table = &ce_child->function_table;
calling_scope = ce_child;
fname = fname + clen + 2;
@@ -772,12 +760,6 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
EX(function_state).function =
zend_std_get_static_method(calling_scope, function_name_lc, fname_len TSRMLS_CC);
efree(function_name_lc);
if (check_scope_or_static && EX(function_state).function
&& !(EX(function_state).function->common.fn_flags & ZEND_ACC_STATIC)
&& !instanceof_function(check_scope_or_static, calling_scope TSRMLS_CC)) {
zend_error(E_ERROR, "Cannot call method %s() of class %s which is not a derived from %s", fname, calling_scope->name, check_scope_or_static->name);
return 0;
}
} else {
char *function_name_lc = zend_str_tolower_dup(fname, fname_len);
@@ -814,19 +796,6 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
EX(function_state).function = fci_cache->function_handler;
calling_scope = fci_cache->calling_scope;
fci->object_pp = fci_cache->object_pp;
EX(object) = fci->object_pp ? *fci->object_pp : NULL;
}
if (EX(function_state).function->common.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_DEPRECATED)) {
if (EX(function_state).function->common.fn_flags & ZEND_ACC_ABSTRACT) {
zend_error_noreturn(E_ERROR, "Cannot call abstract method %s::%s()", EX(function_state).function->common.scope->name, EX(function_state).function->common.function_name);
}
if (EX(function_state).function->common.fn_flags & ZEND_ACC_DEPRECATED) {
zend_error(E_STRICT, "Function %s%s%s() is deprecated",
EX(function_state).function->common.scope ? EX(function_state).function->common.scope->name : "",
EX(function_state).function->common.scope ? "::" : "",
EX(function_state).function->common.function_name);
}
}
for (i=0; i<fci->param_count; i++) {
+18 -16
View File
@@ -102,14 +102,14 @@ ZEND_API ulong zend_hash_func(char *arKey, uint nKeyLength)
#define UPDATE_DATA(ht, p, pData, nDataSize) \
if (nDataSize == sizeof(void*)) { \
if ((p)->pData != &(p)->pDataPtr) { \
pefree_rel((p)->pData, (ht)->persistent); \
if (!(p)->pDataPtr) { \
pefree_rel((p)->pData, (ht)->persistent); \
} \
memcpy(&(p)->pDataPtr, pData, sizeof(void *)); \
(p)->pData = &(p)->pDataPtr; \
} else { \
if ((p)->pData == &(p)->pDataPtr) { \
(p)->pData = (void *) pemalloc_rel(nDataSize, (ht)->persistent); \
if ((p)->pDataPtr) { \
(p)->pData = (void *) pemalloc_rel(nDataSize, (ht)->persistent); \
(p)->pDataPtr=NULL; \
} else { \
(p)->pData = (void *) perealloc_rel((p)->pData, nDataSize, (ht)->persistent); \
@@ -123,9 +123,9 @@ ZEND_API ulong zend_hash_func(char *arKey, uint nKeyLength)
memcpy(&(p)->pDataPtr, pData, sizeof(void *)); \
(p)->pData = &(p)->pDataPtr; \
} else { \
(p)->pData = (void *) pemalloc_rel(nDataSize, (ht)->persistent);\
(p)->pData = (void *) pemalloc_rel(nDataSize, (ht)->persistent); \
if (!(p)->pData) { \
pefree_rel(p, (ht)->persistent); \
pefree_rel(p, (ht)->persistent); \
return FAILURE; \
} \
memcpy((p)->pData, pData, nDataSize); \
@@ -461,10 +461,8 @@ ZEND_API int zend_hash_del_key_or_index(HashTable *ht, char *arKey, uint nKeyLen
p = ht->arBuckets[nIndex];
while (p != NULL) {
if ((p->h == h)
&& (p->nKeyLength == nKeyLength)
&& ((p->nKeyLength == 0) /* Numeric index (short circuits the memcmp() check) */
|| !memcmp(p->arKey, arKey, nKeyLength))) { /* String index */
if ((p->h == h) && ((p->nKeyLength == 0) || /* Numeric index */
((p->nKeyLength == nKeyLength) && (!memcmp(p->arKey, arKey, nKeyLength))))) {
HANDLE_BLOCK_INTERRUPTIONS();
if (p == ht->arBuckets[nIndex]) {
ht->arBuckets[nIndex] = p->pNext;
@@ -491,7 +489,7 @@ ZEND_API int zend_hash_del_key_or_index(HashTable *ht, char *arKey, uint nKeyLen
if (ht->pDestructor) {
ht->pDestructor(p->pData);
}
if (p->pData != &p->pDataPtr) {
if (!p->pDataPtr) {
pefree(p->pData, ht->persistent);
}
pefree(p, ht->persistent);
@@ -520,7 +518,7 @@ ZEND_API void zend_hash_destroy(HashTable *ht)
if (ht->pDestructor) {
ht->pDestructor(q->pData);
}
if (q->pData != &q->pDataPtr) {
if (!q->pDataPtr && q->pData) {
pefree(q->pData, ht->persistent);
}
pefree(q, ht->persistent);
@@ -546,7 +544,7 @@ ZEND_API void zend_hash_clean(HashTable *ht)
if (ht->pDestructor) {
ht->pDestructor(q->pData);
}
if (q->pData != &q->pDataPtr) {
if (!q->pDataPtr && q->pData) {
pefree(q->pData, ht->persistent);
}
pefree(q, ht->persistent);
@@ -575,7 +573,7 @@ static Bucket *zend_hash_apply_deleter(HashTable *ht, Bucket *p)
if (ht->pDestructor) {
ht->pDestructor(p->pData);
}
if (p->pData != &p->pDataPtr) {
if (!p->pDataPtr) {
pefree(p->pData, ht->persistent);
}
retval = p->pListNext;
@@ -734,7 +732,11 @@ ZEND_API void zend_hash_reverse_apply(HashTable *ht, apply_func_t apply_func TSR
q = p;
p = p->pListLast;
if (result & ZEND_HASH_APPLY_REMOVE) {
zend_hash_apply_deleter(ht, q);
if (q->nKeyLength>0) {
zend_hash_del(ht, q->arKey, q->nKeyLength);
} else {
zend_hash_index_del(ht, q->h);
}
}
if (result & ZEND_HASH_APPLY_STOP) {
break;
@@ -1257,7 +1259,7 @@ ZEND_API int zend_hash_sort(HashTable *ht, sort_func_t sort_func,
ZEND_API int zend_hash_compare(HashTable *ht1, HashTable *ht2, compare_func_t compar, zend_bool ordered TSRMLS_DC)
{
Bucket *p1, *p2 = NULL;
Bucket *p1, *p2;
int result;
void *pData2;
+6 -7
View File
@@ -249,26 +249,25 @@ string_or_value:
expr { $$ = $1; }
| CFG_TRUE { $$ = $1; }
| CFG_FALSE { $$ = $1; }
| var_string_list { $$ = $1; }
| '\n' { zend_ini_init_string(&$$); }
| /* empty */ { zend_ini_init_string(&$$); }
;
var_string_list:
cfg_var_ref { $$ = $1; }
| TC_ENCAPSULATED_STRING { $$ = $1; }
| constant_string { $$ = $1; }
| var_string_list cfg_var_ref { zend_ini_add_string(&$$, &$1, &$2); free($2.value.str.val); }
var_string_list cfg_var_ref { zend_ini_add_string(&$$, &$1, &$2); free($2.value.str.val); }
| var_string_list TC_ENCAPSULATED_STRING { zend_ini_add_string(&$$, &$1, &$2); free($2.value.str.val); }
| var_string_list constant_string { zend_ini_add_string(&$$, &$1, &$2); free($2.value.str.val); }
| var_string_list constant_string { zend_ini_add_string(&$$, &$1, &$2); }
| /* empty */ { zend_ini_init_string(&$$); }
;
cfg_var_ref:
TC_DOLLAR_CURLY TC_STRING '}' { zend_ini_get_var(&$$, &$2); free($2.value.str.val); }
TC_DOLLAR_CURLY TC_STRING '}' { zend_ini_get_var(&$$, &$2); }
;
expr:
var_string_list { $$ = $1; }
constant_string { $$ = $1; }
| expr '|' expr { zend_ini_do_op('|', &$$, &$1, &$3); }
| expr '&' expr { zend_ini_do_op('&', &$$, &$1, &$3); }
| '~' expr { zend_ini_do_op('~', &$$, &$2, NULL); }
-10
View File
@@ -139,18 +139,8 @@ NEWLINE ("\r"|"\n"|"\r\n")
<INITIAL>["][^"]*["] {
char *p = yytext;
/* ENCAPSULATED TC_STRING */
while ((p = strpbrk(p, "\r\n"))) {
if (*p == '\r' && *(p + 1) == '\n') {
p++;
}
SCNG(lineno)++;
p++;
}
/* eat trailing " */
yytext[yyleng-1]=0;
+2 -2
View File
@@ -287,7 +287,7 @@ static zend_object_iterator *zend_user_it_get_new_iterator(zend_class_entry *ce,
if (!ce || !ce_it || !ce_it->get_iterator || (ce_it->get_iterator == zend_user_it_get_new_iterator && iterator == object)) {
if (!EG(exception))
{
zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "Objects returned by %s::getIterator() must be traversable or implement interface Iterator", ce ? ce->name : Z_OBJCE_P(object)->name);
zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "Objects returned by %s::getIterator() must be traversable or implement interface Iterator", ce->name);
}
if (iterator)
{
@@ -336,7 +336,7 @@ static int zend_implement_aggregate(zend_class_entry *interface, zend_class_entr
} else if (class_type->get_iterator != zend_user_it_get_new_iterator) {
/* c-level get_iterator cannot be changed (exception being only Traversable is implmented) */
if (class_type->num_interfaces) {
for (i = 0; i < (int)class_type->num_interfaces; i++) {
for (i = 0; i < class_type->num_interfaces; i++) {
if (class_type->interfaces[i] == zend_ce_iterator) {
return FAILURE;
}
+1 -1
View File
@@ -501,7 +501,7 @@ method_body:
variable_modifiers:
non_empty_member_modifiers { $$ = $1; }
| T_VAR { $$.u.constant.value.lval = ZEND_ACC_PUBLIC; }
| T_VAR { zend_error(E_STRICT, "var: Deprecated. Please use the public/private/protected modifiers"); $$.u.constant.value.lval = ZEND_ACC_PUBLIC; }
;
method_modifiers:
+3 -3
View File
@@ -1461,7 +1461,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
yymore();
}
<ST_ONE_LINE_COMMENT>[^\n\r?%>]*{ANY_CHAR} {
<ST_ONE_LINE_COMMENT>[^\n\r?%>]+{ANY_CHAR} {
switch (yytext[yyleng-1]) {
case '?': case '%': case '>':
yyless(yyleng-1);
@@ -1491,7 +1491,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
<ST_ONE_LINE_COMMENT>"?>"|"%>" {
if (CG(asp_tags) || yytext[yyleng-2] != '%') { /* asp comment? */
zendlval->value.str.val = yytext; /* no copying - intentional */
zendlval->value.str.len = yyleng-2;
zendlval->value.str.len = yyleng;
zendlval->type = IS_STRING;
yyless(yyleng-2);
BEGIN(ST_IN_SCRIPTING);
@@ -1734,6 +1734,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
<ST_HEREDOC>^{LABEL}(";")?{NEWLINE} {
int label_len;
CG(zend_lineno)++;
if (yytext[yyleng-2]=='\r') {
label_len = yyleng-2;
} else {
@@ -1754,7 +1755,6 @@ NEWLINE ("\r"|"\n"|"\r\n")
BEGIN(ST_IN_SCRIPTING);
return T_END_HEREDOC;
} else {
CG(zend_lineno)++;
zend_copy_value(zendlval, yytext, yyleng);
zendlval->type = IS_STRING;
return T_STRING;
-1
View File
@@ -36,7 +36,6 @@ extern struct _zend_arg_info first_arg_force_ref[2];
extern struct _zend_arg_info second_arg_force_ref[3];
extern struct _zend_arg_info third_arg_force_ref[4];
extern struct _zend_arg_info fourth_arg_force_ref[5];
extern struct _zend_arg_info fifth_arg_force_ref[6];
extern struct _zend_arg_info all_args_by_ref[1];
#define ZEND_MODULE_API_NO 20050922
+6 -21
View File
@@ -25,26 +25,6 @@
#include "zend_API.h"
#include "zend_interfaces.h"
ZEND_API void zend_object_std_init(zend_object *object, zend_class_entry *ce TSRMLS_DC)
{
ALLOC_HASHTABLE(object->properties);
zend_hash_init(object->properties, 0, NULL, ZVAL_PTR_DTOR, 0);
object->ce = ce;
object->guards = NULL;
}
ZEND_API void zend_object_std_dtor(zend_object *object TSRMLS_DC)
{
if (object->guards) {
zend_hash_destroy(object->guards);
FREE_HASHTABLE(object->guards);
}
if (object->properties) {
zend_hash_destroy(object->properties);
FREE_HASHTABLE(object->properties);
}
}
ZEND_API void zend_objects_destroy_object(zend_object *object, zend_object_handle handle TSRMLS_DC)
{
@@ -108,7 +88,12 @@ ZEND_API void zend_objects_destroy_object(zend_object *object, zend_object_handl
ZEND_API void zend_objects_free_object_storage(zend_object *object TSRMLS_DC)
{
zend_object_std_dtor(object TSRMLS_CC);
if (object->guards) {
zend_hash_destroy(object->guards);
FREE_HASHTABLE(object->guards);
}
zend_hash_destroy(object->properties);
FREE_HASHTABLE(object->properties);
efree(object);
}
-2
View File
@@ -25,8 +25,6 @@
#include "zend.h"
BEGIN_EXTERN_C()
ZEND_API void zend_object_std_init(zend_object *object, zend_class_entry *ce TSRMLS_DC);
ZEND_API void zend_object_std_dtor(zend_object *object TSRMLS_DC);
ZEND_API zend_object_value zend_objects_new(zend_object **object, zend_class_entry *class_type TSRMLS_DC);
ZEND_API void zend_objects_destroy_object(zend_object *object, zend_object_handle handle TSRMLS_DC);
ZEND_API zend_object *zend_objects_get_address(zval *object TSRMLS_DC);
-3
View File
@@ -33,7 +33,6 @@ ZEND_API void zend_objects_store_init(zend_objects_store *objects, zend_uint ini
objects->top = 1; /* Skip 0 so that handles are true */
objects->size = init_size;
objects->free_list_head = -1;
memset(&objects->object_buckets[0], 0, sizeof(zend_object_store_bucket));
}
ZEND_API void zend_objects_store_destroy(zend_objects_store *objects)
@@ -53,9 +52,7 @@ ZEND_API void zend_objects_store_call_destructors(zend_objects_store *objects TS
if (!objects->object_buckets[i].destructor_called) {
objects->object_buckets[i].destructor_called = 1;
if (obj->dtor && obj->object) {
obj->refcount++;
obj->dtor(obj->object, i TSRMLS_CC);
obj->refcount--;
}
}
}
+4 -16
View File
@@ -132,17 +132,7 @@ ZEND_API int zend_cleanup_function_data(zend_function *function TSRMLS_DC)
{
if (function->type == ZEND_USER_FUNCTION) {
zend_cleanup_op_array_data((zend_op_array *) function);
return ZEND_HASH_APPLY_KEEP;
} else {
return ZEND_HASH_APPLY_STOP;
}
}
ZEND_API int zend_cleanup_function_data_full(zend_function *function TSRMLS_DC)
{
if (function->type == ZEND_USER_FUNCTION) {
zend_cleanup_op_array_data((zend_op_array *) function);
}
}
return 0;
}
@@ -152,7 +142,7 @@ ZEND_API int zend_cleanup_class_data(zend_class_entry **pce TSRMLS_DC)
/* Clean all parts that can contain run-time data */
/* Note that only run-time accessed data need to be cleaned up, pre-defined data can
not contain objects and thus are not probelmatic */
zend_hash_apply(&(*pce)->function_table, (apply_func_t) zend_cleanup_function_data_full TSRMLS_CC);
zend_hash_apply(&(*pce)->function_table, (apply_func_t) zend_cleanup_function_data TSRMLS_CC);
(*pce)->static_members = NULL;
} else if (CE_STATIC_MEMBERS(*pce)) {
zend_hash_destroy(CE_STATIC_MEMBERS(*pce));
@@ -367,10 +357,8 @@ int pass_two(zend_op_array *op_array TSRMLS_DC)
zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_op_array_handler, op_array TSRMLS_CC);
}
if (!CG(interactive) && op_array->size != op_array->last) {
op_array->opcodes = (zend_op *) erealloc(op_array->opcodes, sizeof(zend_op)*op_array->last);
op_array->size = op_array->last;
}
op_array->opcodes = (zend_op *) erealloc(op_array->opcodes, sizeof(zend_op)*op_array->last);
op_array->size = op_array->last;
opline = op_array->opcodes;
end = opline + op_array->last;
+14 -38
View File
@@ -1267,9 +1267,9 @@ ZEND_API int numeric_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_
}
static inline void zend_free_obj_get_result(zval *op)
static inline void zend_free_obj_get_result(zval *op, int free_op)
{
if (op) {
if (free_op) {
if (op->refcount == 0) {
zval_dtor(op);
FREE_ZVAL(op);
@@ -1280,50 +1280,26 @@ static inline void zend_free_obj_get_result(zval *op)
}
#define COMPARE_RETURN_AND_FREE(retval) \
zend_free_obj_get_result(op1_free); \
zend_free_obj_get_result(op2_free); \
zend_free_obj_get_result(op1_orig, free_op1); \
zend_free_obj_get_result(op2_orig, free_op2); \
return retval;
ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
{
zval op1_copy, op2_copy;
zval *op1_free, *op2_free;
int op1_obj = op1->type == IS_OBJECT;
int op2_obj = op2->type == IS_OBJECT;
zend_bool free_op1 = 0, free_op2 = 0;
zval *op1_orig, *op2_orig;
if (op1_obj) {
if (Z_OBJ_HT_P(op1)->get) {
op1 = op1_free = Z_OBJ_HT_P(op1)->get(op1 TSRMLS_CC);
} else if (!op2_obj && Z_OBJ_HT_P(op1)->cast_object) {
ALLOC_INIT_ZVAL(op1_free);
if (Z_OBJ_HT_P(op1)->cast_object(op1, op1_free, Z_TYPE_P(op2), 0 TSRMLS_CC) == FAILURE) {
op2_free = NULL;
ZVAL_BOOL(result, 0);
COMPARE_RETURN_AND_FREE(FAILURE);
}
op1 = op1_free;
} else {
op1_free = NULL;
}
} else {
op1_free = NULL;
if (op1->type == IS_OBJECT && Z_OBJ_HT_P(op1)->get) {
op1 = Z_OBJ_HT_P(op1)->get(op1 TSRMLS_CC);
free_op1 = 1;
}
if (op2_obj) {
if (Z_OBJ_HT_P(op2)->get) {
op2 = op2_free = Z_OBJ_HT_P(op2)->get(op2 TSRMLS_CC);
} else if (!op1_obj && Z_OBJ_HT_P(op2)->cast_object) {
ALLOC_INIT_ZVAL(op2_free);
if (Z_OBJ_HT_P(op2)->cast_object(op2, op2_free, Z_TYPE_P(op1), 0 TSRMLS_CC) == FAILURE) {
ZVAL_BOOL(result, 0);
COMPARE_RETURN_AND_FREE(FAILURE);
}
op2 = op2_free;
} else {
op2_free = NULL;
}
} else {
op2_free = NULL;
op1_orig = op1;
if (op2->type == IS_OBJECT && Z_OBJ_HT_P(op2)->get) {
op2 = Z_OBJ_HT_P(op2)->get(op2 TSRMLS_CC);
free_op2 = 1;
}
op2_orig = op2;
if ((op1->type == IS_NULL && op2->type == IS_STRING)
|| (op2->type == IS_NULL && op1->type == IS_STRING)) {
+1 -18
View File
@@ -130,7 +130,6 @@ typedef unsigned long int uint32_t;
* but the word order is big endian.
*/
#define IEEE_BIG_ENDIAN
#undef IEEE_LITTLE_ENDIAN
#endif
#ifdef __vax__
@@ -1251,7 +1250,7 @@ zend_strtod
_double rv, rv0;
Long L;
ULong y, z;
Bigint *bb, *bb1, *bd, *bd0, *bs, *delta, *tmp;
Bigint *bb, *bb1, *bd, *bd0, *bs, *delta;
double result;
CONST char decimal_point = '.';
@@ -1777,21 +1776,5 @@ zend_strtod
if (se)
*se = (char *)s;
result = sign ? -value(rv) : value(rv);
for (i = 0; i <= Kmax; i++) {
Bigint **listp = &freelist[i];
while ((tmp = *listp) != NULL) {
*listp = tmp->next;
free(tmp);
}
freelist[i] = NULL;
}
while (p5s) {
tmp = p5s;
p5s = p5s->next;
free(tmp);
}
return result;
}
+8 -42
View File
@@ -1723,15 +1723,6 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, ANY, CONST|TMP|VAR|UNUSED|CV)
if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) {
EX(object) = NULL;
} else {
if (OP2_TYPE != IS_UNUSED &&
EG(This) &&
Z_OBJ_HT_P(EG(This))->get_class_entry &&
!instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) {
/* We are calling method of the other (incompatible) class,
but passing $this. This is done for compatibility with php-4. */
zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name);
}
if ((EX(object) = EG(This))) {
EX(object)->refcount++;
}
@@ -1793,17 +1784,9 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
zend_bool should_change_scope;
zend_op *ctor_opline;
if (EX(function_state).function->common.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_DEPRECATED)) {
if (EX(function_state).function->common.fn_flags & ZEND_ACC_ABSTRACT) {
zend_error_noreturn(E_ERROR, "Cannot call abstract method %s::%s()", EX(function_state).function->common.scope->name, EX(function_state).function->common.function_name);
ZEND_VM_NEXT_OPCODE(); /* Never reached */
}
if (EX(function_state).function->common.fn_flags & ZEND_ACC_DEPRECATED) {
zend_error(E_STRICT, "Function %s%s%s() is deprecated",
EX(function_state).function->common.scope ? EX(function_state).function->common.scope->name : "",
EX(function_state).function->common.scope ? "::" : "",
EX(function_state).function->common.function_name);
};
if (EX(function_state).function->common.fn_flags & ZEND_ACC_ABSTRACT) {
zend_error_noreturn(E_ERROR, "Cannot call abstract method %s::%s()", EX(function_state).function->common.scope->name, EX(function_state).function->common.function_name);
ZEND_VM_NEXT_OPCODE(); /* Never reached */
}
zend_ptr_stack_2_push(&EG(argument_stack), (void *) opline->extended_value, NULL);
@@ -3000,9 +2983,7 @@ ZEND_VM_HANDLER(77, ZEND_FE_RESET, CONST|TMP|VAR|CV, ANY)
}
array_ptr = *array_ptr_ptr;
} else {
if (Z_TYPE_PP(array_ptr_ptr) == IS_ARRAY) {
SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr);
}
SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr);
array_ptr = *array_ptr_ptr;
array_ptr->refcount++;
}
@@ -3017,20 +2998,7 @@ ZEND_VM_HANDLER(77, ZEND_FE_RESET, CONST|TMP|VAR|CV, ANY)
} else if (Z_TYPE_P(array_ptr) == IS_OBJECT) {
ce = Z_OBJCE_P(array_ptr);
} else {
if (OP1_TYPE == IS_VAR &&
free_op1.var == NULL &&
!array_ptr->is_ref &&
array_ptr->refcount > 1) {
/* non-separated return value from function */
zval *tmp;
ALLOC_ZVAL(tmp);
INIT_PZVAL_COPY(tmp, array_ptr);
zval_copy_ctor(tmp);
array_ptr = tmp;
} else {
array_ptr->refcount++;
}
array_ptr->refcount++;
}
}
@@ -3118,7 +3086,7 @@ ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY)
HashTable *fe_ht;
zend_object_iterator *iter = NULL;
int key_type;
zend_bool use_key = (zend_bool)(opline->extended_value & ZEND_FE_FETCH_WITH_KEY);
zend_bool use_key = opline->extended_value & ZEND_FE_FETCH_WITH_KEY;
PZVAL_LOCK(array);
@@ -3236,9 +3204,7 @@ ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY)
key->value.lval = int_key;
key->type = IS_LONG;
break;
default:
ZVAL_NULL(key);
break;
EMPTY_SWITCH_DEFAULT_CASE()
}
}
@@ -3438,8 +3404,8 @@ ZEND_VM_HANDLER(148, ZEND_ISSET_ISEMPTY_PROP_OBJ, VAR|UNUSED|CV, CONST|TMP|VAR|C
ZEND_VM_HANDLER(79, ZEND_EXIT, CONST|TMP|VAR|UNUSED|CV, ANY)
{
zend_op *opline = EX(opline);
if (OP1_TYPE != IS_UNUSED) {
zend_op *opline = EX(opline);
zend_free_op free_op1;
zval *ptr = GET_OP1_ZVAL_PTR(BP_VAR_R);
+20 -135
View File
@@ -132,17 +132,9 @@ static int zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS)
zend_bool should_change_scope;
zend_op *ctor_opline;
if (EX(function_state).function->common.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_DEPRECATED)) {
if (EX(function_state).function->common.fn_flags & ZEND_ACC_ABSTRACT) {
zend_error_noreturn(E_ERROR, "Cannot call abstract method %s::%s()", EX(function_state).function->common.scope->name, EX(function_state).function->common.function_name);
ZEND_VM_NEXT_OPCODE(); /* Never reached */
}
if (EX(function_state).function->common.fn_flags & ZEND_ACC_DEPRECATED) {
zend_error(E_STRICT, "Function %s%s%s() is deprecated",
EX(function_state).function->common.scope ? EX(function_state).function->common.scope->name : "",
EX(function_state).function->common.scope ? "::" : "",
EX(function_state).function->common.function_name);
};
if (EX(function_state).function->common.fn_flags & ZEND_ACC_ABSTRACT) {
zend_error_noreturn(E_ERROR, "Cannot call abstract method %s::%s()", EX(function_state).function->common.scope->name, EX(function_state).function->common.function_name);
ZEND_VM_NEXT_OPCODE(); /* Never reached */
}
zend_ptr_stack_2_push(&EG(argument_stack), (void *) opline->extended_value, NULL);
@@ -678,15 +670,6 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_A
if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) {
EX(object) = NULL;
} else {
if (IS_CONST != IS_UNUSED &&
EG(This) &&
Z_OBJ_HT_P(EG(This))->get_class_entry &&
!instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) {
/* We are calling method of the other (incompatible) class,
but passing $this. This is done for compatibility with php-4. */
zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name);
}
if ((EX(object) = EG(This))) {
EX(object)->refcount++;
}
@@ -879,15 +862,6 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARG
if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) {
EX(object) = NULL;
} else {
if (IS_TMP_VAR != IS_UNUSED &&
EG(This) &&
Z_OBJ_HT_P(EG(This))->get_class_entry &&
!instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) {
/* We are calling method of the other (incompatible) class,
but passing $this. This is done for compatibility with php-4. */
zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name);
}
if ((EX(object) = EG(This))) {
EX(object)->refcount++;
}
@@ -1037,15 +1011,6 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARG
if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) {
EX(object) = NULL;
} else {
if (IS_VAR != IS_UNUSED &&
EG(This) &&
Z_OBJ_HT_P(EG(This))->get_class_entry &&
!instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) {
/* We are calling method of the other (incompatible) class,
but passing $this. This is done for compatibility with php-4. */
zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name);
}
if ((EX(object) = EG(This))) {
EX(object)->refcount++;
}
@@ -1194,15 +1159,6 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_
if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) {
EX(object) = NULL;
} else {
if (IS_UNUSED != IS_UNUSED &&
EG(This) &&
Z_OBJ_HT_P(EG(This))->get_class_entry &&
!instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) {
/* We are calling method of the other (incompatible) class,
but passing $this. This is done for compatibility with php-4. */
zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name);
}
if ((EX(object) = EG(This))) {
EX(object)->refcount++;
}
@@ -1284,15 +1240,6 @@ static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS
if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) {
EX(object) = NULL;
} else {
if (IS_CV != IS_UNUSED &&
EG(This) &&
Z_OBJ_HT_P(EG(This))->get_class_entry &&
!instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) {
/* We are calling method of the other (incompatible) class,
but passing $this. This is done for compatibility with php-4. */
zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name);
}
if ((EX(object) = EG(This))) {
EX(object)->refcount++;
}
@@ -2059,7 +2006,7 @@ static int ZEND_UNSET_VAR_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
static int ZEND_FE_RESET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zend_op *opline = EX(opline);
zend_free_op free_op1;
zval *array_ptr, **array_ptr_ptr;
HashTable *fe_ht;
zend_object_iterator *iter = NULL;
@@ -2083,9 +2030,7 @@ static int ZEND_FE_RESET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
}
array_ptr = *array_ptr_ptr;
} else {
if (Z_TYPE_PP(array_ptr_ptr) == IS_ARRAY) {
SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr);
}
SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr);
array_ptr = *array_ptr_ptr;
array_ptr->refcount++;
}
@@ -2100,20 +2045,7 @@ static int ZEND_FE_RESET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
} else if (Z_TYPE_P(array_ptr) == IS_OBJECT) {
ce = Z_OBJCE_P(array_ptr);
} else {
if (IS_CONST == IS_VAR &&
free_op1.var == NULL &&
!array_ptr->is_ref &&
array_ptr->refcount > 1) {
/* non-separated return value from function */
zval *tmp;
ALLOC_ZVAL(tmp);
INIT_PZVAL_COPY(tmp, array_ptr);
zval_copy_ctor(tmp);
array_ptr = tmp;
} else {
array_ptr->refcount++;
}
array_ptr->refcount++;
}
}
@@ -2245,8 +2177,8 @@ static int ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
static int ZEND_EXIT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zend_op *opline = EX(opline);
if (IS_CONST != IS_UNUSED) {
zend_op *opline = EX(opline);
zval *ptr = &opline->op1.u.constant;
@@ -4514,9 +4446,7 @@ static int ZEND_FE_RESET_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
}
array_ptr = *array_ptr_ptr;
} else {
if (Z_TYPE_PP(array_ptr_ptr) == IS_ARRAY) {
SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr);
}
SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr);
array_ptr = *array_ptr_ptr;
array_ptr->refcount++;
}
@@ -4531,20 +4461,7 @@ static int ZEND_FE_RESET_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
} else if (Z_TYPE_P(array_ptr) == IS_OBJECT) {
ce = Z_OBJCE_P(array_ptr);
} else {
if (IS_TMP_VAR == IS_VAR &&
free_op1.var == NULL &&
!array_ptr->is_ref &&
array_ptr->refcount > 1) {
/* non-separated return value from function */
zval *tmp;
ALLOC_ZVAL(tmp);
INIT_PZVAL_COPY(tmp, array_ptr);
zval_copy_ctor(tmp);
array_ptr = tmp;
} else {
array_ptr->refcount++;
}
array_ptr->refcount++;
}
}
@@ -4677,8 +4594,8 @@ static int ZEND_ISSET_ISEMPTY_VAR_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
static int ZEND_EXIT_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zend_op *opline = EX(opline);
if (IS_TMP_VAR != IS_UNUSED) {
zend_op *opline = EX(opline);
zend_free_op free_op1;
zval *ptr = _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC);
@@ -7527,9 +7444,7 @@ static int ZEND_FE_RESET_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
}
array_ptr = *array_ptr_ptr;
} else {
if (Z_TYPE_PP(array_ptr_ptr) == IS_ARRAY) {
SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr);
}
SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr);
array_ptr = *array_ptr_ptr;
array_ptr->refcount++;
}
@@ -7544,20 +7459,7 @@ static int ZEND_FE_RESET_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
} else if (Z_TYPE_P(array_ptr) == IS_OBJECT) {
ce = Z_OBJCE_P(array_ptr);
} else {
if (IS_VAR == IS_VAR &&
free_op1.var == NULL &&
!array_ptr->is_ref &&
array_ptr->refcount > 1) {
/* non-separated return value from function */
zval *tmp;
ALLOC_ZVAL(tmp);
INIT_PZVAL_COPY(tmp, array_ptr);
zval_copy_ctor(tmp);
array_ptr = tmp;
} else {
array_ptr->refcount++;
}
array_ptr->refcount++;
}
}
@@ -7645,7 +7547,7 @@ static int ZEND_FE_FETCH_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
HashTable *fe_ht;
zend_object_iterator *iter = NULL;
int key_type;
zend_bool use_key = (zend_bool)(opline->extended_value & ZEND_FE_FETCH_WITH_KEY);
zend_bool use_key = opline->extended_value & ZEND_FE_FETCH_WITH_KEY;
PZVAL_LOCK(array);
@@ -7763,9 +7665,7 @@ static int ZEND_FE_FETCH_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
key->value.lval = int_key;
key->type = IS_LONG;
break;
default:
ZVAL_NULL(key);
break;
EMPTY_SWITCH_DEFAULT_CASE()
}
}
@@ -7830,8 +7730,8 @@ static int ZEND_ISSET_ISEMPTY_VAR_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
static int ZEND_EXIT_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zend_op *opline = EX(opline);
if (IS_VAR != IS_UNUSED) {
zend_op *opline = EX(opline);
zend_free_op free_op1;
zval *ptr = _get_zval_ptr_var(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC);
@@ -14117,8 +14017,8 @@ static int ZEND_CLONE_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
static int ZEND_EXIT_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zend_op *opline = EX(opline);
if (IS_UNUSED != IS_UNUSED) {
zend_op *opline = EX(opline);
zval *ptr = NULL;
@@ -19615,7 +19515,7 @@ static int ZEND_UNSET_VAR_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
static int ZEND_FE_RESET_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zend_op *opline = EX(opline);
zend_free_op free_op1;
zval *array_ptr, **array_ptr_ptr;
HashTable *fe_ht;
zend_object_iterator *iter = NULL;
@@ -19639,9 +19539,7 @@ static int ZEND_FE_RESET_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
}
array_ptr = *array_ptr_ptr;
} else {
if (Z_TYPE_PP(array_ptr_ptr) == IS_ARRAY) {
SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr);
}
SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr);
array_ptr = *array_ptr_ptr;
array_ptr->refcount++;
}
@@ -19656,20 +19554,7 @@ static int ZEND_FE_RESET_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
} else if (Z_TYPE_P(array_ptr) == IS_OBJECT) {
ce = Z_OBJCE_P(array_ptr);
} else {
if (IS_CV == IS_VAR &&
free_op1.var == NULL &&
!array_ptr->is_ref &&
array_ptr->refcount > 1) {
/* non-separated return value from function */
zval *tmp;
ALLOC_ZVAL(tmp);
INIT_PZVAL_COPY(tmp, array_ptr);
zval_copy_ctor(tmp);
array_ptr = tmp;
} else {
array_ptr->refcount++;
}
array_ptr->refcount++;
}
}
@@ -19801,8 +19686,8 @@ static int ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
static int ZEND_EXIT_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zend_op *opline = EX(opline);
if (IS_CV != IS_UNUSED) {
zend_op *opline = EX(opline);
zval *ptr = _get_zval_ptr_cv(&opline->op1, EX(Ts), BP_VAR_R TSRMLS_CC);
+2 -2
View File
@@ -1200,13 +1200,13 @@ function gen_vm($def, $skel) {
if ($kind == "handler") {
$op = $opcodes[$opnames[$name]];
if (isset($op['op1']["ANY"]) && isset($op['op2']["ANY"])) {
out($f, "{\n\treturn ".$name.(ZEND_VM_SPEC?"_SPEC":"")."_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);\n}\n\n");
out($f, "{\n\treturn ".$name."_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);\n}\n\n");
$done = 1;
}
} else if ($helpers[$name]["param"] == null) {
$h = $helpers[$name];
if (isset($h['op1']["ANY"]) && isset($h['op2']["ANY"])) {
out($f, "{\n\treturn ".$name.(ZEND_VM_SPEC?"_SPEC":"")."(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);\n}\n\n");
out($f, "{\n\treturn ".$name."_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);\n}\n\n");
$done = 1;
}
}
+18 -25
View File
@@ -1000,7 +1000,8 @@ AC_DEFUN([PHP_WITH_SHARED],[
dnl
dnl PHP_ADD_EXTENSION_DEP(extname, depends [, depconf])
dnl
dnl This macro is scanned by genif.sh when it builds the internal functions
dnl This macro is currently a placeholder in the config.m4 file
dnl it is scanned by genif.sh when it builds the internal functions
dnl list, so that modules can be init'd in the correct order
dnl $1 = name of extension, $2 = extension upon which it depends
dnl $3 = optional: if true, it's ok for $2 to have not been configured
@@ -1012,7 +1013,6 @@ dnl
AC_DEFUN([PHP_ADD_EXTENSION_DEP], [
am_i_shared=$[PHP_]translit($1,a-z_-,A-Z__)[_SHARED]
is_it_shared=$[PHP_]translit($2,a-z_-,A-Z__)[_SHARED]
is_it_enabled=$[PHP_]translit($2,a-z_-,A-Z__)
if test "$am_i_shared" = "no" && test "$is_it_shared" = "yes" ; then
AC_MSG_ERROR([
You've configured extension $1 to build statically, but it
@@ -1021,7 +1021,7 @@ You either need to build $1 shared or build $2 statically for the
build to be successful.
])
fi
if test "x$is_it_enabled" = "xno" && test "x$3" != "xtrue"; then
if test "x$is_it_shared" = "x" && test "x$3" != "xtrue"; then
AC_MSG_ERROR([
You've configured extension $1, which depends on extension $2,
but you've either not enabled $2, or have disabled it.
@@ -1877,30 +1877,23 @@ dnl Platform characteristics checks
dnl -------------------------------------------------------------------------
dnl
dnl PHP_SHLIB_SUFFIX_NAMES
dnl PHP_SHLIB_SUFFIX_NAME
dnl
dnl Determines link library suffix SHLIB_SUFFIX_NAME
dnl which can be: .so, .sl or .dylib
dnl Determines shared library suffix
dnl suffix can be: .so, .sl or .dylib
dnl
dnl Determines shared library suffix SHLIB_DL_SUFFIX_NAME
dnl suffix can be: .so or .sl
dnl
AC_DEFUN([PHP_SHLIB_SUFFIX_NAMES],[
AC_REQUIRE([PHP_CANONICAL_HOST_TARGET])dnl
PHP_SUBST_OLD(SHLIB_SUFFIX_NAME)
PHP_SUBST_OLD(SHLIB_DL_SUFFIX_NAME)
SHLIB_SUFFIX_NAME=so
SHLIB_DL_SUFFIX_NAME=$SHLIB_SUFFIX_NAME
case $host_alias in
*hpux*[)]
SHLIB_SUFFIX_NAME=sl
SHLIB_DL_SUFFIX_NAME=sl
;;
*darwin*[)]
SHLIB_SUFFIX_NAME=dylib
SHLIB_DL_SUFFIX_NAME=so
;;
esac
AC_DEFUN([PHP_SHLIB_SUFFIX_NAME],[
AC_REQUIRE([PHP_CANONICAL_HOST_TARGET])dnl
PHP_SUBST(SHLIB_SUFFIX_NAME)
SHLIB_SUFFIX_NAME=so
case $host_alias in
*hpux*[)]
SHLIB_SUFFIX_NAME=sl
;;
*darwin*[)]
SHLIB_SUFFIX_NAME=dylib
;;
esac
])
dnl
+4 -5
View File
@@ -41,7 +41,7 @@ AC_CONFIG_HEADER(main/php_config.h)
MAJOR_VERSION=5
MINOR_VERSION=1
RELEASE_VERSION=4
RELEASE_VERSION=2
EXTRA_VERSION=""
VERSION="$MAJOR_VERSION.$MINOR_VERSION.$RELEASE_VERSION$EXTRA_VERSION"
@@ -224,7 +224,7 @@ dnl -------------------------------------------------------------------------
PTHREADS_CHECK
PHP_HELP_SEPARATOR([SAPI modules:])
PHP_SHLIB_SUFFIX_NAMES
PHP_SHLIB_SUFFIX_NAME
PHP_SAPI=default
PHP_BUILD_PROGRAM
@@ -233,7 +233,7 @@ dnl SAPI configuration.
dnl -------------------------------------------------------------------------
dnl paths to the targets are relative to the build directory
SAPI_SHARED=libs/libphp5.$SHLIB_DL_SUFFIX_NAME
SAPI_SHARED=libs/libphp5.$SHLIB_SUFFIX_NAME
SAPI_STATIC=libs/libphp5.a
SAPI_LIBTOOL=libphp5.la
@@ -466,7 +466,6 @@ ftok \
funopen \
gai_strerror \
gcvt \
getloadavg \
getlogin \
getprotobyname \
getprotobynumber \
@@ -483,7 +482,6 @@ isascii \
link \
localtime_r \
lockf \
lchown \
lrand48 \
memcpy \
memmove \
@@ -1197,6 +1195,7 @@ PHP_SUBST(SHARED_LIBTOOL)
PHP_SUBST(WARNING_LEVEL)
PHP_SUBST(PHP_FRAMEWORKS)
PHP_SUBST(PHP_FRAMEWORKPATH)
PHP_SUBST_OLD(SHLIB_SUFFIX_NAME)
PHP_SUBST(INSTALL_HEADERS)
old_CC=$CC
+6 -6
View File
@@ -336,7 +336,7 @@ PHP_FUNCTION(com_get_active_object)
/* Performs an Invoke on the given com object.
* returns a failure code and creates an exception if there was an error */
HRESULT php_com_invoke_helper(php_com_dotnet_object *obj, DISPID id_member,
WORD flags, DISPPARAMS *disp_params, VARIANT *v, int silent TSRMLS_DC)
WORD flags, DISPPARAMS *disp_params, VARIANT *v TSRMLS_DC)
{
HRESULT hr;
unsigned int arg_err;
@@ -345,7 +345,7 @@ HRESULT php_com_invoke_helper(php_com_dotnet_object *obj, DISPID id_member,
hr = IDispatch_Invoke(V_DISPATCH(&obj->v), id_member,
&IID_NULL, LOCALE_SYSTEM_DEFAULT, flags, disp_params, v, &e, &arg_err);
if (silent == 0 && FAILED(hr)) {
if (FAILED(hr)) {
char *source = NULL, *desc = NULL, *msg = NULL;
int source_len, desc_len;
@@ -543,7 +543,7 @@ int php_com_do_invoke_byref(php_com_dotnet_object *obj, char *name, int namelen,
}
/* this will create an exception if needed */
hr = php_com_invoke_helper(obj, dispid, flags, &disp_params, v, 0 TSRMLS_CC);
hr = php_com_invoke_helper(obj, dispid, flags, &disp_params, v TSRMLS_CC);
/* release variants */
if (vargs) {
@@ -581,7 +581,7 @@ int php_com_do_invoke_byref(php_com_dotnet_object *obj, char *name, int namelen,
int php_com_do_invoke_by_id(php_com_dotnet_object *obj, DISPID dispid,
WORD flags, VARIANT *v, int nargs, zval **args, int silent TSRMLS_DC)
WORD flags, VARIANT *v, int nargs, zval **args TSRMLS_DC)
{
DISPID altdispid;
DISPPARAMS disp_params;
@@ -610,7 +610,7 @@ int php_com_do_invoke_by_id(php_com_dotnet_object *obj, DISPID dispid,
}
/* this will create an exception if needed */
hr = php_com_invoke_helper(obj, dispid, flags, &disp_params, v, silent TSRMLS_CC);
hr = php_com_invoke_helper(obj, dispid, flags, &disp_params, v TSRMLS_CC);
/* release variants */
if (vargs) {
@@ -646,7 +646,7 @@ int php_com_do_invoke(php_com_dotnet_object *obj, char *name, int namelen,
return FAILURE;
}
return php_com_do_invoke_by_id(obj, dispid, flags, v, nargs, args, 0 TSRMLS_CC);
return php_com_do_invoke_by_id(obj, dispid, flags, v, nargs, args TSRMLS_CC);
}
/* {{{ proto string com_create_guid()
+5 -7
View File
@@ -101,7 +101,7 @@ static zval *com_read_dimension(zval *object, zval *offset, int type TSRMLS_DC)
VariantInit(&v);
if (SUCCESS == php_com_do_invoke_by_id(obj, DISPID_VALUE,
DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v, 1, &offset, 0 TSRMLS_CC)) {
DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v, 1, &offset TSRMLS_CC)) {
php_com_zval_from_variant(return_value, &v, obj->code_page TSRMLS_CC);
VariantClear(&v);
}
@@ -140,7 +140,7 @@ static void com_write_dimension(zval *object, zval *offset, zval *value TSRMLS_D
VariantInit(&v);
if (SUCCESS == php_com_do_invoke_by_id(obj, DISPID_VALUE,
DISPATCH_METHOD|DISPATCH_PROPERTYPUT, &v, 2, args, 0 TSRMLS_CC)) {
DISPATCH_METHOD|DISPATCH_PROPERTYPUT, &v, 2, args TSRMLS_CC)) {
VariantClear(&v);
}
} else if (V_ISARRAY(&obj->v)) {
@@ -503,9 +503,9 @@ static int com_object_cast(zval *readobj, zval *writeobj, int type, int should_f
VariantInit(&v);
if (V_VT(&obj->v) == VT_DISPATCH) {
if (SUCCESS != php_com_do_invoke_by_id(obj, DISPID_VALUE,
DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v, 0, NULL, 1 TSRMLS_CC)) {
VariantCopy(&v, &obj->v);
if (FAILURE == php_com_do_invoke_by_id(obj, DISPID_VALUE,
DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v, 0, NULL TSRMLS_CC)) {
return FAILURE;
}
} else {
VariantCopy(&v, &obj->v);
@@ -634,11 +634,9 @@ void php_com_object_free_storage(void *object TSRMLS_DC)
VariantClear(&obj->v);
if (obj->method_cache) {
zend_hash_destroy(obj->method_cache);
FREE_HASHTABLE(obj->method_cache);
}
if (obj->id_of_name_cache) {
zend_hash_destroy(obj->id_of_name_cache);
FREE_HASHTABLE(obj->id_of_name_cache);
}
efree(obj);
+23 -30
View File
@@ -38,7 +38,6 @@ struct php_com_iterator {
VARIANT safe_array;
VARTYPE sa_type;
LONG sa_max;
zval *zdata;
};
static void com_iter_dtor(zend_object_iterator *iter TSRMLS_DC)
@@ -50,9 +49,6 @@ static void com_iter_dtor(zend_object_iterator *iter TSRMLS_DC)
}
VariantClear(&I->v);
VariantClear(&I->safe_array);
if (I->zdata) {
zval_ptr_dtor((zval**)&I->zdata);
}
efree(I);
}
@@ -60,18 +56,32 @@ static int com_iter_valid(zend_object_iterator *iter TSRMLS_DC)
{
struct php_com_iterator *I = (struct php_com_iterator*)iter->data;
if (I->zdata) {
return SUCCESS;
if (I->key == (ulong)-1) {
return FAILURE;
}
return FAILURE;
return SUCCESS;
}
static void com_iter_get_data(zend_object_iterator *iter, zval ***data TSRMLS_DC)
{
struct php_com_iterator *I = (struct php_com_iterator*)iter->data;
zval **ptr_ptr;
zval *ptr;
*data = &I->zdata;
/* sanity */
if (I->key == (ulong)-1) {
*data = NULL;
return;
}
MAKE_STD_ZVAL(ptr);
php_com_zval_from_variant(ptr, &I->v, I->code_page TSRMLS_CC);
/* php_com_wrap_variant(ptr, &I->v, I->code_page TSRMLS_CC); */
ptr_ptr = emalloc(sizeof(*ptr_ptr));
*ptr_ptr = ptr;
*data = ptr_ptr;
return;
}
static int com_iter_get_key(zend_object_iterator *iter, char **str_key, uint *str_key_len,
@@ -90,20 +100,15 @@ static int com_iter_move_forwards(zend_object_iterator *iter TSRMLS_DC)
{
struct php_com_iterator *I = (struct php_com_iterator*)iter->data;
unsigned long n_fetched;
zval *ptr;
/* release current cached element */
VariantClear(&I->v);
if (I->zdata) {
zval_ptr_dtor((zval**)&I->zdata);
I->zdata = NULL;
}
if (I->ev) {
/* Get the next element */
if (SUCCEEDED(IEnumVARIANT_Next(I->ev, 1, &I->v, &n_fetched)) && n_fetched > 0) {
I->key++;
return SUCCESS;
} else {
/* indicate that there are no more items */
I->key = (ulong)-1;
@@ -116,17 +121,13 @@ static int com_iter_move_forwards(zend_object_iterator *iter TSRMLS_DC)
return FAILURE;
}
I->key++;
if (php_com_safearray_get_elem(&I->safe_array, &I->v, (LONG)I->key TSRMLS_CC) == 0) {
if (php_com_safearray_get_elem(&I->safe_array, &I->v, (LONG)I->key TSRMLS_CC)) {
return SUCCESS;
} else {
I->key = (ulong)-1;
return FAILURE;
}
}
MAKE_STD_ZVAL(ptr);
php_com_zval_from_variant(ptr, &I->v, I->code_page TSRMLS_CC);
/* php_com_wrap_variant(ptr, &I->v, I->code_page TSRMLS_CC); */
I->zdata = ptr;
return SUCCESS;
}
@@ -147,7 +148,6 @@ zend_object_iterator *php_com_iter_get(zend_class_entry *ce, zval *object TSRMLS
DISPPARAMS dp;
VARIANT v;
unsigned long n_fetched;
zval *ptr;
obj = CDNO_FETCH(object);
@@ -163,7 +163,6 @@ zend_object_iterator *php_com_iter_get(zend_class_entry *ce, zval *object TSRMLS
I->iter.funcs = &com_iter_funcs;
I->iter.data = I;
I->code_page = obj->code_page;
I->zdata = NULL;
VariantInit(&I->safe_array);
VariantInit(&I->v);
@@ -190,9 +189,6 @@ zend_object_iterator *php_com_iter_get(zend_class_entry *ce, zval *object TSRMLS
/* pre-fetch the element */
if (php_com_safearray_get_elem(&I->safe_array, &I->v, bound TSRMLS_CC)) {
I->key = bound;
MAKE_STD_ZVAL(ptr);
php_com_zval_from_variant(ptr, &I->v, I->code_page TSRMLS_CC);
I->zdata = ptr;
} else {
I->key = (ulong)-1;
}
@@ -224,9 +220,6 @@ zend_object_iterator *php_com_iter_get(zend_class_entry *ce, zval *object TSRMLS
if (SUCCEEDED(IEnumVARIANT_Next(I->ev, 1, &I->v, &n_fetched)) && n_fetched > 0) {
/* indicate that we have element 0 */
I->key = 0;
MAKE_STD_ZVAL(ptr);
php_com_zval_from_variant(ptr, &I->v, I->code_page TSRMLS_CC);
I->zdata = ptr;
} else {
/* indicate that there are no more items */
I->key = (ulong)-1;
+8 -4
View File
@@ -708,7 +708,8 @@ static void helper_free_storage(void *obj TSRMLS_DC)
if (object->unk) {
IUnknown_Release(object->unk);
}
zend_object_std_dtor(&object->std TSRMLS_CC);
zend_hash_destroy(object->std.properties);
FREE_HASHTABLE(object->std.properties);
efree(object);
}
@@ -721,8 +722,9 @@ static void helper_clone(void *obj, void **clone_ptr TSRMLS_DC)
memcpy(clone, object, sizeof(*object));
*clone_ptr = clone;
zend_object_std_init(&clone->std, object->std.ce TSRMLS_CC);
ALLOC_HASHTABLE(clone->std.properties);
zend_hash_init(clone->std.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
if (clone->ipf) {
IPersistFile_AddRef(clone->ipf);
}
@@ -745,7 +747,9 @@ static zend_object_value helper_new(zend_class_entry *ce TSRMLS_DC)
helper = emalloc(sizeof(*helper));
memset(helper, 0, sizeof(*helper));
zend_object_std_init(&helper->std, helper_ce TSRMLS_CC);
ALLOC_HASHTABLE(helper->std.properties);
zend_hash_init(helper->std.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
helper->std.ce = helper_ce;
retval.handle = zend_objects_store_put(helper, NULL, helper_free_storage, helper_clone TSRMLS_CC);
retval.handlers = &helper_handlers;
+1 -1
View File
@@ -40,7 +40,7 @@ static void safe_array_from_zval(VARIANT *v, zval *z, int codepage TSRMLS_DC)
int keytype;
char *strindex;
int strindexlen;
long intindex = -1;
long intindex;
long max_index = 0;
VARIANT *va;
zval **item;
+2 -2
View File
@@ -102,11 +102,11 @@ PHP_FUNCTION(com_load_typelib);
PHP_FUNCTION(com_get_active_object);
HRESULT php_com_invoke_helper(php_com_dotnet_object *obj, DISPID id_member,
WORD flags, DISPPARAMS *disp_params, VARIANT *v, int silent TSRMLS_DC);
WORD flags, DISPPARAMS *disp_params, VARIANT *v TSRMLS_DC);
HRESULT php_com_get_id_of_name(php_com_dotnet_object *obj, char *name,
int namelen, DISPID *dispid TSRMLS_DC);
int php_com_do_invoke_by_id(php_com_dotnet_object *obj, DISPID dispid,
WORD flags, VARIANT *v, int nargs, zval **args, int silent TSRMLS_DC);
WORD flags, VARIANT *v, int nargs, zval **args TSRMLS_DC);
int php_com_do_invoke(php_com_dotnet_object *obj, char *name, int namelen,
WORD flags, VARIANT *v, int nargs, zval **args TSRMLS_DC);
int php_com_do_invoke_byref(php_com_dotnet_object *obj, char *name, int namelen,
+131 -203
View File
@@ -47,11 +47,13 @@
/* {{{ cruft for thread safe SSL crypto locks */
#if defined(ZTS) && defined(HAVE_CURL_SSL)
# ifdef PHP_WIN32
# define PHP_CURL_NEED_SSL_TSL
# define PHP_CURL_NEED_OPENSSL_TSL
# include <openssl/crypto.h>
# else /* !PHP_WIN32 */
# if defined(HAVE_CURL_OPENSSL)
# if defined(HAVE_OPENSSL_CRYPTO_H)
# define PHP_CURL_NEED_SSL_TSL
# define PHP_CURL_NEED_OPENSSL_TSL
# include <openssl/crypto.h>
# else
@@ -62,6 +64,7 @@
# endif
# elif defined(HAVE_CURL_GNUTLS)
# if defined(HAVE_GCRYPT_H)
# define PHP_CURL_NEED_SSL_TSL
# define PHP_CURL_NEED_GNUTLS_TSL
# include <gcrypt.h>
# else
@@ -91,61 +94,10 @@
int le_curl;
int le_curl_multi_handle;
#ifdef PHP_CURL_NEED_OPENSSL_TSL /* {{{ */
static MUTEX_T *php_curl_openssl_tsl = NULL;
static void php_curl_ssl_lock(int mode, int n, const char * file, int line)
{
if (mode & CRYPTO_LOCK) {
tsrm_mutex_lock(php_curl_openssl_tsl[n]);
} else {
tsrm_mutex_unlock(php_curl_openssl_tsl[n]);
}
}
static unsigned long php_curl_ssl_id(void)
{
return (unsigned long) tsrm_thread_id();
}
#ifdef PHP_CURL_NEED_SSL_TSL
static inline void php_curl_ssl_init(void);
static inline void php_curl_ssl_cleanup(void);
#endif
/* }}} */
#ifdef PHP_CURL_NEED_GNUTLS_TSL /* {{{ */
static int php_curl_ssl_mutex_create(void **m)
{
if (*((MUTEX_T *) m) = tsrm_mutex_alloc()) {
return SUCCESS;
} else {
return FAILURE;
}
}
static int php_curl_ssl_mutex_destroy(void **m)
{
tsrm_mutex_free(*((MUTEX_T *) m));
return SUCCESS;
}
static int php_curl_ssl_mutex_lock(void **m)
{
return tsrm_mutex_lock(*((MUTEX_T *) m));
}
static int php_curl_ssl_mutex_unlock(void **m)
{
return tsrm_mutex_unlock(*((MUTEX_T *) m));
}
static struct gcry_thread_cbs php_curl_gnutls_tsl = {
GCRY_THREAD_OPTION_USER,
NULL,
php_curl_ssl_mutex_create,
php_curl_ssl_mutex_destroy,
php_curl_ssl_mutex_lock,
php_curl_ssl_mutex_unlock
};
#endif
/* }}} */
static void _php_curl_close(zend_rsrc_list_entry *rsrc TSRMLS_DC);
@@ -183,7 +135,6 @@ zend_function_entry curl_functions[] = {
PHP_FE(curl_copy_handle, NULL)
PHP_FE(curl_version, NULL)
PHP_FE(curl_setopt, NULL)
PHP_FE(curl_setopt_array, NULL)
PHP_FE(curl_exec, NULL)
PHP_FE(curl_getinfo, NULL)
PHP_FE(curl_error, NULL)
@@ -386,7 +337,6 @@ PHP_MINIT_FUNCTION(curl)
REGISTER_CURL_CONSTANT(CURLINFO_CONTENT_TYPE);
REGISTER_CURL_CONSTANT(CURLINFO_REDIRECT_TIME);
REGISTER_CURL_CONSTANT(CURLINFO_REDIRECT_COUNT);
REGISTER_CURL_CONSTANT(CURLINFO_HEADER_OUT);
/* cURL protocol constants (curl_version) */
REGISTER_CURL_CONSTANT(CURL_VERSION_IPV6);
@@ -497,24 +447,9 @@ PHP_MINIT_FUNCTION(curl)
REGISTER_CURL_CONSTANT(CURLFTPAUTH_TLS);
#endif
#ifdef PHP_CURL_NEED_OPENSSL_TSL
{
int i, c = CRYPTO_num_locks();
php_curl_openssl_tsl = malloc(c * sizeof(MUTEX_T));
for (i = 0; i < c; ++i) {
php_curl_openssl_tsl[i] = tsrm_mutex_alloc();
}
CRYPTO_set_id_callback(php_curl_ssl_id);
CRYPTO_set_locking_callback(php_curl_ssl_lock);
}
#ifdef PHP_CURL_NEED_SSL_TSL
php_curl_ssl_init();
#endif
#ifdef PHP_CURL_NEED_GNUTLS_TSL
gcry_control(GCRYCTL_SET_THREAD_CBS, &php_curl_gnutls_tsl);
#endif
if (curl_global_init(CURL_GLOBAL_SSL) != CURLE_OK) {
return FAILURE;
}
@@ -550,27 +485,10 @@ PHP_MSHUTDOWN_FUNCTION(curl)
php_unregister_url_stream_wrapper("https" TSRMLS_CC);
php_unregister_url_stream_wrapper("ftp" TSRMLS_CC);
php_unregister_url_stream_wrapper("ldap" TSRMLS_CC);
#endif
#ifdef PHP_CURL_NEED_OPENSSL_TSL
/* ensure there are valid callbacks set */
CRYPTO_set_id_callback(php_curl_ssl_id);
CRYPTO_set_locking_callback(php_curl_ssl_lock);
#endif
curl_global_cleanup();
#ifdef PHP_CURL_NEED_OPENSSL_TSL
if (php_curl_openssl_tsl) {
int i, c = CRYPTO_num_locks();
CRYPTO_set_id_callback(NULL);
CRYPTO_set_locking_callback(NULL);
for (i = 0; i < c; ++i) {
tsrm_mutex_free(php_curl_openssl_tsl[i]);
}
free(php_curl_openssl_tsl);
php_curl_openssl_tsl = NULL;
}
#ifdef PHP_CURL_NEED_SSL_TSL
php_curl_ssl_cleanup();
#endif
return SUCCESS;
}
@@ -801,23 +719,6 @@ static size_t curl_write_header(char *data, size_t size, size_t nmemb, void *ctx
}
/* }}} */
static int curl_debug(CURL *cp, curl_infotype type, char *buf, size_t buf_len, void *ctx)
{
php_curl *ch = (php_curl *) ctx;
if (type == CURLINFO_HEADER_OUT) {
if (ch->header.str_len) {
efree(ch->header.str);
}
if (buf_len > 0) {
ch->header.str = estrndup(buf, buf_len);
ch->header.str_len = buf_len;
}
}
return 0;
}
#if CURLOPT_PASSWDFUNCTION != 0
/* {{{ curl_passwd
*/
@@ -940,7 +841,6 @@ static void alloc_curl_handle(php_curl **ch)
(*ch)->handlers->read = ecalloc(1, sizeof(php_curl_read));
(*ch)->in_callback = 0;
(*ch)->header.str_len = 0;
memset(&(*ch)->err, 0, sizeof((*ch)->err));
@@ -1049,10 +949,24 @@ PHP_FUNCTION(curl_copy_handle)
}
/* }}} */
static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *return_value TSRMLS_DC)
/* {{{ proto bool curl_setopt(resource ch, int option, mixed value)
Set an option for a CURL transfer */
PHP_FUNCTION(curl_setopt)
{
zval **zid, **zoption, **zvalue;
php_curl *ch;
CURLcode error=CURLE_OK;
int option;
if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &zid, &zoption, &zvalue) == FAILURE) {
WRONG_PARAM_COUNT;
}
ZEND_FETCH_RESOURCE(ch, php_curl *, zid, -1, le_curl_name, le_curl);
convert_to_long_ex(zoption);
option = Z_LVAL_PP(zoption);
switch (option) {
case CURLOPT_INFILESIZE:
case CURLOPT_VERBOSE:
@@ -1208,8 +1122,6 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
if (Z_LVAL_PP(zvalue)) {
ch->handlers->write->type = PHP_CURL_BINARY;
} else {
ch->handlers->write->type = PHP_CURL_ASCII;
}
break;
case CURLOPT_WRITEFUNCTION:
@@ -1382,93 +1294,23 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
break;
}
case CURLINFO_HEADER_OUT:
convert_to_long_ex(zvalue);
if (Z_LVAL_PP(zvalue) == 1) {
curl_easy_setopt(ch->cp, CURLOPT_DEBUGFUNCTION, curl_debug);
curl_easy_setopt(ch->cp, CURLOPT_DEBUGDATA, (void *)ch);
curl_easy_setopt(ch->cp, CURLOPT_VERBOSE, 1);
} else {
curl_easy_setopt(ch->cp, CURLOPT_DEBUGFUNCTION, NULL);
curl_easy_setopt(ch->cp, CURLOPT_DEBUGDATA, NULL);
curl_easy_setopt(ch->cp, CURLOPT_VERBOSE, 0);
}
break;
}
SAVE_CURL_ERROR(ch, error);
if (error != CURLE_OK) {
return 1;
RETURN_FALSE;
} else {
return 0;
}
}
/* {{{ proto bool curl_setopt(resource ch, int option, mixed value)
Set an option for a CURL transfer */
PHP_FUNCTION(curl_setopt)
{
zval **zid, **zoption, **zvalue;
php_curl *ch;
if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &zid, &zoption, &zvalue) == FAILURE) {
WRONG_PARAM_COUNT;
}
ZEND_FETCH_RESOURCE(ch, php_curl *, zid, -1, le_curl_name, le_curl);
convert_to_long_ex(zoption);
if (!_php_curl_setopt(ch, Z_LVAL_PP(zoption), zvalue, return_value TSRMLS_CC)) {
RETURN_TRUE;
} else {
RETURN_FALSE;
}
}
/* }}} */
/* {{{ proto bool curl_setopt_array(resource ch, array options)
Set an array of option for a CURL transfer */
PHP_FUNCTION(curl_setopt_array)
{
zval *zid, *arr, **entry;
php_curl *ch;
long option;
HashPosition pos;
char *string_key;
int str_key_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "za", &zid, &arr) == FAILURE) {
RETURN_FALSE;
}
ZEND_FETCH_RESOURCE(ch, php_curl *, &zid, -1, le_curl_name, le_curl);
zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(arr), &pos);
while (zend_hash_get_current_data_ex(Z_ARRVAL_P(arr), (void **)&entry, &pos) == SUCCESS) {
if (zend_hash_get_current_key_ex(Z_ARRVAL_P(arr), &string_key, &str_key_len, &option, 0, &pos) == HASH_KEY_IS_STRING) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Array keys must be CURLOPT constants or equivalent interger values.");
RETURN_FALSE;
}
if (_php_curl_setopt(ch, option, entry, return_value TSRMLS_CC)) {
RETURN_FALSE;
}
zend_hash_move_forward_ex(Z_ARRVAL_P(arr), &pos);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ _php_curl_cleanup_handle(ch)
Cleanup an execution phase */
void _php_curl_cleanup_handle(php_curl *ch)
{
if (ch->handlers->write->buf.len > 0) {
smart_str_free(&ch->handlers->write->buf);
}
if (ch->header.str_len) {
efree(ch->header.str);
ch->header.str_len = 0;
memset(&ch->handlers->write->buf, 0, sizeof(smart_str));
}
memset(ch->err.str, 0, CURL_ERROR_SIZE + 1);
@@ -1499,6 +1341,7 @@ PHP_FUNCTION(curl_exec)
if (ch->handlers->write->buf.len > 0) {
smart_str_free(&ch->handlers->write->buf);
}
RETURN_FALSE;
}
@@ -1506,8 +1349,10 @@ PHP_FUNCTION(curl_exec)
if (ch->handlers->write->method == PHP_CURL_RETURN && ch->handlers->write->buf.len > 0) {
--ch->uses;
smart_str_0(&ch->handlers->write->buf);
RETURN_STRINGL(ch->handlers->write->buf.c, ch->handlers->write->buf.len, 1);
if (ch->handlers->write->type != PHP_CURL_BINARY) {
smart_str_0(&ch->handlers->write->buf);
}
RETURN_STRINGL(ch->handlers->write->buf.c, ch->handlers->write->buf.len, 0);
}
--ch->uses;
RETURN_TRUE;
@@ -1598,9 +1443,6 @@ PHP_FUNCTION(curl_getinfo)
if (curl_easy_getinfo(ch->cp, CURLINFO_REDIRECT_TIME, &d_code) == CURLE_OK) {
CAAD("redirect_time", d_code);
}
if (ch->header.str_len > 0) {
CAAS("request_header", ch->header.str);
}
} else {
option = Z_LVAL_PP(zoption);
switch (option) {
@@ -1651,12 +1493,6 @@ PHP_FUNCTION(curl_getinfo)
}
break;
}
case CURLINFO_HEADER_OUT:
if (ch->header.str_len > 0) {
RETURN_STRINGL(ch->header.str, ch->header.str_len, 1);
} else {
RETURN_FALSE;
}
}
}
}
@@ -1738,9 +1574,6 @@ static void _php_curl_close(zend_rsrc_list_entry *rsrc TSRMLS_DC)
zend_llist_clean(&ch->to_free.slist);
zend_llist_clean(&ch->to_free.post);
if (ch->handlers->write->buf.len > 0) {
smart_str_free(&ch->handlers->write->buf);
}
if (ch->handlers->write->func_name) {
zval_ptr_dtor(&ch->handlers->write->func_name);
}
@@ -1753,10 +1586,6 @@ static void _php_curl_close(zend_rsrc_list_entry *rsrc TSRMLS_DC)
if (ch->handlers->passwd) {
zval_ptr_dtor(&ch->handlers->passwd);
}
if (ch->header.str_len > 0) {
efree(ch->header.str);
}
efree(ch->handlers->write);
efree(ch->handlers->write_header);
efree(ch->handlers->read);
@@ -1765,6 +1594,105 @@ static void _php_curl_close(zend_rsrc_list_entry *rsrc TSRMLS_DC)
}
/* }}} */
#ifdef PHP_CURL_NEED_OPENSSL_TSL
/* {{{ */
static MUTEX_T *php_curl_openssl_tsl = NULL;
static void php_curl_ssl_lock(int mode, int n, const char * file, int line)
{
if (mode & CRYPTO_LOCK) {
tsrm_mutex_lock(php_curl_openssl_tsl[n]);
} else {
tsrm_mutex_unlock(php_curl_openssl_tsl[n]);
}
}
static unsigned long php_curl_ssl_id(void)
{
return (unsigned long) tsrm_thread_id();
}
static inline void php_curl_ssl_init(void)
{
int i, c = CRYPTO_num_locks();
php_curl_openssl_tsl = malloc(c * sizeof(MUTEX_T));
for (i = 0; i < c; ++i) {
php_curl_openssl_tsl[i] = tsrm_mutex_alloc();
}
CRYPTO_set_id_callback(php_curl_ssl_id);
CRYPTO_set_locking_callback(php_curl_ssl_lock);
}
static inline void php_curl_ssl_cleanup(void)
{
if (php_curl_openssl_tsl) {
int i, c = CRYPTO_num_locks();
CRYPTO_set_id_callback(NULL);
CRYPTO_set_locking_callback(NULL);
for (i = 0; i < c; ++i) {
tsrm_mutex_free(php_curl_openssl_tsl[i]);
}
free(php_curl_openssl_tsl);
php_curl_openssl_tsl = NULL;
}
}
#endif /* PHP_CURL_NEED_OPENSSL_TSL */
/* }}} */
#ifdef PHP_CURL_NEED_GNUTLS_TSL
/* {{{ */
static int php_curl_ssl_mutex_create(void **m)
{
if (*((MUTEX_T *) m) = tsrm_mutex_alloc()) {
return SUCCESS;
} else {
return FAILURE;
}
}
static int php_curl_ssl_mutex_destroy(void **m)
{
tsrm_mutex_free(*((MUTEX_T *) m));
return SUCCESS;
}
static int php_curl_ssl_mutex_lock(void **m)
{
return tsrm_mutex_lock(*((MUTEX_T *) m));
}
static int php_curl_ssl_mutex_unlock(void **m)
{
return tsrm_mutex_unlock(*((MUTEX_T *) m));
}
static struct gcry_thread_cbs php_curl_gnutls_tsl = {
GCRY_THREAD_OPTION_USER,
NULL,
php_curl_ssl_mutex_create,
php_curl_ssl_mutex_destroy,
php_curl_ssl_mutex_lock,
php_curl_ssl_mutex_unlock
};
static inline void php_curl_ssl_init(void)
{
gcry_control(GCRYCTL_SET_THREAD_CBS, &php_curl_gnutls_tsl);
}
static inline void php_curl_ssl_cleanup(void)
{
return;
}
#endif /* PHP_CURL_NEED_GNUTLS_TSL */
/* }}} */
#endif /* HAVE_CURL */
/*
+5 -2
View File
@@ -195,8 +195,11 @@ PHP_FUNCTION(curl_multi_getcontent)
ZEND_FETCH_RESOURCE(ch, php_curl *, &z_ch, -1, le_curl_name, le_curl);
if (ch->handlers->write->method == PHP_CURL_RETURN && ch->handlers->write->buf.len > 0) {
smart_str_0(&ch->handlers->write->buf);
RETURN_STRINGL(ch->handlers->write->buf.c, ch->handlers->write->buf.len, 1);
if (ch->handlers->write->type != PHP_CURL_BINARY) {
smart_str_0(&ch->handlers->write->buf);
}
RETURN_STRINGL(ch->handlers->write->buf.c, ch->handlers->write->buf.len, 0);
}
}
-7
View File
@@ -63,7 +63,6 @@ PHP_FUNCTION(curl_version);
PHP_FUNCTION(curl_init);
PHP_FUNCTION(curl_copy_handle);
PHP_FUNCTION(curl_setopt);
PHP_FUNCTION(curl_setopt_array);
PHP_FUNCTION(curl_exec);
PHP_FUNCTION(curl_getinfo);
PHP_FUNCTION(curl_error);
@@ -108,11 +107,6 @@ struct _php_curl_error {
int no;
};
struct _php_curl_send_headers {
char *str;
size_t str_len;
};
struct _php_curl_free {
zend_llist str;
zend_llist post;
@@ -122,7 +116,6 @@ struct _php_curl_free {
typedef struct {
struct _php_curl_error err;
struct _php_curl_free to_free;
struct _php_curl_send_headers header;
void ***thread_ctx;
CURL *cp;
php_curl_handlers *handlers;
+8613 -13635
View File
File diff suppressed because it is too large. Load diff
+48 -96
View File
@@ -97,13 +97,13 @@ typedef unsigned char uchar;
#define timelib_string_free free
#define TIMELIB_HAVE_TIME() { if (s->time->have_time) { add_error(s, "Double time specification"); timelib_string_free(str); return TIMELIB_ERROR; } else { s->time->have_time = 1; s->time->h = 0; s->time->i = 0; s->time->s = 0; s->time->f = 0; } }
#define TIMELIB_HAVE_TIME() { if (s->time->have_time) { return TIMELIB_ERROR; } else { s->time->have_time = 1; s->time->h = 0; s->time->i = 0; s->time->s = 0; s->time->f = 0; } }
#define TIMELIB_UNHAVE_TIME() { s->time->have_time = 0; s->time->h = 0; s->time->i = 0; s->time->s = 0; s->time->f = 0; }
#define TIMELIB_HAVE_DATE() { if (s->time->have_date) { add_error(s, "Double date specification"); timelib_string_free(str); return TIMELIB_ERROR; } else { s->time->have_date = 1; } }
#define TIMELIB_HAVE_DATE() { if (s->time->have_date) { return TIMELIB_ERROR; } else { s->time->have_date = 1; } }
#define TIMELIB_UNHAVE_DATE() { s->time->have_date = 0; s->time->d = 0; s->time->m = 0; s->time->y = 0; }
#define TIMELIB_HAVE_RELATIVE() { s->time->have_relative = 1; s->time->relative.weekday_behavior = 0; }
#define TIMELIB_HAVE_WEEKDAY_RELATIVE() { s->time->have_weekday_relative = 1; }
#define TIMELIB_HAVE_TZ() { s->cur = cursor; if (s->time->have_zone) { add_warning(s, "Double timezone specification"); timelib_string_free(str); return TIMELIB_ERROR; } else { s->time->have_zone = 1; } }
#define TIMELIB_HAVE_TZ() { s->cur = cursor; if (s->time->have_zone) { return TIMELIB_ERROR; } else { s->time.have_zone = 1; } }
#define TIMELIB_INIT s->cur = cursor; str = timelib_string(s); ptr = str
#define TIMELIB_DEINIT timelib_string_free(str)
@@ -140,7 +140,7 @@ typedef struct Scanner {
int fd;
uchar *lim, *str, *ptr, *cur, *tok, *pos;
unsigned int line, len;
struct timelib_error_container *errors;
int errors;
struct timelib_time *time;
timelib_tzdb *tzdb;
@@ -285,7 +285,7 @@ static timelib_lookup_table const timelib_month_lookup[] = {
static char* timelib_ltrim(char *s)
{
char *ptr = s;
while (ptr[0] == ' ' || ptr[0] == '\t') {
while (ptr[0] == ' ') {
ptr++;
}
return ptr;
@@ -325,24 +325,6 @@ uchar *fill(Scanner *s, uchar *cursor){
}
#endif
static void add_warning(Scanner *s, char *error)
{
s->errors->warning_count++;
s->errors->warning_messages = realloc(s->errors->warning_messages, s->errors->warning_count * sizeof(timelib_error_message));
s->errors->warning_messages[s->errors->warning_count - 1].position = s->tok ? s->tok - s->str : 0;
s->errors->warning_messages[s->errors->warning_count - 1].character = s->tok ? *s->tok : 0;
s->errors->warning_messages[s->errors->warning_count - 1].message = strdup(error);
}
static void add_error(Scanner *s, char *error)
{
s->errors->error_count++;
s->errors->error_messages = realloc(s->errors->error_messages, s->errors->error_count * sizeof(timelib_error_message));
s->errors->error_messages[s->errors->error_count - 1].position = s->tok ? s->tok - s->str : 0;
s->errors->error_messages[s->errors->error_count - 1].character = s->tok ? *s->tok : 0;
s->errors->error_messages[s->errors->error_count - 1].message = strdup(error);
}
static timelib_sll timelib_meridian(char **ptr, timelib_sll h)
{
timelib_sll retval = 0;
@@ -513,7 +495,7 @@ static timelib_sll timelib_lookup_relative_text(char **ptr, int *behavior)
static timelib_sll timelib_get_relative_text(char **ptr, int *behavior)
{
while (**ptr == ' ' || **ptr == '\t' || **ptr == '-' || **ptr == '/') {
while (**ptr == ' ' || **ptr == '-' || **ptr == '/') {
++*ptr;
}
return timelib_lookup_relative_text(ptr, behavior);
@@ -545,7 +527,7 @@ static long timelib_lookup_month(char **ptr)
static long timelib_get_month(char **ptr)
{
while (**ptr == ' ' || **ptr == '\t' || **ptr == '-' || **ptr == '.' || **ptr == '/') {
while (**ptr == ' ' || **ptr == '-' || **ptr == '.' || **ptr == '/') {
++*ptr;
}
return timelib_lookup_month(ptr);
@@ -553,7 +535,7 @@ static long timelib_get_month(char **ptr)
static void timelib_eat_spaces(char **ptr)
{
while (**ptr == ' ' || **ptr == '\t') {
while (**ptr == ' ') {
++*ptr;
}
}
@@ -564,7 +546,7 @@ static const timelib_relunit* timelib_lookup_relunit(char **ptr)
char *begin = *ptr, *end;
const timelib_relunit *tp, *value = NULL;
while (**ptr != '\0' && **ptr != ' ' && **ptr != '\t') {
while (**ptr != '\0' && **ptr != ' ') {
++*ptr;
}
end = *ptr;
@@ -608,7 +590,7 @@ static void timelib_set_relative(char **ptr, timelib_sll amount, int behavior, S
static timelib_tz_lookup_table* zone_search(const char *word, long gmtoffset, int isdst)
{
int first_found = 0;
timelib_tz_lookup_table *tp, *first_found_elem = NULL;
timelib_tz_lookup_table *tp, *first_found_elem;
timelib_tz_lookup_table *fmp;
if (strcasecmp("utc", word) == 0 || strcasecmp("gmt", word) == 0) {
@@ -677,7 +659,7 @@ static long timelib_get_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_
*tz_not_found = 0;
while (**ptr == ' ' || **ptr == '\t' || **ptr == '(') {
while (**ptr == ' ' || **ptr == '(') {
++*ptr;
}
if (**ptr == '+') {
@@ -702,11 +684,9 @@ static long timelib_get_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_
char *tz_abbr;
t->is_localtime = 1;
t->zone_type = TIMELIB_ZONETYPE_ABBR;
offset = timelib_lookup_zone(ptr, dst, &tz_abbr, &found);
if (found) {
t->zone_type = TIMELIB_ZONETYPE_ABBR;
}
#if 0
/* If we found a TimeZone identifier, use it */
if (tz_name) {
@@ -722,7 +702,7 @@ static long timelib_get_zone(char **ptr, int *dst, timelib_time *t, int *tz_not_
found++;
}
}
if (found && t->zone_type != TIMELIB_ZONETYPE_ID) {
if (t->zone_type != TIMELIB_ZONETYPE_ID) {
timelib_time_tz_abbr_update(t, tz_abbr);
}
free(tz_abbr);
@@ -756,7 +736,7 @@ std:
/*!re2c
any = [\000-\377];
space = [ \t]+;
space = [ ]+;
frac = "."[0-9]+;
ago = 'ago';
@@ -768,8 +748,8 @@ minute = [0-5]?[0-9];
minutelz = [0-5][0-9];
second = minute | "60";
secondlz = minutelz | "60";
meridian = ([AaPp] "."? [Mm] "."?) [\000\t ];
tz = "("? [A-Za-z]{1,6} ")"? | [A-Z][a-z]+([_/][A-Z][a-z]+)+;
meridian = [AaPp] "."? [Mm] "."?;
tz = "("? [A-Za-z]{1,4} ")"? | [A-Z][a-z]+([_/][A-Z][a-z]+)+;
tzcorrection = [+-] hour24 ":"? minute?;
daysuf = "st" | "nd" | "rd" | "th";
@@ -800,17 +780,17 @@ timetiny12 = hour12 space? meridian;
timeshort12 = hour12[:.]minutelz space? meridian;
timelong12 = hour12[:.]minute[:.]secondlz space? meridian;
timeshort24 = 't'? hour24[:.]minute;
timelong24 = 't'? hour24[:.]minute[:.]second;
iso8601long = 't'? hour24 [:.] minute [:.] second frac;
timeshort24 = hour24[:.]minute;
timelong24 = hour24[:.]minute[:.]second;
iso8601long = hour24 [:.] minute [:.] second frac;
/* iso8601shorttz = hour24 [:] minutelz space? (tzcorrection | tz); */
iso8601normtz = 't'? hour24 [:.] minute [:.] secondlz space? (tzcorrection | tz);
iso8601normtz = hour24 [:.] minute [:.] secondlz space? (tzcorrection | tz);
/* iso8601longtz = hour24 [:] minute [:] secondlz frac space? (tzcorrection | tz); */
gnunocolon = 't'? hour24lz minutelz;
gnunocolon = hour24lz minutelz;
/* gnunocolontz = hour24lz minutelz space? (tzcorrection | tz); */
iso8601nocolon = 't'? hour24lz minutelz secondlz;
iso8601nocolon = hour24lz minutelz secondlz;
/* iso8601nocolontz = hour24lz minutelz secondlz space? (tzcorrection | tz); */
/* Date formats */
@@ -820,13 +800,13 @@ iso8601dateslash = year4 "/" monthlz "/" daylz "/"?;
dateslash = year4 "/" month "/" day;
gnudateshort = year "-" month "-" day;
iso8601date = year4 "-" monthlz "-" daylz;
pointeddate = day [.\t-] month [.-] year;
datefull = day ([ \t.-])* monthtext ([ \t.-])* year;
datenoday = monthtext ([ .\t-])* year4;
datenodayrev = year4 ([ .\t-])* monthtext;
datetextual = monthtext ([ .\t-])* day [,.stndrh\t ]* year;
datenoyear = monthtext ([ .\t-])* day [,.stndrh\t ]*;
datenoyearrev = day ([ .\t-])* monthtext;
pointeddate = day "." month "." year;
datefull = day ([ -.])* monthtext ([ -.])* year;
datenoday = monthtext ([ -.])* year4;
datenodayrev = year4 ([ -.])* monthtext;
datetextual = monthtext ([ -.])* day [,.stndrh ]* year;
datenoyear = monthtext ([ -.])* day [,.stndrh ]*;
datenoyearrev = day ([ -.])* monthtext;
datenocolon = year4 monthlz daylz;
/* Special formats */
@@ -839,13 +819,12 @@ pgtextshort = monthabbr "-" daylz "-" year;
pgtextreverse = year "-" monthabbr "-" daylz;
isoweekday = year4 "W" weekofyear [0-7];
isoweek = year4 "W" weekofyear;
exif = year4 ":" monthlz ":" daylz " " hour24lz ":" minutelz ":" secondlz;
/* Common Log Format: 10/Oct/2000:13:55:36 -0700 */
clf = day "/" monthabbr "/" year4 ":" hour24lz ":" minutelz ":" secondlz space tzcorrection;
/* Timestamp format: @1126396800 */
timestamp = "@" "-"? [0-9]+;
timestamp = "@" "-"? [1-9] [0-9]*;
/* To fix some ambiguities */
dateshortwithtimeshort = datenoyear timeshort24;
@@ -858,7 +837,7 @@ dateshortwithtimelongtz = datenoyear iso8601normtz;
reltextnumber = 'first'|'next'|'second'|'third'|'fourth'|'fifth'|'sixth'|'seventh'|'eight'|'ninth'|'tenth'|'eleventh'|'twelfth'|'last'|'previous'|'this';
reltextunit = (('sec'|'second'|'min'|'minute'|'hour'|'day'|'week'|'fortnight'|'forthnight'|'month'|'year') 's'?) | daytext;
relnumber = ([+-]?[ \t]*[0-9]+);
relnumber = ([+-]?[ ]*[0-9]+);
relative = relnumber space? reltextunit;
relativetext = reltextnumber space? reltextunit;
@@ -980,9 +959,7 @@ relativetext = reltextnumber space? reltextunit;
if (*ptr != '\0') {
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb);
if (tz_not_found) {
add_error(s, "The timezone could not be found in the database");
}
s->errors += tz_not_found;
}
TIMELIB_DEINIT;
return TIMELIB_TIME24_WITH_ZONE;
@@ -1003,7 +980,6 @@ relativetext = reltextnumber space? reltextunit;
break;
default:
TIMELIB_DEINIT;
add_error(s, "Double time specification");
return TIMELIB_ERROR;
}
s->time->have_time++;
@@ -1046,9 +1022,7 @@ relativetext = reltextnumber space? reltextunit;
if (*ptr != '\0') {
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb);
if (tz_not_found) {
add_error(s, "The timezone could not be found in the database");
}
s->errors += tz_not_found;
}
TIMELIB_DEINIT;
return TIMELIB_ISO_NOCOLON;
@@ -1184,10 +1158,10 @@ relativetext = reltextnumber space? reltextunit;
return TIMELIB_DATE_NOCOLON;
}
xmlrpc | xmlrpcnocolon | soap | wddx | exif
xmlrpc | xmlrpcnocolon | soap | wddx
{
int tz_not_found;
DEBUG_OUTPUT("xmlrpc | xmlrpcnocolon | soap | wddx | exif");
DEBUG_OUTPUT("xmlrpc | xmlrpcnocolon | soap | wddx");
TIMELIB_INIT;
TIMELIB_HAVE_TIME();
TIMELIB_HAVE_DATE();
@@ -1201,9 +1175,7 @@ relativetext = reltextnumber space? reltextunit;
s->time->f = timelib_get_frac_nr((char **) &ptr, 9);
if (*ptr) { /* timezone is optional */
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb);
if (tz_not_found) {
add_error(s, "The timezone could not be found in the database");
}
s->errors += tz_not_found;
}
}
TIMELIB_DEINIT;
@@ -1301,9 +1273,7 @@ relativetext = reltextnumber space? reltextunit;
s->time->i = timelib_get_nr((char **) &ptr, 2);
s->time->s = timelib_get_nr((char **) &ptr, 2);
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb);
if (tz_not_found) {
add_error(s, "The timezone could not be found in the database");
}
s->errors += tz_not_found;
TIMELIB_DEINIT;
return TIMELIB_CLF;
}
@@ -1351,7 +1321,7 @@ relativetext = reltextnumber space? reltextunit;
relativetext
{
timelib_sll i;
int behavior = 0;
int behavior;
DEBUG_OUTPUT("relativetext");
TIMELIB_INIT;
TIMELIB_HAVE_RELATIVE();
@@ -1370,11 +1340,8 @@ relativetext = reltextnumber space? reltextunit;
int tz_not_found;
DEBUG_OUTPUT("tzcorrection | tz");
TIMELIB_INIT;
TIMELIB_HAVE_TZ();
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb);
if (tz_not_found) {
add_error(s, "The timezone could not be found in the database");
}
s->errors += tz_not_found;
TIMELIB_DEINIT;
return TIMELIB_TIMEZONE;
}
@@ -1401,9 +1368,7 @@ relativetext = reltextnumber space? reltextunit;
if (*ptr != '\0') {
s->time->z = timelib_get_zone((char **) &ptr, &s->time->dst, s->time, &tz_not_found, s->tzdb);
if (tz_not_found) {
add_error(s, "The timezone could not be found in the database");
}
s->errors += tz_not_found;
}
TIMELIB_DEINIT;
return TIMELIB_SHORTDATE_WITH_TIME;
@@ -1425,7 +1390,7 @@ relativetext = reltextnumber space? reltextunit;
return TIMELIB_RELATIVE;
}
[ .,\t]
[ .,]
{
goto std;
}
@@ -1438,7 +1403,8 @@ relativetext = reltextnumber space? reltextunit;
any
{
add_error(s, "Unexpected character");
/* printf("unexpected character: #%d, %c ", *s->tok, *s->tok); */
s->errors++;
goto std;
}
*/
@@ -1446,19 +1412,12 @@ relativetext = reltextnumber space? reltextunit;
/*!max:re2c */
timelib_time* timelib_strtotime(char *s, int len, struct timelib_error_container **errors, timelib_tzdb *tzdb)
timelib_time* timelib_strtotime(char *s, int len, int *errors, timelib_tzdb *tzdb)
{
Scanner in;
int t;
char *e = s + len - 1;
memset(&in, 0, sizeof(in));
in.errors = malloc(sizeof(struct timelib_error_container));
in.errors->warning_count = 0;
in.errors->warning_messages = NULL;
in.errors->error_count = 0;
in.errors->error_messages = NULL;
while (isspace(*s) && s < e) {
s++;
}
@@ -1466,19 +1425,15 @@ timelib_time* timelib_strtotime(char *s, int len, struct timelib_error_container
e--;
}
if (e - s < 1) {
*errors = 1;
in.time = timelib_time_ctor();
add_error(&in, "Empty string");
if (errors) {
*errors = in.errors;
} else {
timelib_error_container_dtor(in.errors);
}
in.time->y = in.time->d = in.time->m = in.time->h = in.time->i = in.time->s = in.time->f = in.time->z = in.time->dst = -1;
in.time->is_localtime = in.time->zone_type = 0;
return in.time;
}
e++;
memset(&in, 0, sizeof(in));
in.str = malloc((e - s) + YYMAXFILL);
memset(in.str, 0, (e - s) + YYMAXFILL);
memcpy(in.str, s, (e - s));
@@ -1494,6 +1449,7 @@ timelib_time* timelib_strtotime(char *s, int len, struct timelib_error_container
in.time->f = -1;
in.time->z = -1;
in.time->dst = -1;
in.errors = 0;
in.tzdb = tzdb;
in.time->is_localtime = 0;
in.time->zone_type = 0;
@@ -1506,11 +1462,7 @@ timelib_time* timelib_strtotime(char *s, int len, struct timelib_error_container
} while(t != EOI);
free(in.str);
if (errors) {
*errors = in.errors;
} else {
timelib_error_container_dtor(in.errors);
}
*errors = in.errors;
return in.time;
}
+1 -4
View File
@@ -368,7 +368,6 @@ timelib_time_offset *timelib_get_time_zone_info(timelib_sll ts, timelib_tzinfo *
timelib_sll timelib_get_current_offset(timelib_time *t)
{
timelib_time_offset *gmt_offset;
timelib_sll retval;
switch (t->zone_type) {
case TIMELIB_ZONETYPE_ABBR:
@@ -377,9 +376,7 @@ timelib_sll timelib_get_current_offset(timelib_time *t)
case TIMELIB_ZONETYPE_ID:
gmt_offset = timelib_get_time_zone_info(t->sse, t->tz_info);
retval = gmt_offset->offset;
timelib_time_offset_dtor(gmt_offset);
return retval;
return gmt_offset->offset;
default:
return 0;
-15
View File
@@ -122,21 +122,6 @@ char *timelib_get_tz_abbr_ptr(timelib_time *t)
return t->tz_abbr;
}
void timelib_error_container_dtor(timelib_error_container *errors)
{
int i;
for (i = 0; i < errors->warning_count; i++) {
free(errors->warning_messages[i].message);
}
free(errors->warning_messages);
for (i = 0; i < errors->error_count; i++) {
free(errors->error_messages[i].message);
}
free(errors->error_messages);
free(errors);
}
signed long timelib_date_to_int(timelib_time *d, int *error)
{
timelib_sll ts;
+1 -3
View File
@@ -51,7 +51,7 @@ timelib_sll timelib_days_in_month(timelib_sll y, timelib_sll m);
void timelib_isoweek_from_date(timelib_sll y, timelib_sll m, timelib_sll d, timelib_sll *iw, timelib_sll *iy);
/* From parse_date.re */
timelib_time *timelib_strtotime(char *s, int len, timelib_error_container **errors, timelib_tzdb *tzdb);
timelib_time *timelib_strtotime(char *s, int len, int *errors, timelib_tzdb *tzdb);
void timelib_fill_holes(timelib_time *parsed, timelib_time *now, int options);
char *timelib_timezone_id_from_abbr(const char *abbr, long gmtoffset, int isdst);
timelib_tz_lookup_table *timelib_timezone_abbreviations_list(void);
@@ -90,8 +90,6 @@ void timelib_time_dtor(timelib_time* t);
timelib_time_offset* timelib_time_offset_ctor();
void timelib_time_offset_dtor(timelib_time_offset* t);
void timelib_error_container_dtor(timelib_error_container *errors);
signed long timelib_date_to_int(timelib_time *d, int *error);
void timelib_dump_date(timelib_time *d, int options);
+3 -17
View File
@@ -147,19 +147,6 @@ typedef struct timelib_time {
* 2 TimeZone abbreviation */
} timelib_time;
typedef struct timelib_error_message {
int position;
char character;
char *message;
} timelib_error_message;
typedef struct timelib_error_container {
int warning_count;
struct timelib_error_message *warning_messages;
int error_count;
struct timelib_error_message *error_messages;
} timelib_error_container;
typedef struct _timelib_tz_lookup_table {
char *name;
int type;
@@ -183,10 +170,9 @@ typedef struct _timelib_tzdb {
#define TIMELIB_ZONETYPE_ABBR 2
#define TIMELIB_ZONETYPE_ID 3
#define SECS_PER_ERA 12622780800L
#define SECS_PER_DAY 86400
#define DAYS_PER_YEAR 365
#define DAYS_PER_LYEAR 366
#define SECS_PER_DAY 86400
#define DAYS_PER_YEAR 365
#define DAYS_PER_LYEAR 366
#define timelib_is_leap(y) ((y) % 4 == 0 && ((y) % 100 != 0 || (y) % 400 == 0))
+517 -676
View File
File diff suppressed because it is too large. Load diff
+4 -15
View File
@@ -13,7 +13,6 @@
{ "adt", 1, -10800, "America/Glace_Bay" },
{ "adt", 1, -10800, "America/Goose_Bay" },
{ "adt", 1, -10800, "America/Martinique" },
{ "adt", 1, -10800, "America/Moncton" },
{ "adt", 1, -10800, "America/Pangnirtung" },
{ "adt", 1, -10800, "America/Thule" },
{ "adt", 1, -10800, "Atlantic/Bermuda" },
@@ -71,7 +70,6 @@
{ "ant", 0, -16200, "America/Aruba" },
{ "apt", 1, -10800, "America/Halifax" },
{ "apt", 1, -10800, "America/Glace_Bay" },
{ "apt", 1, -10800, "America/Moncton" },
{ "apt", 1, -10800, "America/Pangnirtung" },
{ "apt", 1, -10800, "Canada/Atlantic" },
{ "aqtst", 1, 18000, "Asia/Aqtau" },
@@ -174,7 +172,6 @@
{ "ast", 0, -14400, "America/Halifax" },
{ "ast", 0, -14400, "America/Martinique" },
{ "ast", 0, -14400, "America/Miquelon" },
{ "ast", 0, -14400, "America/Moncton" },
{ "ast", 0, -14400, "America/Montserrat" },
{ "ast", 0, -14400, "America/Pangnirtung" },
{ "ast", 0, -14400, "America/Port_of_Spain" },
@@ -196,7 +193,6 @@
{ "ast", 0, 10800, "Asia/Qatar" },
{ "awt", 1, -10800, "America/Halifax" },
{ "awt", 1, -10800, "America/Glace_Bay" },
{ "awt", 1, -10800, "America/Moncton" },
{ "awt", 1, -10800, "America/Pangnirtung" },
{ "awt", 1, -10800, "America/Puerto_Rico" },
{ "awt", 1, -10800, "Canada/Atlantic" },
@@ -313,9 +309,7 @@
{ "cdt", 1, -18000, "America/Indiana/Indianapolis" },
{ "cdt", 1, -18000, "America/Indiana/Knox" },
{ "cdt", 1, -18000, "America/Indiana/Marengo" },
{ "cdt", 1, -18000, "America/Indiana/Petersburg" },
{ "cdt", 1, -18000, "America/Indiana/Vevay" },
{ "cdt", 1, -18000, "America/Indiana/Vincennes" },
{ "cdt", 1, -18000, "America/Indianapolis" },
{ "cdt", 1, -18000, "America/Iqaluit" },
{ "cdt", 1, -18000, "America/Kentucky/Louisville" },
@@ -496,9 +490,7 @@
{ "cpt", 1, -18000, "America/Indiana/Indianapolis" },
{ "cpt", 1, -18000, "America/Indiana/Knox" },
{ "cpt", 1, -18000, "America/Indiana/Marengo" },
{ "cpt", 1, -18000, "America/Indiana/Petersburg" },
{ "cpt", 1, -18000, "America/Indiana/Vevay" },
{ "cpt", 1, -18000, "America/Indiana/Vincennes" },
{ "cpt", 1, -18000, "America/Indianapolis" },
{ "cpt", 1, -18000, "America/Kentucky/Louisville" },
{ "cpt", 1, -18000, "America/Kentucky/Monticello" },
@@ -529,9 +521,7 @@
{ "cst", 0, -21600, "America/Indiana/Indianapolis" },
{ "cst", 0, -21600, "America/Indiana/Knox" },
{ "cst", 0, -21600, "America/Indiana/Marengo" },
{ "cst", 0, -21600, "America/Indiana/Petersburg" },
{ "cst", 0, -21600, "America/Indiana/Vevay" },
{ "cst", 0, -21600, "America/Indiana/Vincennes" },
{ "cst", 0, -21600, "America/Indianapolis" },
{ "cst", 0, -21600, "America/Iqaluit" },
{ "cst", 0, -21600, "America/Kentucky/Louisville" },
@@ -594,9 +584,7 @@
{ "cwt", 1, -18000, "America/Indiana/Indianapolis" },
{ "cwt", 1, -18000, "America/Indiana/Knox" },
{ "cwt", 1, -18000, "America/Indiana/Marengo" },
{ "cwt", 1, -18000, "America/Indiana/Petersburg" },
{ "cwt", 1, -18000, "America/Indiana/Vevay" },
{ "cwt", 1, -18000, "America/Indiana/Vincennes" },
{ "cwt", 1, -18000, "America/Indianapolis" },
{ "cwt", 1, -18000, "America/Kentucky/Louisville" },
{ "cwt", 1, -18000, "America/Kentucky/Monticello" },
@@ -653,14 +641,15 @@
{ "edt", 1, -14400, "America/Fort_Wayne" },
{ "edt", 1, -14400, "America/Grand_Turk" },
{ "edt", 1, -14400, "America/Indiana/Indianapolis" },
{ "edt", 1, -14400, "America/Indiana/Knox" },
{ "edt", 1, -14400, "America/Indiana/Marengo" },
{ "edt", 1, -14400, "America/Indiana/Vevay" },
{ "edt", 1, -14400, "America/Indiana/Vincennes" },
{ "edt", 1, -14400, "America/Indianapolis" },
{ "edt", 1, -14400, "America/Iqaluit" },
{ "edt", 1, -14400, "America/Jamaica" },
{ "edt", 1, -14400, "America/Kentucky/Louisville" },
{ "edt", 1, -14400, "America/Kentucky/Monticello" },
{ "edt", 1, -14400, "America/Knox_IN" },
{ "edt", 1, -14400, "America/Louisville" },
{ "edt", 1, -14400, "America/Montreal" },
{ "edt", 1, -14400, "America/Nassau" },
@@ -676,6 +665,7 @@
{ "edt", 1, -14400, "Jamaica" },
{ "edt", 1, -14400, "US/East-Indiana" },
{ "edt", 1, -14400, "US/Eastern" },
{ "edt", 1, -14400, "US/Indiana-Starke" },
{ "edt", 1, -14400, "US/Michigan" },
{ "eest", 1, 10800, "Europe/Helsinki" },
{ "eest", 1, 10800, "Africa/Cairo" },
@@ -774,9 +764,7 @@
{ "est", 0, -18000, "America/Indiana/Indianapolis" },
{ "est", 0, -18000, "America/Indiana/Knox" },
{ "est", 0, -18000, "America/Indiana/Marengo" },
{ "est", 0, -18000, "America/Indiana/Petersburg" },
{ "est", 0, -18000, "America/Indiana/Vevay" },
{ "est", 0, -18000, "America/Indiana/Vincennes" },
{ "est", 0, -18000, "America/Indianapolis" },
{ "est", 0, -18000, "America/Iqaluit" },
{ "est", 0, -18000, "America/Jamaica" },
@@ -895,6 +883,7 @@
{ "gmt", 0, 0, "Europe/London" },
{ "gmt", 0, 0, "GB" },
{ "gmt", 0, 0, "GB-Eire" },
{ "gmt", 0, 0, "GMT" },
{ "gmt", 0, 0, "Iceland" },
{ "gst", 0, 14400, "Asia/Dubai" },
{ "gst", 0, 14400, "Asia/Bahrain" },
-7
View File
@@ -135,13 +135,6 @@ static timelib_sll do_years(timelib_sll year)
{
timelib_sll i;
timelib_sll res = 0;
timelib_sll eras;
eras = (year - 1970) / 400;
if (eras != 0) {
year = year - (eras * 400);
res += (SECS_PER_ERA * eras);
}
if (year >= 1970) {
for (i = year - 1; i >= 1970; i--) {
+36 -149
View File
@@ -51,7 +51,6 @@ zend_function_entry date_functions[] = {
#ifdef EXPERIMENTAL_DATE_SUPPORT
/* Advanced Interface */
PHP_FE(date_create, NULL)
PHP_FE(date_parse, NULL)
PHP_FE(date_format, NULL)
PHP_FE(date_modify, NULL)
PHP_FE(date_timezone_get, NULL)
@@ -64,7 +63,6 @@ zend_function_entry date_functions[] = {
PHP_FE(timezone_open, NULL)
PHP_FE(timezone_name_get, NULL)
PHP_FE(timezone_name_from_abbr, NULL)
PHP_FE(timezone_offset_get, NULL)
PHP_FE(timezone_transistions_get, NULL)
PHP_FE(timezone_identifiers_list, NULL)
@@ -78,7 +76,7 @@ zend_function_entry date_functions[] = {
/* Astronomical functions */
PHP_FE(date_sunrise, NULL)
PHP_FE(date_sunset, NULL)
PHP_FE(date_sun_info, NULL)
/* PHP_FE(date_sun_info, NULL) */
{NULL, NULL, NULL}
};
@@ -237,7 +235,6 @@ PHP_RSHUTDOWN_FUNCTION(date)
#define DATE_TIMEZONEDB php_date_global_timezone_db ? php_date_global_timezone_db : timelib_builtin_db()
#define DATE_FORMAT_RFC3339 "Y-m-d\\TH:i:sP"
#define DATE_FORMAT_ISO8601 "Y-m-d\\TH:i:sO"
#define DATE_FORMAT_RFC1036 "l, d-M-y H:i:s T"
#define DATE_FORMAT_RFC1123 "D, d M Y H:i:s T"
@@ -263,7 +260,7 @@ PHP_MINIT_FUNCTION(date)
#ifdef EXPERIMENTAL_DATE_SUPPORT
date_register_classes(TSRMLS_C);
#endif
REGISTER_STRING_CONSTANT("DATE_ATOM", DATE_FORMAT_RFC3339, CONST_CS | CONST_PERSISTENT);
REGISTER_STRING_CONSTANT("DATE_ATOM", DATE_FORMAT_ISO8601, CONST_CS | CONST_PERSISTENT);
REGISTER_STRING_CONSTANT("DATE_COOKIE", DATE_FORMAT_RFC1123, CONST_CS | CONST_PERSISTENT);
REGISTER_STRING_CONSTANT("DATE_ISO8601", DATE_FORMAT_ISO8601, CONST_CS | CONST_PERSISTENT);
REGISTER_STRING_CONSTANT("DATE_RFC822", DATE_FORMAT_RFC1123, CONST_CS | CONST_PERSISTENT);
@@ -271,9 +268,8 @@ PHP_MINIT_FUNCTION(date)
REGISTER_STRING_CONSTANT("DATE_RFC1036", DATE_FORMAT_RFC1036, CONST_CS | CONST_PERSISTENT);
REGISTER_STRING_CONSTANT("DATE_RFC1123", DATE_FORMAT_RFC1123, CONST_CS | CONST_PERSISTENT);
REGISTER_STRING_CONSTANT("DATE_RFC2822", DATE_FORMAT_RFC2822, CONST_CS | CONST_PERSISTENT);
REGISTER_STRING_CONSTANT("DATE_RFC3339", DATE_FORMAT_RFC3339, CONST_CS | CONST_PERSISTENT);
REGISTER_STRING_CONSTANT("DATE_RSS", DATE_FORMAT_RFC1123, CONST_CS | CONST_PERSISTENT);
REGISTER_STRING_CONSTANT("DATE_W3C", DATE_FORMAT_RFC3339, CONST_CS | CONST_PERSISTENT);
REGISTER_STRING_CONSTANT("DATE_W3C", DATE_FORMAT_ISO8601, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("SUNFUNCS_RET_TIMESTAMP", SUNFUNCS_RET_TIMESTAMP, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("SUNFUNCS_RET_STRING", SUNFUNCS_RET_STRING, CONST_CS | CONST_PERSISTENT);
@@ -463,7 +459,6 @@ static char *date_format(char *format, int format_len, timelib_time *t, int loca
char buffer[33];
timelib_time_offset *offset;
timelib_sll isoweek, isoyear;
int rfc_colon = 0;
if (!format_len) {
return estrdup("");
@@ -542,11 +537,9 @@ static char *date_format(char *format, int format_len, timelib_time *t, int loca
/* timezone */
case 'I': snprintf(buffer, 32, "%d", localtime ? offset->is_dst : 0); break;
case 'P': rfc_colon = 1; /* break intentionally missing */
case 'O': snprintf(buffer, 32, "%c%02d%s%02d",
case 'O': snprintf(buffer, 32, "%c%02d%02d",
localtime ? ((offset->offset < 0) ? '-' : '+') : '+',
localtime ? abs(offset->offset / 3600) : 0,
rfc_colon ? ":" : "",
localtime ? abs((offset->offset % 3600) / 60) : 0
);
break;
@@ -793,17 +786,17 @@ PHPAPI void php_date_set_tzdb(timelib_tzdb *tzdb)
/* }}} */
/* {{{ php_parse_date: Backwards compability function */
PHPAPI signed long php_parse_date(char *string, signed long *now)
signed long php_parse_date(char *string, signed long *now)
{
timelib_time *parsed_time;
int error2;
int error1, error2;
signed long retval;
parsed_time = timelib_strtotime(string, strlen(string), NULL, DATE_TIMEZONEDB);
parsed_time = timelib_strtotime(string, strlen(string), &error1, DATE_TIMEZONEDB);
timelib_update_ts(parsed_time, NULL);
retval = timelib_date_to_int(parsed_time, &error2);
timelib_time_dtor(parsed_time);
if (error2) {
if (error1 || error2) {
return -1;
}
return retval;
@@ -811,13 +804,12 @@ PHPAPI signed long php_parse_date(char *string, signed long *now)
/* }}} */
/* {{{ proto int strtotime(string time [, int now ])
/* {{{ proto int strtotime(string time, int now)
Convert string representation of date and time to a timestamp */
PHP_FUNCTION(strtotime)
{
char *times, *initial_ts;
int time_len, error1, error2;
struct timelib_error_container *error;
long preset_ts, ts;
timelib_time *t, *now;
@@ -830,8 +822,8 @@ PHP_FUNCTION(strtotime)
now = timelib_time_ctor();
initial_ts = emalloc(25);
snprintf(initial_ts, 24, "@%ld", preset_ts);
t = timelib_strtotime(initial_ts, strlen(initial_ts), NULL, DATE_TIMEZONEDB); /* we ignore the error here, as this should never fail */
snprintf(initial_ts, 24, "@%lu", preset_ts);
t = timelib_strtotime(initial_ts, strlen(initial_ts), &error1, DATE_TIMEZONEDB); /* we ignore the error here, as this should never fail */
timelib_update_ts(t, tzi);
now->tz_info = tzi;
now->zone_type = TIMELIB_ZONETYPE_ID;
@@ -848,9 +840,7 @@ PHP_FUNCTION(strtotime)
RETURN_FALSE;
}
t = timelib_strtotime(times, time_len, &error, DATE_TIMEZONEDB);
error1 = error->error_count;
timelib_error_container_dtor(error);
t = timelib_strtotime(times, time_len, &error1, DATE_TIMEZONEDB);
timelib_fill_holes(t, now, 0);
timelib_update_ts(t, tzi);
ts = timelib_date_to_int(t, &error2);
@@ -1208,7 +1198,7 @@ static void date_register_classes(TSRMLS_D)
#define REGISTER_DATE_CLASS_CONST_STRING(const_name, value) \
zend_declare_class_constant_stringl(date_ce_date, const_name, sizeof(const_name)-1, value, sizeof(value)-1 TSRMLS_CC);
REGISTER_DATE_CLASS_CONST_STRING("ATOM", DATE_FORMAT_RFC3339);
REGISTER_DATE_CLASS_CONST_STRING("ATOM", DATE_FORMAT_ISO8601);
REGISTER_DATE_CLASS_CONST_STRING("COOKIE", DATE_FORMAT_RFC1123);
REGISTER_DATE_CLASS_CONST_STRING("ISO8601", DATE_FORMAT_ISO8601);
REGISTER_DATE_CLASS_CONST_STRING("RFC822", DATE_FORMAT_RFC1123);
@@ -1216,7 +1206,6 @@ static void date_register_classes(TSRMLS_D)
REGISTER_DATE_CLASS_CONST_STRING("RFC1036", DATE_FORMAT_RFC1036);
REGISTER_DATE_CLASS_CONST_STRING("RFC1123", DATE_FORMAT_RFC1123);
REGISTER_DATE_CLASS_CONST_STRING("RFC2822", DATE_FORMAT_RFC2822);
REGISTER_DATE_CLASS_CONST_STRING("RFC3339", DATE_FORMAT_RFC3339);
REGISTER_DATE_CLASS_CONST_STRING("RSS", DATE_FORMAT_RFC1123);
REGISTER_DATE_CLASS_CONST_STRING("W3C", DATE_FORMAT_ISO8601);
@@ -1236,8 +1225,10 @@ static zend_object_value date_object_new_date(zend_class_entry *class_type TSRML
intern = emalloc(sizeof(php_date_obj));
memset(intern, 0, sizeof(php_date_obj));
intern->std.ce = class_type;
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
ALLOC_HASHTABLE(intern->std.properties);
zend_hash_init(intern->std.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t) date_object_free_storage_date, NULL TSRMLS_CC);
@@ -1254,8 +1245,10 @@ static zend_object_value date_object_new_timezone(zend_class_entry *class_type T
intern = emalloc(sizeof(php_timezone_obj));
memset(intern, 0, sizeof(php_timezone_obj));
intern->std.ce = class_type;
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
ALLOC_HASHTABLE(intern->std.properties);
zend_hash_init(intern->std.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t) date_object_free_storage_timezone, NULL TSRMLS_CC);
@@ -1275,7 +1268,12 @@ static void date_object_free_storage_date(void *object TSRMLS_DC)
timelib_time_dtor(intern->time);
}
zend_object_std_dtor(&intern->std TSRMLS_CC);
if (intern->std.properties) {
zend_hash_destroy(intern->std.properties);
efree(intern->std.properties);
intern->std.properties = NULL;
}
efree(object);
}
@@ -1283,7 +1281,12 @@ static void date_object_free_storage_timezone(void *object TSRMLS_DC)
{
php_timezone_obj *intern = (php_timezone_obj *)object;
zend_object_std_dtor(&intern->std TSRMLS_CC);
if (intern->std.properties) {
zend_hash_destroy(intern->std.properties);
efree(intern->std.properties);
intern->std.properties = NULL;
}
efree(object);
}
@@ -1305,6 +1308,7 @@ PHP_FUNCTION(date_create)
{
php_date_obj *dateobj;
zval *timezone_object = NULL;
int error;
timelib_time *now;
timelib_tzinfo *tzi;
char *time_str;
@@ -1316,7 +1320,7 @@ PHP_FUNCTION(date_create)
date_instanciate(date_ce_date, return_value TSRMLS_CC);
dateobj = (php_date_obj *) zend_object_store_get_object(return_value TSRMLS_CC);
dateobj->time = timelib_strtotime(time_str_len ? time_str : "now", time_str_len ? time_str_len : sizeof("now") -1, NULL, DATE_TIMEZONEDB);
dateobj->time = timelib_strtotime(time_str_len ? time_str : "now", time_str_len ? time_str_len : sizeof("now") -1, &error, DATE_TIMEZONEDB);
if (timezone_object) {
php_timezone_obj *tzobj;
@@ -1348,101 +1352,6 @@ PHP_FUNCTION(date_create)
timelib_time_dtor(now);
}
PHP_FUNCTION(date_parse)
{
char *date;
int date_len, i;
struct timelib_error_container *error;
timelib_time *parsed_time;
zval *element;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &date, &date_len) == FAILURE) {
RETURN_FALSE;
}
parsed_time = timelib_strtotime(date, date_len, &error, DATE_TIMEZONEDB);
array_init(return_value);
#define PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(name, elem) \
if (parsed_time->elem == -1) { \
add_assoc_bool(return_value, #name, 0); \
} else { \
add_assoc_long(return_value, #name, parsed_time->elem); \
}
PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(year, y);
PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(month, m);
PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(day, d);
PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(hour, h);
PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(minute, i);
PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(second, s);
if (parsed_time->f == -1) {
add_assoc_bool(return_value, "fraction", 0);
} else {
add_assoc_double(return_value, "fraction", parsed_time->f);
}
add_assoc_long(return_value, "warning_count", error->warning_count);
MAKE_STD_ZVAL(element);
array_init(element);
for (i = 0; i < error->warning_count; i++) {
add_index_string(element, error->warning_messages[i].position, error->warning_messages[i].message, 1);
}
add_assoc_zval(return_value, "warnings", element);
add_assoc_long(return_value, "error_count", error->error_count);
MAKE_STD_ZVAL(element);
array_init(element);
for (i = 0; i < error->error_count; i++) {
add_index_string(element, error->error_messages[i].position, error->error_messages[i].message, 1);
}
add_assoc_zval(return_value, "errors", element);
timelib_error_container_dtor(error);
add_assoc_bool(return_value, "is_localtime", parsed_time->is_localtime);
if (parsed_time->is_localtime) {
PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(zone_type, zone_type);
switch (parsed_time->zone_type) {
case TIMELIB_ZONETYPE_OFFSET:
PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(zone, z);
add_assoc_bool(return_value, "is_dst", parsed_time->dst);
break;
case TIMELIB_ZONETYPE_ID:
if (parsed_time->tz_abbr) {
add_assoc_string(return_value, "tz_abbr", parsed_time->tz_abbr, 1);
}
if (parsed_time->tz_info) {
add_assoc_string(return_value, "tz_id", parsed_time->tz_info->name, 1);
}
break;
case TIMELIB_ZONETYPE_ABBR:
PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(zone, z);
add_assoc_bool(return_value, "is_dst", parsed_time->dst);
add_assoc_string(return_value, "tz_abbr", parsed_time->tz_abbr, 1);
break;
}
}
if (parsed_time->have_relative || parsed_time->have_weekday_relative) {
MAKE_STD_ZVAL(element);
array_init(element);
}
if (parsed_time->have_relative) {
add_assoc_long(element, "year", parsed_time->relative.y);
add_assoc_long(element, "month", parsed_time->relative.m);
add_assoc_long(element, "day", parsed_time->relative.d);
add_assoc_long(element, "hour", parsed_time->relative.h);
add_assoc_long(element, "minute", parsed_time->relative.i);
add_assoc_long(element, "second", parsed_time->relative.s);
}
if (parsed_time->have_weekday_relative) {
add_assoc_long(element, "weekday", parsed_time->relative.weekday);
}
if (parsed_time->have_relative || parsed_time->have_weekday_relative) {
add_assoc_zval(return_value, "relative", element);
}
timelib_time_dtor(parsed_time);
}
PHP_FUNCTION(date_format)
{
zval *object;
@@ -1463,6 +1372,7 @@ PHP_FUNCTION(date_modify)
php_date_obj *dateobj;
char *modify;
int modify_len;
int error;
timelib_time *tmp_time;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &object, date_ce_date, &modify, &modify_len) == FAILURE) {
@@ -1470,7 +1380,7 @@ PHP_FUNCTION(date_modify)
}
dateobj = (php_date_obj *) zend_object_store_get_object(object TSRMLS_CC);
tmp_time = timelib_strtotime(modify, modify_len, NULL, DATE_TIMEZONEDB);
tmp_time = timelib_strtotime(modify, modify_len, &error, DATE_TIMEZONEDB);
dateobj->time->relative.y = tmp_time->relative.y;
dateobj->time->relative.m = tmp_time->relative.m;
dateobj->time->relative.d = tmp_time->relative.d;
@@ -1643,26 +1553,6 @@ PHP_FUNCTION(timezone_name_get)
RETURN_STRING(tzobj->tz->name, 1);
}
PHP_FUNCTION(timezone_name_from_abbr)
{
char *abbr;
char *tzname;
int abbr_len;
long gmtoffset = -1;
long isdst = -1;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ll", &abbr, &abbr_len, &gmtoffset, &isdst) == FAILURE) {
RETURN_FALSE;
}
tzname = timelib_timezone_id_from_abbr(abbr, gmtoffset, isdst);
if (tzname) {
RETURN_STRING(tzname, 1);
} else {
RETURN_FALSE;
}
}
PHP_FUNCTION(timezone_offset_get)
{
zval *object, *dateobject;
@@ -1851,8 +1741,7 @@ static void php_do_date_sunrise_sunset(INTERNAL_FUNCTION_PARAMETERS, int calc_su
timelib_unixtime2local(t, time);
rs = timelib_astro_rise_set_altitude(t, longitude, latitude, altitude, altitude > -1 ? 1 : 0, &h_rise, &h_set, &rise, &set, &transit);
timelib_time_dtor(t);
if (rs != 0) {
RETURN_FALSE;
}
@@ -1995,8 +1884,6 @@ PHP_FUNCTION(date_sun_info)
t2->sse = set;
add_assoc_long(return_value, "astronomical_twilight_end", timelib_date_to_int(t2, &dummy));
}
timelib_time_dtor(t);
timelib_time_dtor(t2);
}
/* }}} */
/*
+1 -3
View File
@@ -49,7 +49,6 @@ PHP_FUNCTION(getdate);
#ifdef EXPERIMENTAL_DATE_SUPPORT
/* Advanced Interface */
PHP_FUNCTION(date_create);
PHP_FUNCTION(date_parse);
PHP_FUNCTION(date_format);
PHP_FUNCTION(date_modify);
PHP_FUNCTION(date_timezone_get);
@@ -62,7 +61,6 @@ PHP_FUNCTION(date_isodate_set);
PHP_FUNCTION(timezone_open);
PHP_FUNCTION(timezone_name_get);
PHP_FUNCTION(timezone_name_from_abbr);
PHP_FUNCTION(timezone_offset_get);
PHP_FUNCTION(timezone_transistions_get);
PHP_FUNCTION(timezone_identifiers_list);
@@ -97,7 +95,7 @@ ZEND_END_MODULE_GLOBALS(date)
#endif
/* Backwards compability wrapper */
PHPAPI signed long php_parse_date(char *string, signed long *now);
signed long php_parse_date(char *string, signed long *now);
PHPAPI void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gmt);
PHPAPI int php_idate(char format, time_t ts, int localtime);
#if HAVE_STRFTIME
+1 -1
View File
@@ -1,6 +1,6 @@
--TEST--
Bug #26317 (military timezone offset signedness)
--SKIPIF--
--SKIP--
if (!@putenv("TZ=GMT0") || getenv("TZ") != 'GMT0') {
die("skip unable to change TZ enviroment variable\n");
}
+2 -2
View File
@@ -1,6 +1,6 @@
--TEST--
Bug #26320 (strtotime handling of XML Schema/ISO 8601 format)
--SKIPIF--
--SKIP--
if (!@putenv("TZ=GMT0") || getenv("TZ") != 'GMT0') {
die("skip unable to change TZ enviroment variable\n");
}
@@ -12,4 +12,4 @@ if (!@putenv("TZ=GMT0") || getenv("TZ") != 'GMT0') {
?>
--EXPECT--
2003-11-19 12:30:42
2003-11-19 12:30:42
2003-11-19 12:30:42
-18
View File
@@ -139,15 +139,9 @@ DBA_FETCH_FUNC(db4)
DB4_GKEY;
memset(&gval, 0, sizeof(gval));
if (info->flags & DBA_PERSISTENT) {
gval.flags |= DB_DBT_MALLOC;
}
if (!dba->dbp->get(dba->dbp, NULL, &gkey, &gval, 0)) {
if (newlen) *newlen = gval.size;
new = estrndup(gval.data, gval.size);
if (info->flags & DBA_PERSISTENT) {
free(gval.data);
}
}
return new;
}
@@ -216,23 +210,11 @@ DBA_NEXTKEY_FUNC(db4)
memset(&gkey, 0, sizeof(gkey));
memset(&gval, 0, sizeof(gval));
if (info->flags & DBA_PERSISTENT) {
gkey.flags |= DB_DBT_MALLOC;
gval.flags |= DB_DBT_MALLOC;
}
if (dba->cursor->c_get(dba->cursor, &gkey, &gval, DB_NEXT) == 0) {
if (gkey.data) {
nkey = estrndup(gkey.data, gkey.size);
if (newlen) *newlen = gkey.size;
}
if (info->flags & DBA_PERSISTENT) {
if (gkey.data) {
free(gkey.data);
}
if (gval.data) {
free(gval.data);
}
}
}
return nkey;
+4 -7
View File
@@ -24,7 +24,7 @@ dbhead_t *get_dbf_head(int fd)
dbfield_t *dbf, *cur_f, *tdbf;
int ret, nfields, offset, gf_retval;
if ((dbh = (dbhead_t *)calloc(1, sizeof(dbhead_t))) == NULL)
if ((dbh = (dbhead_t *)malloc(sizeof(dbhead_t))) == NULL)
return NULL;
if (lseek(fd, 0, 0) < 0)
return NULL;
@@ -44,7 +44,7 @@ dbhead_t *get_dbf_head(int fd)
/* malloc enough memory for the maximum number of fields:
32 * 1024 = 32K dBase5 (for Win) seems to allow that many */
tdbf = (dbfield_t *)calloc(1, sizeof(dbfield_t)*1024);
tdbf = (dbfield_t *)malloc(sizeof(dbfield_t)*1024);
offset = 1;
nfields = 0;
@@ -157,8 +157,7 @@ int get_dbf_field(dbhead_t *dbh, dbfield_t *dbf)
}
if ((dbf->db_format = get_dbf_f_fmt(dbf)) == NULL) {
/* something went wrong, most likely this fieldtype is not supported */
return -1;
return 1;
}
return 0;
@@ -236,8 +235,6 @@ char *get_dbf_f_fmt(dbfield_t *dbf)
case 'M':
strcpy(format, "%s");
break;
default:
return NULL;
}
return (char *)strdup(format);
}
@@ -259,7 +256,7 @@ dbhead_t *dbf_open(char *dp, int o_flags TSRMLS_DC)
}
}
if ((dbh = get_dbf_head(fd)) == NULL) {
if ((dbh = get_dbf_head(fd)) == 0) {
fprintf(stderr, "Unable to get header\n");
return NULL;
}
+1 -1
View File
@@ -77,7 +77,7 @@ PHP_METHOD(domattr, __construct)
}
if (intern != NULL) {
oldnode = dom_object_get_node(intern);
oldnode = (xmlNodePtr)intern->ptr;
if (oldnode != NULL) {
php_libxml_node_free_resource(oldnode TSRMLS_CC);
}
+7 -15
View File
@@ -200,8 +200,7 @@ static void php_dom_iterator_move_forward(zend_object_iterator *iter TSRMLS_DC)
curobj = iterator->curobj;
intern = (dom_object *)zend_object_store_get_object(curobj TSRMLS_CC);
if (intern != NULL && intern->ptr != NULL) {
if (objmap->nodetype != XML_ENTITY_NODE &&
objmap->nodetype != XML_NOTATION_NODE) {
if (objmap->ht == NULL) {
if (objmap->nodetype == DOM_NODESET) {
nodeht = HASH_OF(objmap->baseobjptr);
zend_hash_move_forward(nodeht);
@@ -211,14 +210,12 @@ static void php_dom_iterator_move_forward(zend_object_iterator *iter TSRMLS_DC)
}
} else {
curnode = (xmlNodePtr)((php_libxml_node_ptr *)intern->ptr)->node;
if (objmap->nodetype == XML_ATTRIBUTE_NODE ||
objmap->nodetype == XML_ELEMENT_NODE) {
if (objmap->nodetype == XML_ATTRIBUTE_NODE || objmap->nodetype == XML_ELEMENT_NODE) {
curnode = curnode->next;
} else {
/* Nav the tree evey time as this is LIVE */
basenode = dom_object_get_node(objmap->baseobj);
if (basenode && (basenode->type == XML_DOCUMENT_NODE ||
basenode->type == XML_HTML_DOCUMENT_NODE)) {
if (basenode && (basenode->type == XML_DOCUMENT_NODE || basenode->type == XML_HTML_DOCUMENT_NODE)) {
basenode = xmlDocGetRootElement((xmlDoc *) basenode);
} else {
basenode = basenode->children;
@@ -228,9 +225,9 @@ static void php_dom_iterator_move_forward(zend_object_iterator *iter TSRMLS_DC)
}
} else {
if (objmap->nodetype == XML_ENTITY_NODE) {
curnode = php_dom_libxml_hash_iter(objmap->ht, iter->index - 1);
curnode = php_dom_libxml_hash_iter(objmap->ht, iter->index);
} else {
curnode = php_dom_libxml_notation_iter(objmap->ht, iter->index - 1);
curnode = php_dom_libxml_notation_iter(objmap->ht, iter->index);
}
}
}
@@ -272,8 +269,7 @@ zend_object_iterator *php_dom_get_iterator(zend_class_entry *ce, zval *object TS
intern = (dom_object *)zend_object_store_get_object(object TSRMLS_CC);
objmap = (dom_nnodemap_object *)intern->ptr;
if (objmap != NULL) {
if (objmap->nodetype != XML_ENTITY_NODE &&
objmap->nodetype != XML_NOTATION_NODE) {
if (objmap->ht == NULL) {
if (objmap->nodetype == DOM_NODESET) {
nodeht = HASH_OF(objmap->baseobjptr);
zend_hash_internal_pointer_reset(nodeht);
@@ -299,11 +295,7 @@ zend_object_iterator *php_dom_get_iterator(zend_class_entry *ce, zval *object TS
}
}
} else {
if (objmap->nodetype == XML_ENTITY_NODE) {
curnode = php_dom_libxml_hash_iter(objmap->ht, 0);
} else {
curnode = php_dom_libxml_notation_iter(objmap->ht, 0);
}
curnode = php_dom_libxml_hash_iter(objmap->ht, 0);
}
}
+2 -4
View File
@@ -92,7 +92,7 @@ PHP_METHOD(domimplementation, createDocumentType)
pch2 = systemid;
uri = xmlParseURI(name);
if (uri != NULL && uri->opaque != NULL) {
if (uri->opaque != NULL) {
localname = xmlStrdup(uri->opaque);
if (xmlStrchr(localname, (xmlChar) ':') != NULL) {
php_dom_throw_error(NAMESPACE_ERR, 1 TSRMLS_CC);
@@ -108,9 +108,7 @@ PHP_METHOD(domimplementation, createDocumentType)
php_dom_throw_error(INVALID_CHARACTER_ERR, TSRMLS_CC);
*/
if (uri) {
xmlFreeURI(uri);
}
xmlFreeURI(uri);
doctype = xmlCreateIntSubset(NULL, localname, pch1, pch2);
xmlFree(localname);
+1 -1
View File
@@ -128,7 +128,7 @@ PHP_METHOD(domelement, __construct)
intern = (dom_object *)zend_object_store_get_object(id TSRMLS_CC);
if (intern != NULL) {
oldnode = dom_object_get_node(intern);
oldnode = (xmlNodePtr)intern->ptr;
if (oldnode != NULL) {
php_libxml_node_free_resource(oldnode TSRMLS_CC);
}
+19 -35
View File
@@ -61,11 +61,8 @@ int dom_namednodemap_length_read(dom_object *obj, zval **retval TSRMLS_DC)
objmap = (dom_nnodemap_object *)obj->ptr;
if (objmap != NULL) {
if ((objmap->nodetype == XML_NOTATION_NODE) ||
objmap->nodetype == XML_ENTITY_NODE) {
if (objmap->ht) {
count = xmlHashSize(objmap->ht);
}
if (objmap->ht) {
count = xmlHashSize(objmap->ht);
} else {
nodep = dom_object_get_node(objmap->baseobj);
if (nodep) {
@@ -116,17 +113,12 @@ PHP_FUNCTION(dom_namednodemap_get_named_item)
objmap = (dom_nnodemap_object *)intern->ptr;
if (objmap != NULL) {
if ((objmap->nodetype == XML_NOTATION_NODE) ||
objmap->nodetype == XML_ENTITY_NODE) {
if (objmap->ht) {
if (objmap->nodetype == XML_ENTITY_NODE) {
itemnode = (xmlNodePtr)xmlHashLookup(objmap->ht, named);
} else {
notep = (xmlNotation *)xmlHashLookup(objmap->ht, named);
if (notep) {
itemnode = create_notation(notep->name, notep->PublicID, notep->SystemID);
}
}
if (objmap->ht) {
if (objmap->nodetype == XML_ENTITY_NODE) {
itemnode = (xmlNodePtr)xmlHashLookup(objmap->ht, named);
} else {
notep = (xmlNotation *)xmlHashLookup(objmap->ht, named);
itemnode = create_notation(notep->name, notep->PublicID, notep->SystemID);
}
} else {
nodep = dom_object_get_node(objmap->baseobj);
@@ -193,14 +185,11 @@ PHP_FUNCTION(dom_namednodemap_item)
objmap = (dom_nnodemap_object *)intern->ptr;
if (objmap != NULL) {
if ((objmap->nodetype == XML_NOTATION_NODE) ||
objmap->nodetype == XML_ENTITY_NODE) {
if (objmap->ht) {
if (objmap->nodetype == XML_ENTITY_NODE) {
itemnode = php_dom_libxml_hash_iter(objmap->ht, index);
} else {
itemnode = php_dom_libxml_notation_iter(objmap->ht, index);
}
if (objmap->ht) {
if (objmap->nodetype == XML_ENTITY_NODE) {
itemnode = php_dom_libxml_hash_iter(objmap->ht, index);
} else {
itemnode = php_dom_libxml_notation_iter(objmap->ht, index);
}
} else {
nodep = dom_object_get_node(objmap->baseobj);
@@ -252,17 +241,12 @@ PHP_FUNCTION(dom_namednodemap_get_named_item_ns)
objmap = (dom_nnodemap_object *)intern->ptr;
if (objmap != NULL) {
if ((objmap->nodetype == XML_NOTATION_NODE) ||
objmap->nodetype == XML_ENTITY_NODE) {
if (objmap->ht) {
if (objmap->nodetype == XML_ENTITY_NODE) {
itemnode = (xmlNodePtr)xmlHashLookup(objmap->ht, named);
} else {
notep = (xmlNotation *)xmlHashLookup(objmap->ht, named);
if (notep) {
itemnode = create_notation(notep->name, notep->PublicID, notep->SystemID);
}
}
if (objmap->ht) {
if (objmap->nodetype == XML_ENTITY_NODE) {
itemnode = (xmlNodePtr)xmlHashLookup(objmap->ht, named);
} else {
notep = (xmlNotation *)xmlHashLookup(objmap->ht, named);
itemnode = create_notation(notep->name, notep->PublicID, notep->SystemID);
}
} else {
nodep = dom_object_get_node(objmap->baseobj);
+1 -1
View File
@@ -840,10 +840,10 @@ int dom_node_text_content_read(dom_object *obj, zval **retval TSRMLS_DC)
if(str != NULL) {
ZVAL_STRING(*retval, str, 1);
xmlFree(str);
} else {
ZVAL_EMPTY_STRING(*retval);
}
xmlFree(str);
return SUCCESS;
}
+7 -7
View File
@@ -48,9 +48,9 @@ Since:
*/
int dom_notation_public_id_read(dom_object *obj, zval **retval TSRMLS_DC)
{
xmlEntityPtr nodep;
xmlNotationPtr nodep;
nodep = (xmlEntityPtr) dom_object_get_node(obj);
nodep = (xmlNotationPtr) dom_object_get_node(obj);
if (nodep == NULL) {
php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
@@ -58,8 +58,8 @@ int dom_notation_public_id_read(dom_object *obj, zval **retval TSRMLS_DC)
}
ALLOC_ZVAL(*retval);
if (nodep->ExternalID) {
ZVAL_STRING(*retval, (char *) (nodep->ExternalID), 1);
if (nodep->PublicID) {
ZVAL_STRING(*retval, (char *) (nodep->PublicID), 1);
} else {
ZVAL_EMPTY_STRING(*retval);
}
@@ -78,9 +78,9 @@ Since:
*/
int dom_notation_system_id_read(dom_object *obj, zval **retval TSRMLS_DC)
{
xmlEntityPtr nodep;
xmlNotationPtr nodep;
nodep = (xmlEntityPtr) dom_object_get_node(obj);
nodep = (xmlNotationPtr) dom_object_get_node(obj);
if (nodep == NULL) {
php_dom_throw_error(INVALID_STATE_ERR, 0 TSRMLS_CC);
@@ -89,7 +89,7 @@ int dom_notation_system_id_read(dom_object *obj, zval **retval TSRMLS_DC)
ALLOC_ZVAL(*retval);
if (nodep->SystemID) {
ZVAL_STRING(*retval, (char *) (nodep->SystemID), 1);
ZVAL_STRING(*retval, (char *) (nodep->PublicID), 1);
} else {
ZVAL_EMPTY_STRING(*retval);
}
+10 -6
View File
@@ -289,8 +289,6 @@ zval *dom_read_property(zval *object, zval *member, int type TSRMLS_DC)
if (obj->prop_handler != NULL) {
ret = zend_hash_find(obj->prop_handler, Z_STRVAL_P(member), Z_STRLEN_P(member)+1, (void **) &hnd);
} else if (instanceof_function(obj->std.ce, dom_node_class_entry TSRMLS_CC)) {
php_error(E_WARNING, "Couldn't fetch %s. Node no longer exists", obj->std.ce->name);
}
if (ret == SUCCESS) {
ret = hnd->read_func(obj, &retval TSRMLS_CC);
@@ -905,7 +903,8 @@ void dom_xpath_objects_free_storage(void *object TSRMLS_DC)
{
dom_object *intern = (dom_object *)object;
zend_object_std_dtor(&intern->std TSRMLS_CC);
zend_hash_destroy(intern->std.properties);
FREE_HASHTABLE(intern->std.properties);
if (intern->ptr != NULL) {
xmlXPathFreeContext((xmlXPathContextPtr) intern->ptr);
@@ -924,7 +923,8 @@ void dom_objects_free_storage(void *object TSRMLS_DC)
dom_object *intern = (dom_object *)object;
int retcount;
zend_object_std_dtor(&intern->std TSRMLS_CC);
zend_hash_destroy(intern->std.properties);
FREE_HASHTABLE(intern->std.properties);
if (intern->ptr != NULL && ((php_libxml_node_ptr *)intern->ptr)->node != NULL) {
if (((xmlNodePtr) ((php_libxml_node_ptr *)intern->ptr)->node)->type != XML_DOCUMENT_NODE && ((xmlNodePtr) ((php_libxml_node_ptr *)intern->ptr)->node)->type != XML_HTML_DOCUMENT_NODE) {
@@ -970,6 +970,8 @@ static dom_object* dom_objects_set_class(zend_class_entry *class_type, zend_bool
dom_object *intern;
intern = emalloc(sizeof(dom_object));
intern->std.ce = class_type;
intern->std.guards = NULL;
intern->ptr = NULL;
intern->prop_handler = NULL;
intern->document = NULL;
@@ -981,7 +983,8 @@ static dom_object* dom_objects_set_class(zend_class_entry *class_type, zend_bool
zend_hash_find(&classes, base_class->name, base_class->name_length + 1, (void **) &intern->prop_handler);
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
ALLOC_HASHTABLE(intern->std.properties);
zend_hash_init(intern->std.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
if (hash_copy) {
zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
}
@@ -1086,7 +1089,8 @@ void dom_nnodemap_objects_free_storage(void *object TSRMLS_DC)
php_libxml_decrement_doc_ref((php_libxml_node_object *)intern TSRMLS_CC);
zend_object_std_dtor(&intern->std TSRMLS_CC);
zend_hash_destroy(intern->std.properties);
FREE_HASHTABLE(intern->std.properties);
efree(object);
}
-25
View File
@@ -1,25 +0,0 @@
--TEST--
Bug # 37277 (cloning Dom Documents or Nodes does not work)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
$dom1 = new DomDocument('1.0', 'UTF-8');
$xml = '<foo />';
$dom1->loadXml($xml);
$node = clone $dom1->documentElement;
$dom2 = new DomDocument('1.0', 'UTF-8');
$dom2->appendChild($dom2->importNode($node->cloneNode(true), TRUE));
print $dom2->saveXML();
?>
--EXPECT--
<?xml version="1.0" encoding="UTF-8"?>
<foo/>
+1 -1
View File
@@ -355,7 +355,7 @@ PHPAPI char *php_reg_replace(const char *pattern, const char *replace, const cha
new_l = strlen(buf) + subs[0].rm_so; /* part before the match */
walk = replace;
while (*walk) {
if ('\\' == *walk && isdigit((unsigned char)walk[1]) && ((unsigned char)walk[1]) - '0' <= (int)re.re_nsub) {
if ('\\' == *walk && isdigit((unsigned char)walk[1]) && ((unsigned char)walk[1]) - '0' <= re.re_nsub) {
if (subs[walk[1] - '0'].rm_so > -1 && subs[walk[1] - '0'].rm_eo > -1) {
new_l += subs[walk[1] - '0'].rm_eo - subs[walk[1] - '0'].rm_so;
}
+1 -1
View File
@@ -1560,7 +1560,7 @@ static void exif_iif_add_value(image_info_type *image_info, int section_index, c
image_info_data *info_data;
image_info_data *list;
if (length < 0) {
if (length >= LONG_MAX) {
return;
}
+4 -4
View File
@@ -810,7 +810,7 @@ ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type,
if (resumepos > 0) {
if (resumepos > 2147483647) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "PHP cannot handle files greater than 2147483647 bytes.");
php_error_docref(NULL TSRMLS_CC, E_WARNING, "PHP cannot handle files greater then 2147483647 bytes.");
goto bail;
}
sprintf(arg, "%u", resumepos);
@@ -907,7 +907,7 @@ ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, i
if (startpos > 0) {
if (startpos > 2147483647) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "PHP cannot handle files with a size greater than 2147483647 bytes.");
php_error_docref(NULL TSRMLS_CC, E_WARNING, "PHP cannot handle files with a size greater then 2147483647 bytes.");
goto bail;
}
sprintf(arg, "%u", startpos);
@@ -1706,7 +1706,7 @@ ftp_nb_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t typ
* since php is 32 bit by design, we bail out with warning
*/
if (resumepos > 2147483647) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "PHP cannot handle files greater than 2147483648 bytes.");
php_error_docref(NULL TSRMLS_CC, E_WARNING, "PHP cannot handle files greater then 2147483648 bytes.");
goto bail;
}
sprintf(arg, "%u", resumepos);
@@ -1824,7 +1824,7 @@ ftp_nb_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type
}
if (startpos > 0) {
if (startpos > 2147483647) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "PHP cannot handle files with a size greater than 2147483647 bytes.");
php_error_docref(NULL TSRMLS_CC, E_WARNING, "PHP cannot handle files with a size greater then 2147483647 bytes.");
goto bail;
}
sprintf(arg, "%u", startpos);
+4 -67
View File
@@ -29,13 +29,7 @@
#include "config.h"
#endif
#ifdef HAVE_GD_PNG
/* needs to be first */
#include <png.h>
#endif
#include "php.h"
#include "php_ini.h"
#include "ext/standard/head.h"
#include <math.h>
#include "SAPI.h"
@@ -358,12 +352,6 @@ zend_module_entry gd_module_entry = {
ZEND_GET_MODULE(gd)
#endif
/* {{{ PHP_INI_BEGIN */
PHP_INI_BEGIN()
PHP_INI_ENTRY("gd.jpeg_ignore_warning", "0", PHP_INI_ALL, NULL)
PHP_INI_END()
/* }}} */
/* {{{ php_free_gd_image
*/
static void php_free_gd_image(zend_rsrc_list_entry *rsrc TSRMLS_DC)
@@ -412,8 +400,6 @@ PHP_MINIT_FUNCTION(gd)
le_ps_enc = zend_register_list_destructors_ex(php_free_ps_enc, NULL, "gd PS encoding", module_number);
#endif
REGISTER_INI_ENTRIES();
REGISTER_LONG_CONSTANT("IMG_GIF", 1, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("IMG_JPG", 2, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("IMG_JPEG", 2, CONST_CS | CONST_PERSISTENT);
@@ -465,22 +451,6 @@ PHP_MINIT_FUNCTION(gd)
#else
REGISTER_LONG_CONSTANT("GD_BUNDLED", 0, CONST_CS | CONST_PERSISTENT);
#endif
#ifdef HAVE_GD_PNG
/*
* cannot include #include "png.h"
* /usr/include/pngconf.h:310:2: error: #error png.h already includes setjmp.h with some additional fixup.
* as error, use the values for now...
*/
REGISTER_LONG_CONSTANT("PNG_NO_FILTER", 0x00, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PNG_FILTER_NONE", 0x08, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PNG_FILTER_SUB", 0x10, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PNG_FILTER_UP", 0x20, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PNG_FILTER_AVG", 0x40, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PNG_FILTER_PAETH", 0x80, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("PNG_ALL_FILTERS", 0x08 | 0x10 | 0x20 | 0x40 | 0x80, CONST_CS | CONST_PERSISTENT);
#endif
return SUCCESS;
}
/* }}} */
@@ -1094,7 +1064,6 @@ PHP_FUNCTION(imagesavealpha)
RETURN_TRUE;
}
/* }}} */
#endif
#if HAVE_GD_BUNDLED
@@ -1126,7 +1095,6 @@ PHP_FUNCTION(imagecolorallocatealpha)
zval *IM;
long red, green, blue, alpha;
gdImagePtr im;
int ct = (-1);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zllll", &IM, &red, &green, &blue, &alpha) == FAILURE) {
RETURN_FALSE;
@@ -1134,12 +1102,7 @@ PHP_FUNCTION(imagecolorallocatealpha)
ZEND_FETCH_RESOURCE(im, gdImagePtr, &IM, -1, "Image", le_gd);
ct = gdImageColorAllocateAlpha(im, red, green, blue, alpha);
if (ct < 0) {
RETURN_FALSE;
}
RETURN_LONG((long)ct);
RETURN_LONG(gdImageColorAllocateAlpha(im, red, green, blue, alpha));
}
/* }}} */
@@ -1550,8 +1513,6 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type,
php_stream *stream;
FILE * fp = NULL;
int argc=ZEND_NUM_ARGS();
long ignore_warning;
if ((image_type == PHP_GDIMG_TYPE_GD2PART && argc != 5) ||
(image_type != PHP_GDIMG_TYPE_GD2PART && argc != 1) ||
@@ -1632,18 +1593,6 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type,
im = gdImageCreateFromXpm(fn);
break;
#endif
#ifdef HAVE_GD_JPG
case PHP_GDIMG_TYPE_JPG:
ignore_warning = INI_INT("gd.jpeg_ignore_warning");
#ifdef HAVE_GD_BUNDLED
im = gdImageCreateFromJpeg(fp, ignore_warning);
#else
im = gdImageCreateFromJpeg(fp);
#endif
break;
#endif
default:
im = (*func_p)(fp);
break;
@@ -2011,7 +1960,6 @@ PHP_FUNCTION(imagecolorallocate)
{
zval **IM, **red, **green, **blue;
gdImagePtr im;
int ct = (-1);
if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &IM, &red, &green, &blue) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
@@ -2022,11 +1970,8 @@ PHP_FUNCTION(imagecolorallocate)
convert_to_long_ex(red);
convert_to_long_ex(green);
convert_to_long_ex(blue);
ct = gdImageColorAllocate(im, Z_LVAL_PP(red), Z_LVAL_PP(green), Z_LVAL_PP(blue));
if (ct < 0) {
RETURN_FALSE;
}
RETURN_LONG(ct);
RETURN_LONG(gdImageColorAllocate(im, Z_LVAL_PP(red), Z_LVAL_PP(green), Z_LVAL_PP(blue)));
}
/* }}} */
@@ -3246,8 +3191,6 @@ static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode, int
fontname = (unsigned char *) fontname;
#endif
PHP_GD_CHECK_OPEN_BASEDIR(fontname, "Invalid font filename");
#ifdef USE_GD_IMGSTRTTF
# if HAVE_GD_STRINGFTEX
if (extended) {
@@ -3865,8 +3808,7 @@ static void _php_image_convert(INTERNAL_FUNCTION_PARAMETERS, int image_type )
int int_threshold;
int x, y;
float x_ratio, y_ratio;
long ignore_warning;
if (argc != 5 || zend_get_parameters_ex(argc, &f_org, &f_dest, &height, &width, &threshold) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
}
@@ -3922,12 +3864,7 @@ static void _php_image_convert(INTERNAL_FUNCTION_PARAMETERS, int image_type )
#ifdef HAVE_GD_JPG
case PHP_GDIMG_TYPE_JPG:
ignore_warning = INI_INT("gd.jpeg_ignore_warning");
#ifdef HAVE_GD_BUNDLED
im_org = gdImageCreateFromJpeg(org, ignore_warning);
#else
im_org = gdImageCreateFromJpeg(org);
#endif
if (im_org == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to open '%s' Not a valid JPEG file", fn_dest);
RETURN_FALSE;
+4 -12
View File
@@ -49,13 +49,12 @@ static void _php_image_output_ctxfree(struct gdIOCtx *ctx)
/* {{{ _php_image_output_ctx */
static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type, char *tn, void (*func_p)())
{
zval **imgind, **file, **quality, **basefilter;
zval **imgind, **file, **quality;
gdImagePtr im;
char *fn = NULL;
FILE *fp = NULL;
int argc = ZEND_NUM_ARGS();
int q = -1, i;
int f = -1;
gdIOCtx *ctx;
/* The third (quality) parameter for Wbmp stands for the threshold when called from image2wbmp().
@@ -66,8 +65,7 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type,
if (argc < 2 && image_type == PHP_GDIMG_TYPE_XBM) {
WRONG_PARAM_COUNT;
}
if (argc < 1 || argc > 4 || zend_get_parameters_ex(argc, &imgind, &file, &quality, &basefilter) == FAILURE)
if (argc < 1 || argc > 3 || zend_get_parameters_ex(argc, &imgind, &file, &quality) == FAILURE)
{
WRONG_PARAM_COUNT;
}
@@ -77,13 +75,9 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type,
if (argc > 1) {
convert_to_string_ex(file);
fn = Z_STRVAL_PP(file);
if (argc >= 3) {
if (argc == 3) {
convert_to_long_ex(quality);
q = Z_LVAL_PP(quality);/* or colorindex for foreground of BW images (defaults to black) */
if (argc == 4) {
convert_to_long_ex(basefilter);
f = Z_LVAL_PP(basefilter);
}
}
}
@@ -121,10 +115,8 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type,
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid threshold value '%d'. It must be between 0 and 255", q);
}
case PHP_GDIMG_TYPE_JPG:
(*func_p)(im, ctx, q);
break;
case PHP_GDIMG_TYPE_PNG:
(*func_p)(im, ctx, q, f);
(*func_p)(im, ctx, q);
break;
case PHP_GDIMG_TYPE_XBM:
case PHP_GDIMG_TYPE_WBM:
+5 -5
View File
@@ -237,8 +237,8 @@ gdImagePtr gdImageCreateFromPng(FILE *fd);
gdImagePtr gdImageCreateFromPngCtx(gdIOCtxPtr in);
gdImagePtr gdImageCreateFromWBMP(FILE *inFile);
gdImagePtr gdImageCreateFromWBMPCtx(gdIOCtx *infile);
gdImagePtr gdImageCreateFromJpeg(FILE *infile, int ignore_warning);
gdImagePtr gdImageCreateFromJpegCtx(gdIOCtx *infile, int ignore_warning);
gdImagePtr gdImageCreateFromJpeg(FILE *infile);
gdImagePtr gdImageCreateFromJpegCtx(gdIOCtx *infile);
/* A custom data source. */
/* The source function must return -1 on error, otherwise the number
@@ -444,8 +444,8 @@ void gdImageGifCtx(gdImagePtr im, gdIOCtx *out);
* compression (smallest files) but takes a long time to compress, and
* -1 selects the default compiled into the zlib library.
*/
void gdImagePngEx(gdImagePtr im, FILE * out, int level, int basefilter);
void gdImagePngCtxEx(gdImagePtr im, gdIOCtx * out, int level, int basefilter);
void gdImagePngEx(gdImagePtr im, FILE * out, int level);
void gdImagePngCtxEx(gdImagePtr im, gdIOCtx * out, int level);
void gdImageWBMP(gdImagePtr image, int fg, FILE *out);
void gdImageWBMPCtx(gdImagePtr image, int fg, gdIOCtx *out);
@@ -489,7 +489,7 @@ void* gdImagePngPtr(gdImagePtr im, int *size);
/* Best to free this memory with gdFree(), not free() */
void* gdImageGdPtr(gdImagePtr im, int *size);
void *gdImagePngPtrEx(gdImagePtr im, int *size, int level, int basefilter);
void *gdImagePngPtrEx(gdImagePtr im, int *size, int level);
/* Best to free this memory with gdFree(), not free() */
void* gdImageGd2Ptr(gdImagePtr im, int cs, int fmt, int *size);
+1 -1
View File
@@ -133,7 +133,7 @@ void gdImageGifCtx(gdImagePtr im, gdIOCtxPtr out)
BitsPerPixel = colorstobpp(tim->colorsTotal);
/* All set, let's do it. */
GIFEncode(
out, tim->sx, tim->sy, tim->interlace, 0, tim->transparent, BitsPerPixel,
out, tim->sx, tim->sy, interlace, 0, transparent, BitsPerPixel,
tim->red, tim->green, tim->blue, tim);
if (pim) {
/* Destroy palette based temporary image. */
+10 -52
View File
@@ -43,44 +43,8 @@ static const char *const GD_JPEG_VERSION = "1.0";
typedef struct _jmpbuf_wrapper
{
jmp_buf jmpbuf;
int ignore_warning;
} jmpbuf_wrapper;
static long php_jpeg_emit_message(j_common_ptr jpeg_info, int level)
{
char message[JMSG_LENGTH_MAX];
jmpbuf_wrapper *jmpbufw;
int ignore_warning = 0;
jmpbufw = (jmpbuf_wrapper *) jpeg_info->client_data;
if (jmpbufw != 0) {
ignore_warning = jmpbufw->ignore_warning;
}
(jpeg_info->err->format_message)(jpeg_info,message);
/* It is a warning message */
if (level < 0) {
/* display only the 1st warning, as would do a default libjpeg
* unless strace_level >= 3
*/
if ((jpeg_info->err->num_warnings == 0) || (jpeg_info->err->trace_level >= 3)) {
php_gd_error_ex(ignore_warning ? E_NOTICE : E_WARNING, "gd-jpeg, libjpeg: recoverable error: %s\n", message);
}
jpeg_info->err->num_warnings++;
} else {
/* strace msg, Show it if trace_level >= level. */
if (jpeg_info->err->trace_level >= level) {
php_gd_error_ex(E_NOTICE, "gd-jpeg, libjpeg: strace message: %s\n", message);
}
}
return 1;
}
/* Called by the IJG JPEG library upon encountering a fatal error */
static void fatal_jpeg_error (j_common_ptr cinfo)
{
@@ -243,21 +207,21 @@ void gdImageJpegCtx (gdImagePtr im, gdIOCtx * outfile, int quality)
gdFree (row);
}
gdImagePtr gdImageCreateFromJpeg (FILE * inFile, int ignore_warning)
gdImagePtr gdImageCreateFromJpeg (FILE * inFile)
{
gdImagePtr im;
gdIOCtx *in = gdNewFileCtx(inFile);
im = gdImageCreateFromJpegCtx(in, ignore_warning);
im = gdImageCreateFromJpegCtx(in);
in->gd_free (in);
return im;
}
gdImagePtr gdImageCreateFromJpegPtr (int size, void *data, int ignore_warning)
gdImagePtr gdImageCreateFromJpegPtr (int size, void *data)
{
gdImagePtr im;
gdIOCtx *in = gdNewDynamicCtxEx(size, data, 0);
im = gdImageCreateFromJpegCtx(in, ignore_warning);
im = gdImageCreateFromJpegCtx(in);
in->gd_free(in);
return im;
@@ -267,12 +231,11 @@ void jpeg_gdIOCtx_src (j_decompress_ptr cinfo, gdIOCtx * infile);
static int CMYKToRGB(int c, int m, int y, int k, int inverted);
/*
* Create a gd-format image from the JPEG-format INFILE. Returns the
* image, or NULL upon error.
*/
gdImagePtr gdImageCreateFromJpegCtx (gdIOCtx * infile, int ignore_warning)
gdImagePtr gdImageCreateFromJpegCtx (gdIOCtx * infile)
{
struct jpeg_decompress_struct cinfo;
struct jpeg_error_mgr jerr;
@@ -290,13 +253,8 @@ gdImagePtr gdImageCreateFromJpegCtx (gdIOCtx * infile, int ignore_warning)
memset (&cinfo, 0, sizeof (cinfo));
memset (&jerr, 0, sizeof (jerr));
jmpbufw.ignore_warning = ignore_warning;
cinfo.err = jpeg_std_error (&jerr);
cinfo.client_data = &jmpbufw;
cinfo.err->emit_message = (void (*)(j_common_ptr,int)) php_jpeg_emit_message;
if (setjmp (jmpbufw.jmpbuf) != 0) {
/* we're here courtesy of longjmp */
if (row) {
@@ -428,12 +386,12 @@ gdImagePtr gdImageCreateFromJpegCtx (gdIOCtx * infile, int ignore_warning)
if (jpeg_finish_decompress (&cinfo) != TRUE) {
php_gd_error("gd-jpeg: warning: jpeg_finish_decompress reports suspended data source");
}
if (!ignore_warning) {
if (cinfo.err->num_warnings > 0) {
goto error;
}
/* Thanks to Truxton Fulton */
if (cinfo.err->num_warnings > 0) {
goto error;
}
jpeg_destroy_decompress (&cinfo);
gdFree (row);
+9 -12
View File
@@ -384,17 +384,17 @@ gdImagePtr gdImageCreateFromPngCtx (gdIOCtx * infile)
return im;
}
void gdImagePngEx (gdImagePtr im, FILE * outFile, int level, int basefilter)
void gdImagePngEx (gdImagePtr im, FILE * outFile, int level)
{
gdIOCtx *out = gdNewFileCtx(outFile);
gdImagePngCtxEx(im, out, level, basefilter);
gdImagePngCtxEx(im, out, level);
out->gd_free(out);
}
void gdImagePng (gdImagePtr im, FILE * outFile)
{
gdIOCtx *out = gdNewFileCtx(outFile);
gdImagePngCtxEx(im, out, -1, -1);
gdImagePngCtxEx(im, out, -1);
out->gd_free(out);
}
@@ -402,18 +402,18 @@ void * gdImagePngPtr (gdImagePtr im, int *size)
{
void *rv;
gdIOCtx *out = gdNewDynamicCtx(2048, NULL);
gdImagePngCtxEx(im, out, -1, -1);
gdImagePngCtxEx(im, out, -1);
rv = gdDPExtractData(out, size);
out->gd_free(out);
return rv;
}
void * gdImagePngPtrEx (gdImagePtr im, int *size, int level, int basefilter)
void * gdImagePngPtrEx (gdImagePtr im, int *size, int level)
{
void *rv;
gdIOCtx *out = gdNewDynamicCtx(2048, NULL);
gdImagePngCtxEx(im, out, level, basefilter);
gdImagePngCtxEx(im, out, level);
rv = gdDPExtractData(out, size);
out->gd_free(out);
return rv;
@@ -421,14 +421,14 @@ void * gdImagePngPtrEx (gdImagePtr im, int *size, int level, int basefilter)
void gdImagePngCtx (gdImagePtr im, gdIOCtx * outfile)
{
gdImagePngCtxEx(im, outfile, -1, -1);
gdImagePngCtxEx(im, outfile, -1);
}
/* This routine is based in part on code from Dale Lutz (Safe Software Inc.)
* and in part on demo code from Chapter 15 of "PNG: The Definitive Guide"
* (http://www.cdrom.com/pub/png/pngbook.html).
*/
void gdImagePngCtxEx (gdImagePtr im, gdIOCtx * outfile, int level, int basefilter)
void gdImagePngCtxEx (gdImagePtr im, gdIOCtx * outfile, int level)
{
int i, j, bit_depth = 0, interlace_type;
int width = im->sx;
@@ -484,10 +484,7 @@ void gdImagePngCtxEx (gdImagePtr im, gdIOCtx * outfile, int level, int basefilte
/* 2.0.12: this is finally a parameter */
png_set_compression_level(png_ptr, level);
if (basefilter >= 0) {
png_set_filter(png_ptr, PNG_FILTER_TYPE_BASE, basefilter);
}
/* can set this to a smaller value without compromising compression if all
* image data is 16K or less; will save some decoder memory [min == 8]
*/
+1 -1
View File
@@ -5,7 +5,7 @@ ARG_WITH("gettext", "gettext support", "no");
if (PHP_GETTEXT != "no") {
if (CHECK_LIB("libintl.lib", "gettext", PHP_GETTEXT) && CHECK_HEADER_ADD_INCLUDE("libintl.h", "CFLAGS_GETTEXT")) {
EXTENSION("gettext", "gettext.c", PHP_GETTEXT_SHARED, "-DHAVE_BIND_TEXTDOMAIN_CODESET=1 -DHAVE_DNGETTEXT=1 -DHAVE_NGETTEXT=1 -DHAVE_LIBINTL=1 -DHAVE_DCNGETTEXT=1");
EXTENSION("gettext", "gettext.c", PHP_GETTEXT_SHARED, "-DHAVE_BIND_TEXTDOMAIN_CODESET=1 -DHAVE_DNGETTEXT=1 -DHAVE_NGETTEXT=1 -DHAVE_LIBINTL=1");
} else {
WARNING("gettext not enabled; libraries and headers not found");
}
-2
View File
@@ -7,8 +7,6 @@ PHP_ARG_ENABLE(hash, whether to enable hash support,
if test "$PHP_HASH" != "no"; then
AC_DEFINE(HAVE_HASH_EXT,1,[Have HASH Extension])
PHP_C_BIGENDIAN
AC_CHECK_SIZEOF(short, 2)
AC_CHECK_SIZEOF(int, 4)
AC_CHECK_SIZEOF(long, 4)
+1 -1
View File
@@ -1,7 +1,7 @@
// $Id$
// vim:ft=javascript
ARG_ENABLE("hash", "enable hash support", "yes");
ARG_ENABLE("hash", "enable hash support", "no");
if (PHP_HASH != "no") {
AC_DEFINE('HAVE_HASH_EXT', 1);
+1 -3
View File
@@ -29,10 +29,8 @@ PHP_HASH_API void PHP_ADLER32Init(PHP_ADLER32_CTX *context)
PHP_HASH_API void PHP_ADLER32Update(PHP_ADLER32_CTX *context, const unsigned char *input, size_t len)
{
php_hash_uint32 i, s[2];
php_hash_uint32 i, s[2] = { context->state & 0xffff, (context->state >> 16) & 0xffff };
s[0] = context->state & 0xffff;
s[1] = (context->state >> 16) & 0xffff;
for (i = 0; i < len; ++i) {
s[0] = (s[0] + input[i]) % 65521;
s[1] = (s[1] + s[0]) % 65521;
+7 -36
View File
@@ -88,24 +88,6 @@
} \
feedforward
#define split_ex(str) \
x0=str[0]; x1=str[1]; x2=str[2]; x3=str[3]; \
x4=str[4]; x5=str[5]; x6=str[6]; x7=str[7];
#ifdef WORDS_BIGENDIAN
# define split(str) \
{ \
int i; \
php_hash_uint64 tmp[8]; \
\
for (i = 0; i < 64; ++i) { \
((unsigned char *) tmp)[i^7] = ((unsigned char *) str)[i]; \
} \
split_ex(tmp); \
}
#else
# define split split_ex
#endif
#define tiger_compress(passes, str, state) \
{ \
register php_hash_uint64 a, b, c, tmpa, x0, x1, x2, x3, x4, x5, x6, x7; \
@@ -116,7 +98,8 @@
b = state[1]; \
c = state[2]; \
\
split(str); \
x0=str[0]; x1=str[1]; x2=str[2]; x3=str[3]; \
x4=str[4]; x5=str[5]; x6=str[6]; x7=str[7]; \
\
compress(passes); \
\
@@ -135,7 +118,7 @@ static inline void TigerFinalize(PHP_TIGER_CTX *context)
memset(&context->buffer[context->length], 0, 8-context->length%8);
context->length += 8-context->length%8;
}
if (context->length > 56) {
memset(&context->buffer[context->length], 0, 64 - context->length);
tiger_compress(context->passes, ((php_hash_uint64 *) context->buffer), context->state);
@@ -143,19 +126,8 @@ static inline void TigerFinalize(PHP_TIGER_CTX *context)
} else {
memset(&context->buffer[context->length], 0, 56 - context->length);
}
#ifndef WORDS_BIGENDIAN
memcpy(&context->buffer[56], &context->passed, sizeof(php_hash_uint64));
#else
context->buffer[56] = (unsigned char) (context->passed & 0xff);
context->buffer[57] = (unsigned char) ((context->passed >> 8) & 0xff);
context->buffer[58] = (unsigned char) ((context->passed >> 16) & 0xff);
context->buffer[59] = (unsigned char) ((context->passed >> 24) & 0xff);
context->buffer[60] = (unsigned char) ((context->passed >> 32) & 0xff);
context->buffer[61] = (unsigned char) ((context->passed >> 40) & 0xff);
context->buffer[62] = (unsigned char) ((context->passed >> 48) & 0xff);
context->buffer[63] = (unsigned char) ((context->passed >> 56) & 0xff);
#endif
tiger_compress(context->passes, ((php_hash_uint64 *) context->buffer), context->state);
}
@@ -193,12 +165,11 @@ PHP_HASH_API void PHP_TIGERUpdate(PHP_TIGER_CTX *context, const unsigned char *i
}
for (; i + 64 <= len; i += 64) {
memcpy(context->buffer, &input[i], 64);
tiger_compress(context->passes, ((const php_hash_uint64 *) context->buffer), context->state);
tiger_compress(context->passes, ((const php_hash_uint64 *) (input + i)), context->state);
context->passed += 512;
}
memset(&context->buffer[r], 0, 64-r);
memcpy(context->buffer, &input[i], r);
memcpy(context->buffer, input + i, r);
context->length = r;
}
}
+1 -1
View File
@@ -122,7 +122,7 @@ PHP_HASH_API void php_hash_register_algo(const char *algo, php_hash_ops *ops);
static inline void php_hash_bin2hex(char *out, const unsigned char *in, int in_len)
{
static const char hexits[17] = "0123456789abcdef";
static const char hexits[16] = "0123456789abcdef";
int i;
for(i = 0; i < in_len; i++) {
-4
View File
@@ -23,10 +23,6 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
#else
#ifndef PHP_WIN32
#include "php_config.h"
#endif
#endif
#ifndef PHP_WIN32
+19 -17
View File
@@ -583,7 +583,7 @@ static php_iconv_err_t _php_iconv_substr(smart_str *pretval,
size_t out_left;
unsigned int cnt;
int total_len;
unsigned int total_len;
err = _php_iconv_strlen(&total_len, str, nbytes, enc);
if (err != PHP_ICONV_ERR_SUCCESS) {
@@ -822,16 +822,18 @@ static php_iconv_err_t _php_iconv_strpos(unsigned int *pretval,
j += GENERIC_SUPERSET_NBYTES;
}
if (_php_iconv_memequal(buf, &ndl_buf[i], sizeof(buf))) {
if (!_php_iconv_memequal(buf, &ndl_buf[i], sizeof(buf))) {
i = 0;
}
if (i == 0) {
match_ofs = (unsigned int)-1;
} else {
match_ofs += (lim - i) / GENERIC_SUPERSET_NBYTES;
i += GENERIC_SUPERSET_NBYTES;
ndl_buf_p = &ndl_buf[i];
ndl_buf_left = ndl_buf_len - i;
} else {
match_ofs = (unsigned int)-1;
ndl_buf_p = ndl_buf;
ndl_buf_left = ndl_buf_len;
}
ndl_buf_p = &ndl_buf[i];
ndl_buf_left = ndl_buf_len - i;
}
}
} else {
@@ -865,16 +867,18 @@ static php_iconv_err_t _php_iconv_strpos(unsigned int *pretval,
j += GENERIC_SUPERSET_NBYTES;
}
if (_php_iconv_memequal(buf, &ndl_buf[i], sizeof(buf))) {
if (!_php_iconv_memequal(buf, &ndl_buf[i], sizeof(buf))) {
i = 0;
}
if (i == 0) {
match_ofs = (unsigned int)-1;
} else {
match_ofs += (lim - i) / GENERIC_SUPERSET_NBYTES;
i += GENERIC_SUPERSET_NBYTES;
ndl_buf_p = &ndl_buf[i];
ndl_buf_left = ndl_buf_len - i;
} else {
match_ofs = (unsigned int)-1;
ndl_buf_p = ndl_buf;
ndl_buf_left = ndl_buf_len;
}
ndl_buf_p = &ndl_buf[i];
ndl_buf_left = ndl_buf_len - i;
}
}
}
@@ -1391,13 +1395,11 @@ static php_iconv_err_t _php_iconv_mime_decode(smart_str *pretval, const char *st
case 3: /* expecting a encoding scheme specifier */
switch (*p1) {
case 'b':
case 'B':
enc_scheme = PHP_ICONV_ENC_SCHEME_BASE64;
scan_stat = 4;
break;
case 'q':
case 'Q':
enc_scheme = PHP_ICONV_ENC_SCHEME_QPRINT;
scan_stat = 4;
+1 -1
View File
@@ -93,7 +93,7 @@ typedef enum _php_iconv_err_t {
} php_iconv_err_t;
/* }}} */
PHP_ICONV_API php_iconv_err_t php_iconv_string(const char * in_p, size_t in_len, char **out, size_t *out_len, const char *out_charset, const char *in_charset);
PHP_ICONV_API php_iconv_err_t php_iconv_string(const char * in_p, size_t in_len, char **out, size_t *out_len, const char *in_charset, const char *out_charset);
#else
-10
View File
@@ -1,10 +0,0 @@
--TEST--
Bug #37176 (iconv_strpos() fails to find a string)
--FILE--
<?php
var_dump(iconv_strpos('11--','1-',0,'UTF-8'));
var_dump(iconv_strpos('-11--','1-',0,'UTF-8'));
?>
--EXPECT--
int(1)
int(2)
-107
View File
@@ -36,7 +36,6 @@
#include "php.h"
#include "php_ini.h"
#include "php_streams.h"
#include "ext/standard/php_string.h"
#include "ext/standard/info.h"
#include "ext/standard/file.h"
@@ -68,9 +67,6 @@ static void _php_imap_add_body(zval *arg, BODY *body TSRMLS_DC);
static void _php_imap_parse_address(ADDRESS *addresslist, char **fulladdress, zval *paddress TSRMLS_DC);
static int _php_imap_address_size(ADDRESS *addresslist);
/* the gets we use */
static char *php_mail_gets(readfn_t f, void *stream, unsigned long size, GETS_DATA *md);
/* These function declarations are missing from the IMAP header files... */
void rfc822_date(char *date);
char *cpystr(const char *str);
@@ -97,7 +93,6 @@ zend_function_entry imap_functions[] = {
PHP_FE(imap_body, NULL)
PHP_FE(imap_bodystruct, NULL)
PHP_FE(imap_fetchbody, NULL)
PHP_FE(imap_savebody, NULL)
PHP_FE(imap_fetchheader, NULL)
PHP_FE(imap_fetchstructure, NULL)
PHP_FE(imap_expunge, NULL)
@@ -423,7 +418,6 @@ static void php_imap_init_globals(zend_imap_globals *imap_globals)
imap_globals->quota_return = NIL;
imap_globals->imap_acl_list = NIL;
#endif
imap_globals->gets_stream = NIL;
}
/* }}} */
@@ -466,9 +460,6 @@ PHP_MINIT_FUNCTION(imap)
/* lets allow NIL */
REGISTER_LONG_CONSTANT("NIL", NIL, CONST_PERSISTENT | CONST_CS);
/* plug in our gets */
mail_parameters(NIL, SET_GETS, (void *) php_mail_gets);
/* set default timeout values */
mail_parameters(NIL, SET_OPENTIMEOUT, (void *) FG(default_socket_timeout));
mail_parameters(NIL, SET_READTIMEOUT, (void *) FG(default_socket_timeout));
@@ -659,7 +650,6 @@ PHP_RINIT_FUNCTION(imap)
{
IMAPG(imap_errorstack) = NIL;
IMAPG(imap_alertstack) = NIL;
IMAPG(gets_stream) = NIL;
return SUCCESS;
}
/* }}} */
@@ -1855,57 +1845,6 @@ PHP_FUNCTION(imap_fetchbody)
/* }}} */
/* {{{ proto bool imap_savebody(resource stream_id, string|resource file, int msg_no[, string section = ""[, int options = 0]])
Save a specific body section to a file */
PHP_FUNCTION(imap_savebody)
{
zval *stream, *out;
pils *imap_ptr = NULL;
php_stream *writer = NULL;
char *section = "";
int section_len = 0, close_stream = 1;
long msgno, flags = 0;
if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rzl|sl", &stream, &out, &msgno, &section, &section_len, &flags)) {
RETURN_FALSE;
}
ZEND_FETCH_RESOURCE(imap_ptr, pils *, &stream, -1, "imap", le_imap);
if (!imap_ptr) {
RETURN_FALSE;
}
switch (Z_TYPE_P(out))
{
case IS_LONG:
case IS_RESOURCE:
close_stream = 0;
php_stream_from_zval(writer, &out);
break;
default:
convert_to_string_ex(&out);
writer = php_stream_open_wrapper(Z_STRVAL_P(out), "wb", REPORT_ERRORS|ENFORCE_SAFE_MODE, NULL);
break;
}
if (!writer) {
RETURN_FALSE;
}
IMAPG(gets_stream) = writer;
mail_fetchbody_full(imap_ptr->imap_stream, msgno, section, NULL, flags);
IMAPG(gets_stream) = NULL;
if (close_stream) {
php_stream_close(writer);
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto string imap_base64(string text)
Decode BASE64 encoded text */
PHP_FUNCTION(imap_base64)
@@ -4208,52 +4147,6 @@ PHP_FUNCTION(imap_timeout)
}
/* }}} */
#define GETS_FETCH_SIZE 8196LU
/* {{{ php_mail_gets */
static char *php_mail_gets(readfn_t f, void *stream, unsigned long size, GETS_DATA *md)
{
TSRMLS_FETCH();
/* write to the gets stream if it is set,
otherwise forward to c-clients gets */
if (IMAPG(gets_stream)) {
char buf[GETS_FETCH_SIZE];
while (size) {
unsigned long read;
if (size > GETS_FETCH_SIZE) {
read = GETS_FETCH_SIZE;
size -=GETS_FETCH_SIZE;
} else {
read = size;
size = 0;
}
if (!f(stream, read, buf)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to read from socket");
break;
} else if (read != php_stream_write(IMAPG(gets_stream), buf, read)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to write to stream");
break;
}
}
return NULL;
} else {
char *buf = malloc(size + 1);
if (f(stream, size, buf)) {
buf[size] = '\0';
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to read from socket");
free(buf);
buf = NULL;
}
return buf;
}
}
/* }}} */
/* {{{ Interfaces to C-client
*/
void mm_searched(MAILSTREAM *stream, unsigned long number)
-3
View File
@@ -114,7 +114,6 @@ PHP_FUNCTION(imap_rfc822_parse_headers);
PHP_FUNCTION(imap_body);
PHP_FUNCTION(imap_fetchstructure);
PHP_FUNCTION(imap_fetchbody);
PHP_FUNCTION(imap_savebody);
PHP_FUNCTION(imap_expunge);
PHP_FUNCTION(imap_delete);
PHP_FUNCTION(imap_undelete);
@@ -206,8 +205,6 @@ ZEND_BEGIN_MODULE_GLOBALS(imap)
zval **quota_return;
zval *imap_acl_list;
#endif
/* php_stream for php_mail_gets() */
php_stream *gets_stream;
ZEND_END_MODULE_GLOBALS(imap)
#ifdef ZTS
-3
View File
@@ -3948,7 +3948,6 @@ static long php_intifx_create_char(char* param, long len, HashTable *list TSRMLS
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't create char-resource");
return -1;
}
memset(Ifx_char, 0, sizeof(IFX_IDRES));
Ifx_char->type = TYPE_CHAR;
@@ -4233,7 +4232,6 @@ static long php_intifxus_create_slob(long create_mode, HashTable *list TSRMLS_DC
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't create slob-resource");
return -1;
}
memset(Ifx_slob, 0, sizeof(IFX_IDRES));
errcode = ifx_lo_def_create_spec(&(Ifx_slob->SLOB.createspec));
if (errcode < 0) {
@@ -4476,7 +4474,6 @@ static long php_intifxus_new_slob(HashTable *list TSRMLS_DC)
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't create slob-resource");
return -1;
}
memset(Ifx_slob, 0, sizeof(IFX_IDRES));
Ifx_slob->type = TYPE_SLOB;
Ifx_slob->SLOB.lofd = -1;
+1 -1
View File
@@ -293,7 +293,7 @@ if test "$PHP_MBSTRING" != "no"; then
dnl libmbfl is required
PHP_MBSTRING_SETUP_LIBMBFL
PHP_MBSTRING_EXTENSION
PHP_INSTALL_HEADERS([ext/mbstring], [libmbfl/ libmbfl/mbfl])
PHP_INSTALL_HEADERS([ext/mbstring], [libmbfl libmbfl/mbfl])
fi
# vim600: sts=2 sw=2 et
-18
View File
@@ -331,24 +331,6 @@ mbfl_buffer_converter_feed_result(mbfl_buffer_converter *convd, mbfl_string *str
return mbfl_memory_device_result(&convd->device, result);
}
int mbfl_buffer_illegalchars(mbfl_buffer_converter *convd)
{
int num_illegalchars = 0;
if (convd == NULL) {
return 0;
}
if (convd->filter1 != NULL) {
num_illegalchars += convd->filter1->num_illegalchar;
}
if (convd->filter2 != NULL) {
num_illegalchars += convd->filter2->num_illegalchar;
}
return (num_illegalchars);
}
/*
* encoding detector
Loaded 100 of 484 files, more files were not shown because too many files have changed in this diff. Show more