mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Merge remote-tracking branch 'origin/master' into native-tls
* origin/master: (398 commits) NEWS add test for bug #68381 Fixed bug #68381 Set FPM log level earlier during init proper dllexport move to size_t where zend_string is used internally fix some datatype mismatches return after the warning, to fix uninitialized salt usage fix datatype mismatches add missing type specifier fix datatype mismatches fix unsigned check "extern" shouldn't be used for definitions joined identical conditional blocks simplify fpm tests SEND_VAR_NO_REF optimization Add test for bug #68442 Add various tests for FPM - covering recent bugs (68420, 68421, 68423, 68428) - for UDS - for ping and status URI - for multi pool and multi mode Include small MIT FastCGI client library from https://github.com/adoy/PHP-FastCGI-Client Get rid of zend_free_op structure (use zval* instead). Get rid of useless TSRMLS arguments. Add new FPM test for IPv4/IPv6 ... Conflicts: win32/build/config.w32
This commit is contained in:
commit
c6bad96f30
221 changed files with 12476 additions and 8347 deletions
|
@ -46,5 +46,5 @@ before_script:
|
||||||
|
|
||||||
# Run PHPs run-tests.php
|
# Run PHPs run-tests.php
|
||||||
script:
|
script:
|
||||||
- ./sapi/cli/php run-tests.php -p `pwd`/sapi/cli/php -g "FAIL,XFAIL,BORK,WARN,LEAK,SKIP" --show-diff --set-timeout 120
|
- ./sapi/cli/php run-tests.php -p `pwd`/sapi/cli/php -g "FAIL,XFAIL,BORK,WARN,LEAK,SKIP" --show-diff --set-timeout 120 -s
|
||||||
- ./sapi/cli/php sapi/phpdbg/tests/run-tests.php -diff2stdout --phpdbg sapi/phpdbg/phpdbg
|
- ./sapi/cli/php sapi/phpdbg/tests/run-tests.php -diff2stdout --phpdbg sapi/phpdbg/phpdbg
|
||||||
|
|
48
NEWS
48
NEWS
|
@ -2,31 +2,52 @@ PHP NEWS
|
||||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||
?? ??? 20??, PHP 7.0.0
|
?? ??? 20??, PHP 7.0.0
|
||||||
|
|
||||||
-Fileinfo:
|
|
||||||
. Fixed bug #66242 (libmagic: don't assume char is signed). (ArdB)
|
|
||||||
|
|
||||||
- CLI server:
|
- CLI server:
|
||||||
. Refactor MIME type handling to use a hash table instead of linear search.
|
. Refactor MIME type handling to use a hash table instead of linear search.
|
||||||
(Adam)
|
(Adam)
|
||||||
. Update the MIME type list from the one shipped by Apache HTTPD. (Adam)
|
. Update the MIME type list from the one shipped by Apache HTTPD. (Adam)
|
||||||
|
|
||||||
- Core:
|
- Core:
|
||||||
|
. Fixed bug #68104 (Segfault while pre-evaluating a disabled function).
|
||||||
|
(Laruence)
|
||||||
|
. Fixed bug #68252 (segfault in Zend/zend_hash.c in function
|
||||||
|
_zend_hash_del_el). (Laruence)
|
||||||
. Added PHP_INT_MIN constant. (Andrea)
|
. Added PHP_INT_MIN constant. (Andrea)
|
||||||
. Added Closure::apply() method. (Andrea)
|
. Added Closure::call() method. (Andrea)
|
||||||
. Implemented FR #38409 (parse_ini_file() looses the type of booleans). (Tjerk)
|
. Implemented FR #38409 (parse_ini_file() looses the type of booleans). (Tjerk)
|
||||||
. Fixed #67959 (Segfault when calling phpversion('spl')). (Florian)
|
. Fixed #67959 (Segfault when calling phpversion('spl')). (Florian)
|
||||||
. Implemented the RFC `Catchable "Call to a member function bar() on a
|
. Implemented the RFC `Catchable "Call to a member function bar() on a
|
||||||
non-object"` (Timm)
|
non-object"` (Timm)
|
||||||
|
|
||||||
- Reflection
|
|
||||||
. Fixed inheritance chain of Reflector interface (Tjerk)
|
|
||||||
|
|
||||||
- DBA:
|
- DBA:
|
||||||
. Fixed bug #62490 (dba_delete returns true on missing item (inifile)). (Mike)
|
. Fixed bug #62490 (dba_delete returns true on missing item (inifile)). (Mike)
|
||||||
|
|
||||||
|
- DOM:
|
||||||
|
. Made DOMNode::textContent writeable. (Tjerk)
|
||||||
|
|
||||||
|
- GD:
|
||||||
|
. Made fontFetch's path parser thread-safe. (Sara)
|
||||||
|
|
||||||
|
- Fileinfo:
|
||||||
|
. Fixed bug #66242 (libmagic: don't assume char is signed). (ArdB)
|
||||||
|
|
||||||
- FPM:
|
- FPM:
|
||||||
. Fixed bug #65933 (Cannot specify config lines longer than 1024 bytes). (Chris Wright)
|
. Fixed bug #65933 (Cannot specify config lines longer than 1024 bytes). (Chris Wright)
|
||||||
|
|
||||||
|
- Reflection
|
||||||
|
. Fixed inheritance chain of Reflector interface (Tjerk)
|
||||||
|
|
||||||
|
- Session:
|
||||||
|
. Fixed bug #67694 (Regression in session_regenerate_id()). (Tjerk)
|
||||||
|
|
||||||
|
- SOAP:
|
||||||
|
. Fixed bug #68361 (Segmentation fault on SoapClient::__getTypes).
|
||||||
|
(Laruence)
|
||||||
|
|
||||||
|
- SPL:
|
||||||
|
. Implemented #67886 (SplPriorityQueue/SplHeap doesn't expose extractFlags
|
||||||
|
nor curruption state). (Julien)
|
||||||
|
|
||||||
- Standard:
|
- Standard:
|
||||||
. Removed call_user_method() and call_user_method_array() functions. (Kalle)
|
. Removed call_user_method() and call_user_method_array() functions. (Kalle)
|
||||||
. Fix user session handlers (See rfc:session.user.return-value). (Sara)
|
. Fix user session handlers (See rfc:session.user.return-value). (Sara)
|
||||||
|
@ -36,17 +57,4 @@ PHP NEWS
|
||||||
- XSL:
|
- XSL:
|
||||||
. Fixed bug #64776 (The XSLT extension is not thread safe). (Mike)
|
. Fixed bug #64776 (The XSLT extension is not thread safe). (Mike)
|
||||||
|
|
||||||
- GD:
|
|
||||||
. Made fontFetch's path parser thread-safe. (Sara)
|
|
||||||
|
|
||||||
- Session:
|
|
||||||
. Fixed bug #67694 (Regression in session_regenerate_id()). (Tjerk)
|
|
||||||
|
|
||||||
- SPL:
|
|
||||||
. Implemented #67886 (SplPriorityQueue/SplHeap doesn't expose extractFlags
|
|
||||||
nor curruption state). (Julien)
|
|
||||||
|
|
||||||
- DOM:
|
|
||||||
. Made DOMNode::textContent writeable. (Tjerk)
|
|
||||||
|
|
||||||
<<< NOTE: Insert NEWS from last stable release here prior to actual release! >>>
|
<<< NOTE: Insert NEWS from last stable release here prior to actual release! >>>
|
||||||
|
|
|
@ -109,16 +109,18 @@ TSRM_API void tsrm_win32_shutdown(void)
|
||||||
char * tsrm_win32_get_path_sid_key(const char *pathname TSRMLS_DC)
|
char * tsrm_win32_get_path_sid_key(const char *pathname TSRMLS_DC)
|
||||||
{
|
{
|
||||||
PSID pSid = TWG(impersonation_token_sid);
|
PSID pSid = TWG(impersonation_token_sid);
|
||||||
DWORD sid_len = pSid ? GetLengthSid(pSid) : 0;
|
|
||||||
TCHAR *ptcSid = NULL;
|
TCHAR *ptcSid = NULL;
|
||||||
char *bucket_key = NULL;
|
char *bucket_key = NULL;
|
||||||
|
size_t ptc_sid_len, pathname_len;
|
||||||
|
|
||||||
|
pathname_len = strlen(pathname);
|
||||||
|
|
||||||
if (!pSid) {
|
if (!pSid) {
|
||||||
bucket_key = (char *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, strlen(pathname) + 1);
|
bucket_key = (char *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, pathname_len + 1);
|
||||||
if (!bucket_key) {
|
if (!bucket_key) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
memcpy(bucket_key, pathname, strlen(pathname));
|
memcpy(bucket_key, pathname, pathname_len);
|
||||||
return bucket_key;
|
return bucket_key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,14 +128,16 @@ char * tsrm_win32_get_path_sid_key(const char *pathname TSRMLS_DC)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bucket_key = (char *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, strlen(pathname) + strlen(ptcSid) + 1);
|
|
||||||
|
ptc_sid_len = strlen(ptcSid);
|
||||||
|
bucket_key = (char *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, pathname_len + ptc_sid_len + 1);
|
||||||
if (!bucket_key) {
|
if (!bucket_key) {
|
||||||
LocalFree(ptcSid);
|
LocalFree(ptcSid);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(bucket_key, ptcSid, strlen(ptcSid));
|
memcpy(bucket_key, ptcSid, ptc_sid_len);
|
||||||
memcpy(bucket_key + strlen(ptcSid), pathname, strlen(pathname) + 1);
|
memcpy(bucket_key + ptc_sid_len, pathname, pathname_len + 1);
|
||||||
|
|
||||||
LocalFree(ptcSid);
|
LocalFree(ptcSid);
|
||||||
return bucket_key;
|
return bucket_key;
|
||||||
|
@ -142,11 +146,8 @@ char * tsrm_win32_get_path_sid_key(const char *pathname TSRMLS_DC)
|
||||||
|
|
||||||
PSID tsrm_win32_get_token_sid(HANDLE hToken)
|
PSID tsrm_win32_get_token_sid(HANDLE hToken)
|
||||||
{
|
{
|
||||||
BOOL bSuccess = FALSE;
|
|
||||||
DWORD dwLength = 0;
|
DWORD dwLength = 0;
|
||||||
PTOKEN_USER pTokenUser = NULL;
|
PTOKEN_USER pTokenUser = NULL;
|
||||||
PSID sid;
|
|
||||||
PSID *ppsid = &sid;
|
|
||||||
DWORD sid_len;
|
DWORD sid_len;
|
||||||
PSID pResultSid = NULL;
|
PSID pResultSid = NULL;
|
||||||
|
|
||||||
|
@ -207,7 +208,6 @@ TSRM_API int tsrm_win32_access(const char *pathname, int mode TSRMLS_DC)
|
||||||
BYTE * psec_desc = NULL;
|
BYTE * psec_desc = NULL;
|
||||||
BOOL fAccess = FALSE;
|
BOOL fAccess = FALSE;
|
||||||
|
|
||||||
BOOL bucket_key_alloc = FALSE;
|
|
||||||
realpath_cache_bucket * bucket = NULL;
|
realpath_cache_bucket * bucket = NULL;
|
||||||
char * real_path = NULL;
|
char * real_path = NULL;
|
||||||
|
|
||||||
|
@ -245,7 +245,6 @@ TSRM_API int tsrm_win32_access(const char *pathname, int mode TSRMLS_DC)
|
||||||
was impersonating already, this function uses that impersonation context.
|
was impersonating already, this function uses that impersonation context.
|
||||||
*/
|
*/
|
||||||
if(!OpenThreadToken(GetCurrentThread(), TOKEN_ALL_ACCESS, TRUE, &thread_token)) {
|
if(!OpenThreadToken(GetCurrentThread(), TOKEN_ALL_ACCESS, TRUE, &thread_token)) {
|
||||||
DWORD err = GetLastError();
|
|
||||||
if (GetLastError() == ERROR_NO_TOKEN) {
|
if (GetLastError() == ERROR_NO_TOKEN) {
|
||||||
if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ALL_ACCESS, &thread_token)) {
|
if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ALL_ACCESS, &thread_token)) {
|
||||||
TWG(impersonation_token) = NULL;
|
TWG(impersonation_token) = NULL;
|
||||||
|
@ -282,14 +281,14 @@ TSRM_API int tsrm_win32_access(const char *pathname, int mode TSRMLS_DC)
|
||||||
|
|
||||||
if (CWDG(realpath_cache_size_limit)) {
|
if (CWDG(realpath_cache_size_limit)) {
|
||||||
t = time(0);
|
t = time(0);
|
||||||
bucket = realpath_cache_lookup(pathname, strlen(pathname), t TSRMLS_CC);
|
bucket = realpath_cache_lookup(pathname, (int)strlen(pathname), t TSRMLS_CC);
|
||||||
if(bucket == NULL && real_path == NULL) {
|
if(bucket == NULL && real_path == NULL) {
|
||||||
/* We used the pathname directly. Call tsrm_realpath */
|
/* We used the pathname directly. Call tsrm_realpath */
|
||||||
/* so that entry is created in realpath cache */
|
/* so that entry is created in realpath cache */
|
||||||
real_path = (char *)malloc(MAX_PATH);
|
real_path = (char *)malloc(MAX_PATH);
|
||||||
if(tsrm_realpath(pathname, real_path TSRMLS_CC) != NULL) {
|
if(tsrm_realpath(pathname, real_path TSRMLS_CC) != NULL) {
|
||||||
pathname = real_path;
|
pathname = real_path;
|
||||||
bucket = realpath_cache_lookup(pathname, strlen(pathname), t TSRMLS_CC);
|
bucket = realpath_cache_lookup(pathname, (int)strlen(pathname), t TSRMLS_CC);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -480,7 +479,7 @@ TSRM_API FILE *popen_ex(const char *command, const char *type, const char *cwd,
|
||||||
}
|
}
|
||||||
|
|
||||||
/*The following two checks can be removed once we drop XP support */
|
/*The following two checks can be removed once we drop XP support */
|
||||||
type_len = strlen(type);
|
type_len = (int)strlen(type);
|
||||||
if (type_len <1 || type_len > 2) {
|
if (type_len <1 || type_len > 2) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -725,4 +724,52 @@ TSRM_API char *realpath(char *orig_path, char *buffer)
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if HAVE_UTIME
|
||||||
|
static zend_always_inline void UnixTimeToFileTime(time_t t, LPFILETIME pft) /* {{{ */
|
||||||
|
{
|
||||||
|
// Note that LONGLONG is a 64-bit value
|
||||||
|
LONGLONG ll;
|
||||||
|
|
||||||
|
ll = Int32x32To64(t, 10000000) + 116444736000000000;
|
||||||
|
pft->dwLowDateTime = (DWORD)ll;
|
||||||
|
pft->dwHighDateTime = ll >> 32;
|
||||||
|
}
|
||||||
|
/* }}} */
|
||||||
|
|
||||||
|
TSRM_API int win32_utime(const char *filename, struct utimbuf *buf) /* {{{ */
|
||||||
|
{
|
||||||
|
FILETIME mtime, atime;
|
||||||
|
HANDLE hFile;
|
||||||
|
|
||||||
|
hFile = CreateFile(filename, GENERIC_WRITE, FILE_SHARE_WRITE|FILE_SHARE_READ, NULL,
|
||||||
|
OPEN_ALWAYS, FILE_FLAG_BACKUP_SEMANTICS, NULL);
|
||||||
|
|
||||||
|
/* OPEN_ALWAYS mode sets the last error to ERROR_ALREADY_EXISTS but
|
||||||
|
the CreateFile operation succeeds */
|
||||||
|
if (GetLastError() == ERROR_ALREADY_EXISTS) {
|
||||||
|
SetLastError(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( hFile == INVALID_HANDLE_VALUE ) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!buf) {
|
||||||
|
SYSTEMTIME st;
|
||||||
|
GetSystemTime(&st);
|
||||||
|
SystemTimeToFileTime(&st, &mtime);
|
||||||
|
atime = mtime;
|
||||||
|
} else {
|
||||||
|
UnixTimeToFileTime(buf->modtime, &mtime);
|
||||||
|
UnixTimeToFileTime(buf->actime, &atime);
|
||||||
|
}
|
||||||
|
if (!SetFileTime(hFile, NULL, &atime, &mtime)) {
|
||||||
|
CloseHandle(hFile);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
CloseHandle(hFile);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
/* }}} */
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -23,6 +23,9 @@
|
||||||
|
|
||||||
#include "TSRM.h"
|
#include "TSRM.h"
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
#if HAVE_UTIME
|
||||||
|
# include <sys/utime.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
struct ipc_perm {
|
struct ipc_perm {
|
||||||
int key;
|
int key;
|
||||||
|
|
|
@ -52,7 +52,7 @@ PHP X.Y UPGRADE NOTES
|
||||||
|
|
||||||
- Core
|
- Core
|
||||||
. Support for strings with length >= 2^31 bytes in 64 bit builds
|
. Support for strings with length >= 2^31 bytes in 64 bit builds
|
||||||
. Closure::apply() method added
|
. Closure::call() method added
|
||||||
|
|
||||||
- Standard
|
- Standard
|
||||||
. intdiv() function for integer division added.
|
. intdiv() function for integer division added.
|
||||||
|
|
|
@ -114,4 +114,17 @@ PHP 7.0 INTERNALS UPGRADE NOTES
|
||||||
2. Build system changes
|
2. Build system changes
|
||||||
========================
|
========================
|
||||||
|
|
||||||
|
a. Unix build system changes
|
||||||
|
|
||||||
|
b. Windows build system changes
|
||||||
|
|
||||||
|
- Besides Visual Studio, building with Clang or Intel Composer is now
|
||||||
|
possible. To enable an alternative toolset, add the option
|
||||||
|
--with-toolset=[vs,clang,icc] to the configure line. The default
|
||||||
|
toolset is vs. Still clang or icc need the correct environment
|
||||||
|
which involves many tools from the vs toolset.
|
||||||
|
|
||||||
|
AWARENESS The only recommended and supported toolset to produce production
|
||||||
|
ready binaries is Visual Studio. Still other compilers can be used now for
|
||||||
|
testing and analyzing purposes.
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,14 @@ include $filename;
|
||||||
|
|
||||||
echo "Done\n";
|
echo "Done\n";
|
||||||
?>
|
?>
|
||||||
|
--CLEAN--
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$filename = dirname(__FILE__)."/bug38779.txt";
|
||||||
|
if (file_exists($filename)) {
|
||||||
|
@unlink(dirname(__FILE__)."/bug38779.txt");
|
||||||
|
}
|
||||||
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
Parse error: %s error%sin %s on line %d
|
Parse error: %s error%sin %s on line %d
|
||||||
string(6) "flush!"
|
string(6) "flush!"
|
||||||
|
|
18
Zend/tests/bug68370.phpt
Normal file
18
Zend/tests/bug68370.phpt
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
--TEST--
|
||||||
|
Bug #68370 "unset($this)" can make the program crash
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
class C {
|
||||||
|
public function test() {
|
||||||
|
unset($this);
|
||||||
|
return get_defined_vars();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$c = new C();
|
||||||
|
$x = $c->test();
|
||||||
|
print_r($x);
|
||||||
|
unset($c, $x);
|
||||||
|
--EXPECTF--
|
||||||
|
Array
|
||||||
|
(
|
||||||
|
)
|
25
Zend/tests/class_properties_const.phpt
Normal file
25
Zend/tests/class_properties_const.phpt
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
--TEST--
|
||||||
|
Const class properties(runtime cache)
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
class A {
|
||||||
|
}
|
||||||
|
|
||||||
|
$a = new A;
|
||||||
|
|
||||||
|
echo "runtime\n";
|
||||||
|
var_dump($a->{array()});
|
||||||
|
var_dump($a->{1});
|
||||||
|
var_dump($a->{function(){}});
|
||||||
|
?>
|
||||||
|
--EXPECTF--
|
||||||
|
Notice: Array to string conversion in %sclass_properties_const.php on line %d
|
||||||
|
runtime
|
||||||
|
|
||||||
|
Notice: Undefined property: A::$Array in %sclass_properties_const.php on line %d
|
||||||
|
NULL
|
||||||
|
|
||||||
|
Notice: Undefined property: A::$1 in %sclass_properties_const.php on line %d
|
||||||
|
NULL
|
||||||
|
|
||||||
|
Catchable fatal error: Object of class Closure could not be converted to string in %sclass_properties_const.php on line %d
|
|
@ -1207,7 +1207,7 @@ ZEND_API void zend_update_class_constants(zend_class_entry *class_type TSRMLS_DC
|
||||||
|
|
||||||
for (i = 0; i < class_type->default_properties_count; i++) {
|
for (i = 0; i < class_type->default_properties_count; i++) {
|
||||||
if (Z_TYPE(class_type->default_properties_table[i]) != IS_UNDEF) {
|
if (Z_TYPE(class_type->default_properties_table[i]) != IS_UNDEF) {
|
||||||
zval_update_class_constant(&class_type->default_properties_table[i], 0, i TSRMLS_CC);
|
zval_update_class_constant(&class_type->default_properties_table[i], 0, OBJ_PROP_TO_OFFSET(i) TSRMLS_CC);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1251,8 +1251,9 @@ ZEND_API void object_properties_init_ex(zend_object *object, HashTable *properti
|
||||||
if (property_info != ZEND_WRONG_PROPERTY_INFO &&
|
if (property_info != ZEND_WRONG_PROPERTY_INFO &&
|
||||||
property_info &&
|
property_info &&
|
||||||
(property_info->flags & ZEND_ACC_STATIC) == 0) {
|
(property_info->flags & ZEND_ACC_STATIC) == 0) {
|
||||||
ZVAL_COPY_VALUE(&object->properties_table[property_info->offset], prop);
|
zval *slot = OBJ_PROP(object, property_info->offset);
|
||||||
ZVAL_INDIRECT(prop, &object->properties_table[property_info->offset]);
|
ZVAL_COPY_VALUE(slot, prop);
|
||||||
|
ZVAL_INDIRECT(prop, slot);
|
||||||
}
|
}
|
||||||
} ZEND_HASH_FOREACH_END();
|
} ZEND_HASH_FOREACH_END();
|
||||||
}
|
}
|
||||||
|
@ -1270,11 +1271,12 @@ ZEND_API void object_properties_load(zend_object *object, HashTable *properties
|
||||||
if (property_info != ZEND_WRONG_PROPERTY_INFO &&
|
if (property_info != ZEND_WRONG_PROPERTY_INFO &&
|
||||||
property_info &&
|
property_info &&
|
||||||
(property_info->flags & ZEND_ACC_STATIC) == 0) {
|
(property_info->flags & ZEND_ACC_STATIC) == 0) {
|
||||||
zval_ptr_dtor(&object->properties_table[property_info->offset]);
|
zval *slot = OBJ_PROP(object, property_info->offset);
|
||||||
ZVAL_COPY_VALUE(&object->properties_table[property_info->offset], prop);
|
zval_ptr_dtor(slot);
|
||||||
zval_add_ref(&object->properties_table[property_info->offset]);
|
ZVAL_COPY_VALUE(slot, prop);
|
||||||
|
zval_add_ref(slot);
|
||||||
if (object->properties) {
|
if (object->properties) {
|
||||||
ZVAL_INDIRECT(&tmp, &object->properties_table[property_info->offset]);
|
ZVAL_INDIRECT(&tmp, slot);
|
||||||
zend_hash_update(object->properties, key, &tmp);
|
zend_hash_update(object->properties, key, &tmp);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -2754,21 +2756,15 @@ ZEND_API ZEND_FUNCTION(display_disabled_function)
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
static zend_function_entry disabled_function[] = {
|
|
||||||
ZEND_FE(display_disabled_function, NULL)
|
|
||||||
ZEND_FE_END
|
|
||||||
};
|
|
||||||
|
|
||||||
ZEND_API int zend_disable_function(char *function_name, size_t function_name_length TSRMLS_DC) /* {{{ */
|
ZEND_API int zend_disable_function(char *function_name, size_t function_name_length TSRMLS_DC) /* {{{ */
|
||||||
{
|
{
|
||||||
int ret;
|
zend_internal_function *func;
|
||||||
|
if ((func = zend_hash_str_find_ptr(CG(function_table), function_name, function_name_length))) {
|
||||||
ret = zend_hash_str_del(CG(function_table), function_name, function_name_length);
|
func->arg_info = NULL;
|
||||||
if (ret == FAILURE) {
|
func->handler = ZEND_FN(display_disabled_function);
|
||||||
return FAILURE;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
disabled_function[0].fname = function_name;
|
return FAILURE;
|
||||||
return zend_register_functions(NULL, disabled_function, CG(function_table), MODULE_PERSISTENT TSRMLS_CC);
|
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
|
@ -3624,13 +3620,14 @@ ZEND_API int zend_declare_property_ex(zend_class_entry *ce, zend_string *name, z
|
||||||
if ((property_info_ptr = zend_hash_find_ptr(&ce->properties_info, name)) != NULL &&
|
if ((property_info_ptr = zend_hash_find_ptr(&ce->properties_info, name)) != NULL &&
|
||||||
(property_info_ptr->flags & ZEND_ACC_STATIC) == 0) {
|
(property_info_ptr->flags & ZEND_ACC_STATIC) == 0) {
|
||||||
property_info->offset = property_info_ptr->offset;
|
property_info->offset = property_info_ptr->offset;
|
||||||
zval_ptr_dtor(&ce->default_properties_table[property_info->offset]);
|
zval_ptr_dtor(&ce->default_properties_table[OBJ_PROP_TO_NUM(property_info->offset)]);
|
||||||
zend_hash_del(&ce->properties_info, name);
|
zend_hash_del(&ce->properties_info, name);
|
||||||
} else {
|
} else {
|
||||||
property_info->offset = ce->default_properties_count++;
|
property_info->offset = OBJ_PROP_TO_OFFSET(ce->default_properties_count);
|
||||||
|
ce->default_properties_count++;
|
||||||
ce->default_properties_table = perealloc(ce->default_properties_table, sizeof(zval) * ce->default_properties_count, ce->type == ZEND_INTERNAL_CLASS);
|
ce->default_properties_table = perealloc(ce->default_properties_table, sizeof(zval) * ce->default_properties_count, ce->type == ZEND_INTERNAL_CLASS);
|
||||||
}
|
}
|
||||||
ZVAL_COPY_VALUE(&ce->default_properties_table[property_info->offset], property);
|
ZVAL_COPY_VALUE(&ce->default_properties_table[OBJ_PROP_TO_NUM(property_info->offset)], property);
|
||||||
}
|
}
|
||||||
if (ce->type & ZEND_INTERNAL_CLASS) {
|
if (ce->type & ZEND_INTERNAL_CLASS) {
|
||||||
switch(Z_TYPE_P(property)) {
|
switch(Z_TYPE_P(property)) {
|
||||||
|
|
|
@ -395,10 +395,10 @@ stderr_last_error(char *msg)
|
||||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
||||||
(LPSTR)&buf,
|
(LPSTR)&buf,
|
||||||
0, NULL)) {
|
0, NULL)) {
|
||||||
fprintf(stderr, "\n%s: [0x%08x]\n", msg, err);
|
fprintf(stderr, "\n%s: [0x%08lx]\n", msg, err);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fprintf(stderr, "\n%s: [0x%08x] %s\n", msg, err, buf);
|
fprintf(stderr, "\n%s: [0x%08lx] %s\n", msg, err, buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -954,12 +954,10 @@ static void add_class_vars(zend_class_entry *ce, int statics, zval *return_value
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
prop = NULL;
|
prop = NULL;
|
||||||
if (prop_info->offset >= 0) {
|
|
||||||
if (statics && (prop_info->flags & ZEND_ACC_STATIC) != 0) {
|
if (statics && (prop_info->flags & ZEND_ACC_STATIC) != 0) {
|
||||||
prop = &ce->default_static_members_table[prop_info->offset];
|
prop = &ce->default_static_members_table[prop_info->offset];
|
||||||
} else if (!statics && (prop_info->flags & ZEND_ACC_STATIC) == 0) {
|
} else if (!statics && (prop_info->flags & ZEND_ACC_STATIC) == 0) {
|
||||||
prop = &ce->default_properties_table[prop_info->offset];
|
prop = &ce->default_properties_table[OBJ_PROP_TO_NUM(prop_info->offset)];
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (!prop || Z_TYPE_P(prop) == IS_UNDEF) {
|
if (!prop || Z_TYPE_P(prop) == IS_UNDEF) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -1830,6 +1828,10 @@ ZEND_FUNCTION(create_function)
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
(*func->refcount)++;
|
(*func->refcount)++;
|
||||||
|
static_variables = func->static_variables;
|
||||||
|
func->static_variables = NULL;
|
||||||
|
zend_hash_str_del(EG(function_table), LAMBDA_TEMP_FUNCNAME, sizeof(LAMBDA_TEMP_FUNCNAME)-1);
|
||||||
|
func->static_variables = static_variables;
|
||||||
|
|
||||||
function_name = zend_string_alloc(sizeof("0lambda_")+MAX_LENGTH_OF_LONG, 0);
|
function_name = zend_string_alloc(sizeof("0lambda_")+MAX_LENGTH_OF_LONG, 0);
|
||||||
function_name->val[0] = '\0';
|
function_name->val[0] = '\0';
|
||||||
|
@ -1837,10 +1839,6 @@ ZEND_FUNCTION(create_function)
|
||||||
do {
|
do {
|
||||||
function_name->len = snprintf(function_name->val + 1, sizeof("lambda_")+MAX_LENGTH_OF_LONG, "lambda_%d", ++EG(lambda_count)) + 1;
|
function_name->len = snprintf(function_name->val + 1, sizeof("lambda_")+MAX_LENGTH_OF_LONG, "lambda_%d", ++EG(lambda_count)) + 1;
|
||||||
} while (zend_hash_add_ptr(EG(function_table), function_name, func) == NULL);
|
} while (zend_hash_add_ptr(EG(function_table), function_name, func) == NULL);
|
||||||
static_variables = func->static_variables;
|
|
||||||
func->static_variables = NULL;
|
|
||||||
zend_hash_str_del(EG(function_table), LAMBDA_TEMP_FUNCNAME, sizeof(LAMBDA_TEMP_FUNCNAME)-1);
|
|
||||||
func->static_variables = static_variables;
|
|
||||||
RETURN_STR(function_name);
|
RETURN_STR(function_name);
|
||||||
} else {
|
} else {
|
||||||
zend_hash_str_del(EG(function_table), LAMBDA_TEMP_FUNCNAME, sizeof(LAMBDA_TEMP_FUNCNAME)-1);
|
zend_hash_str_del(EG(function_table), LAMBDA_TEMP_FUNCNAME, sizeof(LAMBDA_TEMP_FUNCNAME)-1);
|
||||||
|
|
|
@ -2109,7 +2109,8 @@ static zend_op *zend_delayed_compile_prop(znode *result, zend_ast *ast, uint32_t
|
||||||
zend_compile_expr(&prop_node, prop_ast TSRMLS_CC);
|
zend_compile_expr(&prop_node, prop_ast TSRMLS_CC);
|
||||||
|
|
||||||
opline = zend_delayed_emit_op(result, ZEND_FETCH_OBJ_R, &obj_node, &prop_node TSRMLS_CC);
|
opline = zend_delayed_emit_op(result, ZEND_FETCH_OBJ_R, &obj_node, &prop_node TSRMLS_CC);
|
||||||
if (opline->op2_type == IS_CONST && Z_TYPE(CONSTANT(opline->op2.constant)) == IS_STRING) {
|
if (opline->op2_type == IS_CONST) {
|
||||||
|
convert_to_string(&CONSTANT(opline->op2.constant));
|
||||||
zend_alloc_polymorphic_cache_slot(opline->op2.constant TSRMLS_CC);
|
zend_alloc_polymorphic_cache_slot(opline->op2.constant TSRMLS_CC);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2477,7 +2478,12 @@ uint32_t zend_compile_args(zend_ast *ast, zend_function *fbc TSRMLS_DC) /* {{{ *
|
||||||
if (fbc) {
|
if (fbc) {
|
||||||
flags |= ZEND_ARG_COMPILE_TIME_BOUND;
|
flags |= ZEND_ARG_COMPILE_TIME_BOUND;
|
||||||
}
|
}
|
||||||
|
if ((flags & ZEND_ARG_COMPILE_TIME_BOUND) && !(flags & ZEND_ARG_SEND_BY_REF)) {
|
||||||
|
opline->opcode = ZEND_SEND_VAR;
|
||||||
|
opline->extended_value = ZEND_ARG_COMPILE_TIME_BOUND;
|
||||||
|
} else {
|
||||||
opline->extended_value = flags;
|
opline->extended_value = flags;
|
||||||
|
}
|
||||||
} else if (fbc) {
|
} else if (fbc) {
|
||||||
opline->extended_value = ZEND_ARG_COMPILE_TIME_BOUND;
|
opline->extended_value = ZEND_ARG_COMPILE_TIME_BOUND;
|
||||||
}
|
}
|
||||||
|
@ -2984,10 +2990,8 @@ void zend_compile_global_var(zend_ast *ast TSRMLS_DC) /* {{{ */
|
||||||
|
|
||||||
zend_compile_expr(&name_node, name_ast TSRMLS_CC);
|
zend_compile_expr(&name_node, name_ast TSRMLS_CC);
|
||||||
if (name_node.op_type == IS_CONST) {
|
if (name_node.op_type == IS_CONST) {
|
||||||
if (Z_TYPE(name_node.u.constant) != IS_STRING) {
|
|
||||||
convert_to_string(&name_node.u.constant);
|
convert_to_string(&name_node.u.constant);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (zend_try_compile_cv(&result, var_ast TSRMLS_CC) == SUCCESS) {
|
if (zend_try_compile_cv(&result, var_ast TSRMLS_CC) == SUCCESS) {
|
||||||
zend_op *opline = zend_emit_op(NULL, ZEND_BIND_GLOBAL, &result, &name_node TSRMLS_CC);
|
zend_op *opline = zend_emit_op(NULL, ZEND_BIND_GLOBAL, &result, &name_node TSRMLS_CC);
|
||||||
|
@ -4639,6 +4643,8 @@ static HashTable *zend_get_import_ht(uint32_t type TSRMLS_DC) /* {{{ */
|
||||||
return CG(current_import_const);
|
return CG(current_import_const);
|
||||||
EMPTY_SWITCH_DEFAULT_CASE()
|
EMPTY_SWITCH_DEFAULT_CASE()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
|
@ -4653,6 +4659,8 @@ static char *zend_get_use_type_str(uint32_t type) /* {{{ */
|
||||||
return " const";
|
return " const";
|
||||||
EMPTY_SWITCH_DEFAULT_CASE()
|
EMPTY_SWITCH_DEFAULT_CASE()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return " unknown";
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
|
@ -5465,7 +5473,7 @@ void zend_compile_isset_or_empty(znode *result, zend_ast *ast TSRMLS_DC) /* {{{
|
||||||
zend_ast *var_ast = ast->child[0];
|
zend_ast *var_ast = ast->child[0];
|
||||||
|
|
||||||
znode var_node;
|
znode var_node;
|
||||||
zend_op *opline;
|
zend_op *opline = NULL;
|
||||||
|
|
||||||
ZEND_ASSERT(ast->kind == ZEND_AST_ISSET || ast->kind == ZEND_AST_EMPTY);
|
ZEND_ASSERT(ast->kind == ZEND_AST_ISSET || ast->kind == ZEND_AST_EMPTY);
|
||||||
|
|
||||||
|
|
|
@ -227,13 +227,23 @@ typedef struct _zend_try_catch_element {
|
||||||
char *zend_visibility_string(uint32_t fn_flags);
|
char *zend_visibility_string(uint32_t fn_flags);
|
||||||
|
|
||||||
typedef struct _zend_property_info {
|
typedef struct _zend_property_info {
|
||||||
|
uint32_t offset; /* property offset for object properties or
|
||||||
|
property index for static properties */
|
||||||
uint32_t flags;
|
uint32_t flags;
|
||||||
int offset;
|
|
||||||
zend_string *name;
|
zend_string *name;
|
||||||
zend_string *doc_comment;
|
zend_string *doc_comment;
|
||||||
zend_class_entry *ce;
|
zend_class_entry *ce;
|
||||||
} zend_property_info;
|
} zend_property_info;
|
||||||
|
|
||||||
|
#define OBJ_PROP(obj, offset) \
|
||||||
|
((zval*)((char*)(obj) + offset))
|
||||||
|
#define OBJ_PROP_NUM(obj, num) \
|
||||||
|
(&(obj)->properties_table[(num)])
|
||||||
|
#define OBJ_PROP_TO_OFFSET(num) \
|
||||||
|
((uint32_t)(zend_uintptr_t)OBJ_PROP_NUM(((zend_object*)NULL), num))
|
||||||
|
#define OBJ_PROP_TO_NUM(offset) \
|
||||||
|
((offset - OBJ_PROP_TO_OFFSET(0)) / sizeof(zval))
|
||||||
|
|
||||||
typedef struct _zend_arg_info {
|
typedef struct _zend_arg_info {
|
||||||
const char *name; // TODO: convert into zend_string ???
|
const char *name; // TODO: convert into zend_string ???
|
||||||
uint32_t name_len;
|
uint32_t name_len;
|
||||||
|
|
|
@ -47,7 +47,9 @@ typedef unsigned int uint;
|
||||||
#define HAVE_CLASS_ISTDIOSTREAM
|
#define HAVE_CLASS_ISTDIOSTREAM
|
||||||
#define istdiostream stdiostream
|
#define istdiostream stdiostream
|
||||||
|
|
||||||
|
#if _MSC_VER < 1900
|
||||||
#define snprintf _snprintf
|
#define snprintf _snprintf
|
||||||
|
#endif
|
||||||
#if _MSC_VER < 1500
|
#if _MSC_VER < 1500
|
||||||
#define vsnprintf _vsnprintf
|
#define vsnprintf _vsnprintf
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -99,13 +99,13 @@ static const zend_internal_function zend_pass_function = {
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define FREE_OP(should_free) \
|
#define FREE_OP(should_free) \
|
||||||
if (should_free.var) { \
|
if (should_free) { \
|
||||||
zval_ptr_dtor_nogc(should_free.var); \
|
zval_ptr_dtor_nogc(should_free); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define FREE_OP_VAR_PTR(should_free) \
|
#define FREE_OP_VAR_PTR(should_free) \
|
||||||
if (should_free.var) { \
|
if (should_free) { \
|
||||||
zval_ptr_dtor_nogc(should_free.var); \
|
zval_ptr_dtor_nogc(should_free); \
|
||||||
}
|
}
|
||||||
|
|
||||||
/* End of zend_execute_locks.h */
|
/* End of zend_execute_locks.h */
|
||||||
|
@ -183,29 +183,29 @@ ZEND_API zval* zend_get_compiled_variable_value(const zend_execute_data *execute
|
||||||
return EX_VAR(var);
|
return EX_VAR(var);
|
||||||
}
|
}
|
||||||
|
|
||||||
static zend_always_inline zval *_get_zval_ptr_tmp(uint32_t var, const zend_execute_data *execute_data, zend_free_op *should_free TSRMLS_DC)
|
static zend_always_inline zval *_get_zval_ptr_tmp(uint32_t var, const zend_execute_data *execute_data, zend_free_op *should_free)
|
||||||
{
|
{
|
||||||
zval *ret = EX_VAR(var);
|
zval *ret = EX_VAR(var);
|
||||||
should_free->var = ret;
|
*should_free = ret;
|
||||||
|
|
||||||
ZEND_ASSERT(Z_TYPE_P(ret) != IS_REFERENCE);
|
ZEND_ASSERT(Z_TYPE_P(ret) != IS_REFERENCE);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static zend_always_inline zval *_get_zval_ptr_var(uint32_t var, const zend_execute_data *execute_data, zend_free_op *should_free TSRMLS_DC)
|
static zend_always_inline zval *_get_zval_ptr_var(uint32_t var, const zend_execute_data *execute_data, zend_free_op *should_free)
|
||||||
{
|
{
|
||||||
zval *ret = EX_VAR(var);
|
zval *ret = EX_VAR(var);
|
||||||
|
|
||||||
should_free->var = ret;
|
*should_free = ret;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static zend_always_inline zval *_get_zval_ptr_var_deref(uint32_t var, const zend_execute_data *execute_data, zend_free_op *should_free TSRMLS_DC)
|
static zend_always_inline zval *_get_zval_ptr_var_deref(uint32_t var, const zend_execute_data *execute_data, zend_free_op *should_free)
|
||||||
{
|
{
|
||||||
zval *ret = EX_VAR(var);
|
zval *ret = EX_VAR(var);
|
||||||
|
|
||||||
should_free->var = ret;
|
*should_free = ret;
|
||||||
ZVAL_DEREF(ret);
|
ZVAL_DEREF(ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -392,93 +392,71 @@ static zend_always_inline zval *_get_zval_ptr_cv_deref_BP_VAR_W(const zend_execu
|
||||||
|
|
||||||
static inline zval *_get_zval_ptr(int op_type, const znode_op *node, const zend_execute_data *execute_data, zend_free_op *should_free, int type TSRMLS_DC)
|
static inline zval *_get_zval_ptr(int op_type, const znode_op *node, const zend_execute_data *execute_data, zend_free_op *should_free, int type TSRMLS_DC)
|
||||||
{
|
{
|
||||||
zval *ret;
|
|
||||||
|
|
||||||
switch (op_type) {
|
switch (op_type) {
|
||||||
case IS_CONST:
|
case IS_CONST:
|
||||||
should_free->var = NULL;
|
*should_free = NULL;
|
||||||
return node->zv;
|
return node->zv;
|
||||||
break;
|
|
||||||
case IS_TMP_VAR:
|
case IS_TMP_VAR:
|
||||||
ret = EX_VAR(node->var);
|
return _get_zval_ptr_tmp(node->var, execute_data, should_free);
|
||||||
should_free->var = ret;
|
|
||||||
return ret;
|
|
||||||
break;
|
|
||||||
case IS_VAR:
|
case IS_VAR:
|
||||||
return _get_zval_ptr_var(node->var, execute_data, should_free TSRMLS_CC);
|
return _get_zval_ptr_var(node->var, execute_data, should_free);
|
||||||
break;
|
|
||||||
case IS_UNUSED:
|
|
||||||
should_free->var = NULL;
|
|
||||||
return NULL;
|
|
||||||
break;
|
|
||||||
case IS_CV:
|
case IS_CV:
|
||||||
default:
|
*should_free = NULL;
|
||||||
should_free->var = NULL;
|
|
||||||
return _get_zval_ptr_cv(execute_data, node->var, type TSRMLS_CC);
|
return _get_zval_ptr_cv(execute_data, node->var, type TSRMLS_CC);
|
||||||
break;
|
default:
|
||||||
}
|
*should_free = NULL;
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline zval *_get_zval_ptr_deref(int op_type, const znode_op *node, const zend_execute_data *execute_data, zend_free_op *should_free, int type TSRMLS_DC)
|
static inline zval *_get_zval_ptr_deref(int op_type, const znode_op *node, const zend_execute_data *execute_data, zend_free_op *should_free, int type TSRMLS_DC)
|
||||||
{
|
{
|
||||||
zval *ret;
|
|
||||||
|
|
||||||
switch (op_type) {
|
switch (op_type) {
|
||||||
case IS_CONST:
|
case IS_CONST:
|
||||||
should_free->var = NULL;
|
*should_free = NULL;
|
||||||
return node->zv;
|
return node->zv;
|
||||||
break;
|
|
||||||
case IS_TMP_VAR:
|
case IS_TMP_VAR:
|
||||||
ret = EX_VAR(node->var);
|
return _get_zval_ptr_tmp(node->var, execute_data, should_free);
|
||||||
should_free->var = ret;
|
|
||||||
return ret;
|
|
||||||
break;
|
|
||||||
case IS_VAR:
|
case IS_VAR:
|
||||||
return _get_zval_ptr_var_deref(node->var, execute_data, should_free TSRMLS_CC);
|
return _get_zval_ptr_var_deref(node->var, execute_data, should_free);
|
||||||
break;
|
|
||||||
case IS_UNUSED:
|
|
||||||
should_free->var = NULL;
|
|
||||||
return NULL;
|
|
||||||
break;
|
|
||||||
case IS_CV:
|
case IS_CV:
|
||||||
default:
|
*should_free = NULL;
|
||||||
should_free->var = NULL;
|
|
||||||
return _get_zval_ptr_cv_deref(execute_data, node->var, type TSRMLS_CC);
|
return _get_zval_ptr_cv_deref(execute_data, node->var, type TSRMLS_CC);
|
||||||
break;
|
default:
|
||||||
}
|
*should_free = NULL;
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static zend_always_inline zval *_get_zval_ptr_ptr_var(uint32_t var, const zend_execute_data *execute_data, zend_free_op *should_free TSRMLS_DC)
|
static zend_always_inline zval *_get_zval_ptr_ptr_var(uint32_t var, const zend_execute_data *execute_data, zend_free_op *should_free)
|
||||||
{
|
{
|
||||||
zval *ret = EX_VAR(var);
|
zval *ret = EX_VAR(var);
|
||||||
|
|
||||||
if (EXPECTED(Z_TYPE_P(ret) == IS_INDIRECT)) {
|
if (EXPECTED(Z_TYPE_P(ret) == IS_INDIRECT)) {
|
||||||
should_free->var = NULL;
|
*should_free = NULL;
|
||||||
return Z_INDIRECT_P(ret);
|
ret = Z_INDIRECT_P(ret);
|
||||||
} else if (!Z_REFCOUNTED_P(ret) || Z_REFCOUNT_P(ret) == 1) {
|
|
||||||
should_free->var = ret;
|
|
||||||
return ret;
|
|
||||||
} else {
|
} else {
|
||||||
|
*should_free = ret;
|
||||||
|
if (Z_REFCOUNTED_P(ret) && Z_REFCOUNT_P(ret) > 1) {
|
||||||
|
*should_free = NULL;
|
||||||
Z_DELREF_P(ret);
|
Z_DELREF_P(ret);
|
||||||
should_free->var = NULL;
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline zval *_get_zval_ptr_ptr(int op_type, const znode_op *node, const zend_execute_data *execute_data, zend_free_op *should_free, int type TSRMLS_DC)
|
static inline zval *_get_zval_ptr_ptr(int op_type, const znode_op *node, const zend_execute_data *execute_data, zend_free_op *should_free, int type TSRMLS_DC)
|
||||||
{
|
{
|
||||||
if (op_type == IS_CV) {
|
if (op_type == IS_CV) {
|
||||||
should_free->var = NULL;
|
*should_free = NULL;
|
||||||
return _get_zval_ptr_cv(execute_data, node->var, type TSRMLS_CC);
|
return _get_zval_ptr_cv(execute_data, node->var, type TSRMLS_CC);
|
||||||
} else /* if (op_type == IS_VAR) */ {
|
} else /* if (op_type == IS_VAR) */ {
|
||||||
ZEND_ASSERT(op_type == IS_VAR);
|
ZEND_ASSERT(op_type == IS_VAR);
|
||||||
return _get_zval_ptr_ptr_var(node->var, execute_data, should_free TSRMLS_CC);
|
return _get_zval_ptr_ptr_var(node->var, execute_data, should_free);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static zend_always_inline zval *_get_obj_zval_ptr_unused(zend_execute_data *execute_data TSRMLS_DC)
|
static zend_always_inline zval *_get_obj_zval_ptr_unused(zend_execute_data *execute_data)
|
||||||
{
|
{
|
||||||
if (EXPECTED(Z_OBJ(EX(This)) != NULL)) {
|
if (EXPECTED(Z_OBJ(EX(This)) != NULL)) {
|
||||||
return &EX(This);
|
return &EX(This);
|
||||||
|
@ -492,7 +470,7 @@ static inline zval *_get_obj_zval_ptr(int op_type, znode_op *op, zend_execute_da
|
||||||
{
|
{
|
||||||
if (op_type == IS_UNUSED) {
|
if (op_type == IS_UNUSED) {
|
||||||
if (EXPECTED(Z_OBJ(EX(This)) != NULL)) {
|
if (EXPECTED(Z_OBJ(EX(This)) != NULL)) {
|
||||||
should_free->var = NULL;
|
*should_free = NULL;
|
||||||
return &EX(This);
|
return &EX(This);
|
||||||
} else {
|
} else {
|
||||||
zend_error_noreturn(E_ERROR, "Using $this when not in object context");
|
zend_error_noreturn(E_ERROR, "Using $this when not in object context");
|
||||||
|
@ -505,7 +483,7 @@ static inline zval *_get_obj_zval_ptr_ptr(int op_type, const znode_op *node, zen
|
||||||
{
|
{
|
||||||
if (op_type == IS_UNUSED) {
|
if (op_type == IS_UNUSED) {
|
||||||
if (EXPECTED(Z_OBJ(EX(This)) != NULL)) {
|
if (EXPECTED(Z_OBJ(EX(This)) != NULL)) {
|
||||||
should_free->var = NULL;
|
*should_free = NULL;
|
||||||
return &EX(This);
|
return &EX(This);
|
||||||
} else {
|
} else {
|
||||||
zend_error_noreturn(E_ERROR, "Using $this when not in object context");
|
zend_error_noreturn(E_ERROR, "Using $this when not in object context");
|
||||||
|
@ -1292,7 +1270,7 @@ ZEND_API void zend_fetch_dimension_by_zval(zval *result, zval *container, zval *
|
||||||
zend_fetch_dimension_address_read_R(result, container, dim, IS_TMP_VAR TSRMLS_CC);
|
zend_fetch_dimension_address_read_R(result, container, dim, IS_TMP_VAR TSRMLS_CC);
|
||||||
}
|
}
|
||||||
|
|
||||||
static zend_always_inline void zend_fetch_property_address(zval *result, zval *container, uint32_t container_op_type, zval *prop_ptr, void **cache_slot, int type TSRMLS_DC)
|
static zend_always_inline void zend_fetch_property_address(zval *result, zval *container, uint32_t container_op_type, zval *prop_ptr, uint32_t prop_op_type, void **cache_slot, int type TSRMLS_DC)
|
||||||
{
|
{
|
||||||
if (container_op_type != IS_UNUSED) {
|
if (container_op_type != IS_UNUSED) {
|
||||||
ZVAL_DEREF(container);
|
ZVAL_DEREF(container);
|
||||||
|
@ -1316,6 +1294,26 @@ static zend_always_inline void zend_fetch_property_address(zval *result, zval *c
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (prop_op_type == IS_CONST &&
|
||||||
|
EXPECTED(Z_OBJCE_P(container) == CACHED_PTR_EX(cache_slot))) {
|
||||||
|
zend_property_info *prop_info = CACHED_PTR_EX(cache_slot + 1);
|
||||||
|
zend_object *zobj = Z_OBJ_P(container);
|
||||||
|
zval *retval;
|
||||||
|
|
||||||
|
if (EXPECTED(prop_info)) {
|
||||||
|
retval = OBJ_PROP(zobj, prop_info->offset);
|
||||||
|
if (EXPECTED(Z_TYPE_P(retval) != IS_UNDEF)) {
|
||||||
|
ZVAL_INDIRECT(result, retval);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else if (EXPECTED(zobj->properties != NULL)) {
|
||||||
|
retval = zend_hash_find(zobj->properties, Z_STR_P(prop_ptr));
|
||||||
|
if (EXPECTED(retval)) {
|
||||||
|
ZVAL_INDIRECT(result, retval);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (EXPECTED(Z_OBJ_HT_P(container)->get_property_ptr_ptr)) {
|
if (EXPECTED(Z_OBJ_HT_P(container)->get_property_ptr_ptr)) {
|
||||||
zval *ptr = Z_OBJ_HT_P(container)->get_property_ptr_ptr(container, prop_ptr, type, cache_slot TSRMLS_CC);
|
zval *ptr = Z_OBJ_HT_P(container)->get_property_ptr_ptr(container, prop_ptr, type, cache_slot TSRMLS_CC);
|
||||||
if (NULL == ptr) {
|
if (NULL == ptr) {
|
||||||
|
|
|
@ -261,10 +261,7 @@ ZEND_API int zend_set_user_opcode_handler(zend_uchar opcode, user_opcode_handler
|
||||||
ZEND_API user_opcode_handler_t zend_get_user_opcode_handler(zend_uchar opcode);
|
ZEND_API user_opcode_handler_t zend_get_user_opcode_handler(zend_uchar opcode);
|
||||||
|
|
||||||
/* former zend_execute_locks.h */
|
/* former zend_execute_locks.h */
|
||||||
typedef struct _zend_free_op {
|
typedef zval* zend_free_op;
|
||||||
zval *var;
|
|
||||||
/* int is_var; */
|
|
||||||
} zend_free_op;
|
|
||||||
|
|
||||||
ZEND_API zval *zend_get_zval_ptr(int op_type, const znode_op *node, const zend_execute_data *execute_data, zend_free_op *should_free, int type TSRMLS_DC);
|
ZEND_API zval *zend_get_zval_ptr(int op_type, const znode_op *node, const zend_execute_data *execute_data, zend_free_op *should_free, int type TSRMLS_DC);
|
||||||
|
|
||||||
|
|
|
@ -51,8 +51,8 @@ static WNDCLASS wc;
|
||||||
static HWND timeout_window;
|
static HWND timeout_window;
|
||||||
static HANDLE timeout_thread_event;
|
static HANDLE timeout_thread_event;
|
||||||
static HANDLE timeout_thread_handle;
|
static HANDLE timeout_thread_handle;
|
||||||
static DWORD timeout_thread_id;
|
static unsigned timeout_thread_id;
|
||||||
static int timeout_thread_initialized=0;
|
static volatile long timeout_thread_initialized=0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0&&ZEND_DEBUG
|
#if 0&&ZEND_DEBUG
|
||||||
|
@ -1166,6 +1166,10 @@ ZEND_API void zend_timeout(int dummy) /* {{{ */
|
||||||
#ifdef ZEND_WIN32
|
#ifdef ZEND_WIN32
|
||||||
static LRESULT CALLBACK zend_timeout_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) /* {{{ */
|
static LRESULT CALLBACK zend_timeout_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) /* {{{ */
|
||||||
{
|
{
|
||||||
|
#ifdef ZTS
|
||||||
|
THREAD_T thread_id = (THREAD_T)wParam;
|
||||||
|
#endif
|
||||||
|
|
||||||
switch (message) {
|
switch (message) {
|
||||||
case WM_DESTROY:
|
case WM_DESTROY:
|
||||||
PostQuitMessage(0);
|
PostQuitMessage(0);
|
||||||
|
@ -1180,7 +1184,7 @@ static LRESULT CALLBACK zend_timeout_WndProc(HWND hWnd, UINT message, WPARAM wPa
|
||||||
#endif
|
#endif
|
||||||
SetTimer(timeout_window, wParam, lParam*1000, NULL);
|
SetTimer(timeout_window, wParam, lParam*1000, NULL);
|
||||||
#ifdef ZTS
|
#ifdef ZTS
|
||||||
tsrm_ls = ts_resource_ex(0, &wParam);
|
tsrm_ls = ts_resource_ex(0, &thread_id);
|
||||||
if (!tsrm_ls) {
|
if (!tsrm_ls) {
|
||||||
/* shouldn't normally happen */
|
/* shouldn't normally happen */
|
||||||
break;
|
break;
|
||||||
|
@ -1199,7 +1203,7 @@ static LRESULT CALLBACK zend_timeout_WndProc(HWND hWnd, UINT message, WPARAM wPa
|
||||||
#ifdef ZTS
|
#ifdef ZTS
|
||||||
void ***tsrm_ls;
|
void ***tsrm_ls;
|
||||||
|
|
||||||
tsrm_ls = ts_resource_ex(0, &wParam);
|
tsrm_ls = ts_resource_ex(0, &thread_id);
|
||||||
if (!tsrm_ls) {
|
if (!tsrm_ls) {
|
||||||
/* Thread died before receiving its timeout? */
|
/* Thread died before receiving its timeout? */
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -100,7 +100,7 @@ static const uint32_t uninitialized_bucket = {INVALID_IDX};
|
||||||
ZEND_API void _zend_hash_init(HashTable *ht, uint32_t nSize, dtor_func_t pDestructor, zend_bool persistent ZEND_FILE_LINE_DC)
|
ZEND_API void _zend_hash_init(HashTable *ht, uint32_t nSize, dtor_func_t pDestructor, zend_bool persistent ZEND_FILE_LINE_DC)
|
||||||
{
|
{
|
||||||
/* Use big enough power of 2 */
|
/* Use big enough power of 2 */
|
||||||
#ifdef PHP_WIN32
|
#if defined(PHP_WIN32) && !defined(__clang__)
|
||||||
if (nSize <= 8) {
|
if (nSize <= 8) {
|
||||||
ht->nTableSize = 8;
|
ht->nTableSize = 8;
|
||||||
} else if (nSize >= 0x80000000) {
|
} else if (nSize >= 0x80000000) {
|
||||||
|
@ -269,14 +269,12 @@ static zend_always_inline zval *_zend_hash_add_or_update_i(HashTable *ht, zend_s
|
||||||
|
|
||||||
IS_CONSISTENT(ht);
|
IS_CONSISTENT(ht);
|
||||||
|
|
||||||
|
if (UNEXPECTED(ht->nTableMask == 0)) {
|
||||||
CHECK_INIT(ht, 0);
|
CHECK_INIT(ht, 0);
|
||||||
if (ht->u.flags & HASH_FLAG_PACKED) {
|
goto add_to_hash;
|
||||||
|
} else if (ht->u.flags & HASH_FLAG_PACKED) {
|
||||||
zend_hash_packed_to_hash(ht);
|
zend_hash_packed_to_hash(ht);
|
||||||
}
|
} else if ((flag & HASH_ADD_NEW) == 0) {
|
||||||
|
|
||||||
h = zend_string_hash_val(key);
|
|
||||||
|
|
||||||
if ((flag & HASH_ADD_NEW) == 0) {
|
|
||||||
p = zend_hash_find_bucket(ht, key);
|
p = zend_hash_find_bucket(ht, key);
|
||||||
|
|
||||||
if (p) {
|
if (p) {
|
||||||
|
@ -302,6 +300,7 @@ static zend_always_inline zval *_zend_hash_add_or_update_i(HashTable *ht, zend_s
|
||||||
|
|
||||||
ZEND_HASH_IF_FULL_DO_RESIZE(ht); /* If the Hash table is full, resize it */
|
ZEND_HASH_IF_FULL_DO_RESIZE(ht); /* If the Hash table is full, resize it */
|
||||||
|
|
||||||
|
add_to_hash:
|
||||||
HANDLE_BLOCK_INTERRUPTIONS();
|
HANDLE_BLOCK_INTERRUPTIONS();
|
||||||
idx = ht->nNumUsed++;
|
idx = ht->nNumUsed++;
|
||||||
ht->nNumOfElements++;
|
ht->nNumOfElements++;
|
||||||
|
@ -309,7 +308,7 @@ static zend_always_inline zval *_zend_hash_add_or_update_i(HashTable *ht, zend_s
|
||||||
ht->nInternalPointer = idx;
|
ht->nInternalPointer = idx;
|
||||||
}
|
}
|
||||||
p = ht->arData + idx;
|
p = ht->arData + idx;
|
||||||
p->h = h;
|
p->h = h = zend_string_hash_val(key);
|
||||||
p->key = key;
|
p->key = key;
|
||||||
zend_string_addref(key);
|
zend_string_addref(key);
|
||||||
ZVAL_COPY_VALUE(&p->val, pData);
|
ZVAL_COPY_VALUE(&p->val, pData);
|
||||||
|
@ -423,9 +422,15 @@ static zend_always_inline zval *_zend_hash_index_add_or_update_i(HashTable *ht,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
IS_CONSISTENT(ht);
|
IS_CONSISTENT(ht);
|
||||||
CHECK_INIT(ht, h < ht->nTableSize);
|
|
||||||
|
|
||||||
if (ht->u.flags & HASH_FLAG_PACKED) {
|
if (UNEXPECTED(ht->nTableMask == 0)) {
|
||||||
|
CHECK_INIT(ht, h < ht->nTableSize);
|
||||||
|
if (h < ht->nTableSize) {
|
||||||
|
p = ht->arData + h;
|
||||||
|
goto add_to_packed;
|
||||||
|
}
|
||||||
|
goto add_to_hash;
|
||||||
|
} else if (ht->u.flags & HASH_FLAG_PACKED) {
|
||||||
if (h < ht->nNumUsed) {
|
if (h < ht->nNumUsed) {
|
||||||
p = ht->arData + h;
|
p = ht->arData + h;
|
||||||
if (Z_TYPE(p->val) != IS_UNDEF) {
|
if (Z_TYPE(p->val) != IS_UNDEF) {
|
||||||
|
@ -453,6 +458,7 @@ static zend_always_inline zval *_zend_hash_index_add_or_update_i(HashTable *ht,
|
||||||
goto convert_to_hash;
|
goto convert_to_hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
add_to_packed:
|
||||||
HANDLE_BLOCK_INTERRUPTIONS();
|
HANDLE_BLOCK_INTERRUPTIONS();
|
||||||
/* incremental initialization of empty Buckets */
|
/* incremental initialization of empty Buckets */
|
||||||
if ((flag & (HASH_ADD_NEW|HASH_ADD_NEXT)) == (HASH_ADD_NEW|HASH_ADD_NEXT)) {
|
if ((flag & (HASH_ADD_NEW|HASH_ADD_NEXT)) == (HASH_ADD_NEW|HASH_ADD_NEXT)) {
|
||||||
|
@ -477,7 +483,6 @@ static zend_always_inline zval *_zend_hash_index_add_or_update_i(HashTable *ht,
|
||||||
p->h = h;
|
p->h = h;
|
||||||
p->key = NULL;
|
p->key = NULL;
|
||||||
ZVAL_COPY_VALUE(&p->val, pData);
|
ZVAL_COPY_VALUE(&p->val, pData);
|
||||||
Z_NEXT(p->val) = INVALID_IDX;
|
|
||||||
|
|
||||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||||
|
|
||||||
|
@ -485,9 +490,7 @@ static zend_always_inline zval *_zend_hash_index_add_or_update_i(HashTable *ht,
|
||||||
|
|
||||||
convert_to_hash:
|
convert_to_hash:
|
||||||
zend_hash_packed_to_hash(ht);
|
zend_hash_packed_to_hash(ht);
|
||||||
}
|
} else if ((flag & HASH_ADD_NEW) == 0) {
|
||||||
|
|
||||||
if ((flag & HASH_ADD_NEW) == 0) {
|
|
||||||
p = zend_hash_index_find_bucket(ht, h);
|
p = zend_hash_index_find_bucket(ht, h);
|
||||||
if (p) {
|
if (p) {
|
||||||
if (flag & HASH_ADD) {
|
if (flag & HASH_ADD) {
|
||||||
|
@ -509,6 +512,7 @@ convert_to_hash:
|
||||||
|
|
||||||
ZEND_HASH_IF_FULL_DO_RESIZE(ht); /* If the Hash table is full, resize it */
|
ZEND_HASH_IF_FULL_DO_RESIZE(ht); /* If the Hash table is full, resize it */
|
||||||
|
|
||||||
|
add_to_hash:
|
||||||
HANDLE_BLOCK_INTERRUPTIONS();
|
HANDLE_BLOCK_INTERRUPTIONS();
|
||||||
idx = ht->nNumUsed++;
|
idx = ht->nNumUsed++;
|
||||||
ht->nNumOfElements++;
|
ht->nNumOfElements++;
|
||||||
|
@ -1693,8 +1697,7 @@ ZEND_API int zend_hash_sort(HashTable *ht, sort_func_t sort_func,
|
||||||
p->key = NULL;
|
p->key = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (renumber) {
|
|
||||||
ht->nNextFreeElement = i;
|
ht->nNextFreeElement = i;
|
||||||
}
|
}
|
||||||
if (ht->u.flags & HASH_FLAG_PACKED) {
|
if (ht->u.flags & HASH_FLAG_PACKED) {
|
||||||
|
|
|
@ -539,6 +539,19 @@ static zend_always_inline void *zend_hash_index_update_ptr(HashTable *ht, zend_u
|
||||||
return zv ? Z_PTR_P(zv) : NULL;
|
return zv ? Z_PTR_P(zv) : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static zend_always_inline void *zend_hash_index_add_mem(HashTable *ht, zend_ulong h, void *pData, size_t size)
|
||||||
|
{
|
||||||
|
zval tmp, *zv;
|
||||||
|
|
||||||
|
ZVAL_PTR(&tmp, NULL);
|
||||||
|
if ((zv = zend_hash_index_add(ht, h, &tmp))) {
|
||||||
|
Z_PTR_P(zv) = pemalloc(size, ht->u.flags & HASH_FLAG_PERSISTENT);
|
||||||
|
memcpy(Z_PTR_P(zv), pData, size);
|
||||||
|
return Z_PTR_P(zv);
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static zend_always_inline void *zend_hash_next_index_insert_ptr(HashTable *ht, void *pData)
|
static zend_always_inline void *zend_hash_next_index_insert_ptr(HashTable *ht, void *pData)
|
||||||
{
|
{
|
||||||
zval tmp, *zv;
|
zval tmp, *zv;
|
||||||
|
@ -696,6 +709,11 @@ static zend_always_inline void *zend_hash_get_current_data_ptr_ex(HashTable *ht,
|
||||||
_key = _p->key; \
|
_key = _p->key; \
|
||||||
_val = _z;
|
_val = _z;
|
||||||
|
|
||||||
|
#define ZEND_HASH_FOREACH_NUM_KEY_PTR(ht, _h, _ptr) \
|
||||||
|
ZEND_HASH_FOREACH(ht, 0); \
|
||||||
|
_h = _p->h; \
|
||||||
|
_ptr = Z_PTR_P(_z);
|
||||||
|
|
||||||
#define ZEND_HASH_FOREACH_STR_KEY_PTR(ht, _key, _ptr) \
|
#define ZEND_HASH_FOREACH_STR_KEY_PTR(ht, _key, _ptr) \
|
||||||
ZEND_HASH_FOREACH(ht, 0); \
|
ZEND_HASH_FOREACH(ht, 0); \
|
||||||
_key = _p->key; \
|
_key = _p->key; \
|
||||||
|
|
|
@ -372,7 +372,7 @@ static zend_string *zend_get_function_declaration(zend_function *fptr TSRMLS_DC)
|
||||||
for (i = 0; i < fptr->common.num_args;) {
|
for (i = 0; i < fptr->common.num_args;) {
|
||||||
if (arg_info->class_name) {
|
if (arg_info->class_name) {
|
||||||
const char *class_name;
|
const char *class_name;
|
||||||
uint32_t class_name_len;
|
size_t class_name_len;
|
||||||
if (!strcasecmp(arg_info->class_name, "self") && fptr->common.scope) {
|
if (!strcasecmp(arg_info->class_name, "self") && fptr->common.scope) {
|
||||||
class_name = fptr->common.scope->name->val;
|
class_name = fptr->common.scope->name->val;
|
||||||
class_name_len = fptr->common.scope->name->len;
|
class_name_len = fptr->common.scope->name->len;
|
||||||
|
@ -602,9 +602,12 @@ static zend_bool do_inherit_property_access_check(HashTable *target_ht, zend_pro
|
||||||
if ((child_info->flags & ZEND_ACC_PPP_MASK) > (parent_info->flags & ZEND_ACC_PPP_MASK)) {
|
if ((child_info->flags & ZEND_ACC_PPP_MASK) > (parent_info->flags & ZEND_ACC_PPP_MASK)) {
|
||||||
zend_error_noreturn(E_COMPILE_ERROR, "Access level to %s::$%s must be %s (as in class %s)%s", ce->name->val, key->val, zend_visibility_string(parent_info->flags), parent_ce->name->val, (parent_info->flags&ZEND_ACC_PUBLIC) ? "" : " or weaker");
|
zend_error_noreturn(E_COMPILE_ERROR, "Access level to %s::$%s must be %s (as in class %s)%s", ce->name->val, key->val, zend_visibility_string(parent_info->flags), parent_ce->name->val, (parent_info->flags&ZEND_ACC_PUBLIC) ? "" : " or weaker");
|
||||||
} else if ((child_info->flags & ZEND_ACC_STATIC) == 0) {
|
} else if ((child_info->flags & ZEND_ACC_STATIC) == 0) {
|
||||||
zval_ptr_dtor(&(ce->default_properties_table[parent_info->offset]));
|
int parent_num = OBJ_PROP_TO_NUM(parent_info->offset);
|
||||||
ce->default_properties_table[parent_info->offset] = ce->default_properties_table[child_info->offset];
|
int child_num = OBJ_PROP_TO_NUM(child_info->offset);
|
||||||
ZVAL_UNDEF(&ce->default_properties_table[child_info->offset]);
|
|
||||||
|
zval_ptr_dtor(&(ce->default_properties_table[parent_num]));
|
||||||
|
ce->default_properties_table[parent_num] = ce->default_properties_table[child_num];
|
||||||
|
ZVAL_UNDEF(&ce->default_properties_table[child_num]);
|
||||||
child_info->offset = parent_info->offset;
|
child_info->offset = parent_info->offset;
|
||||||
}
|
}
|
||||||
return 0; /* Don't copy from parent */
|
return 0; /* Don't copy from parent */
|
||||||
|
@ -797,7 +800,7 @@ ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent
|
||||||
if (property_info->flags & ZEND_ACC_STATIC) {
|
if (property_info->flags & ZEND_ACC_STATIC) {
|
||||||
property_info->offset += parent_ce->default_static_members_count;
|
property_info->offset += parent_ce->default_static_members_count;
|
||||||
} else {
|
} else {
|
||||||
property_info->offset += parent_ce->default_properties_count;
|
property_info->offset += parent_ce->default_properties_count * sizeof(zval);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} ZEND_HASH_FOREACH_END();
|
} ZEND_HASH_FOREACH_END();
|
||||||
|
@ -1421,8 +1424,8 @@ static void zend_do_traits_property_binding(zend_class_entry *ce TSRMLS_DC) /* {
|
||||||
|| (Z_LVAL(compare_result) != 0);
|
|| (Z_LVAL(compare_result) != 0);
|
||||||
} else {
|
} else {
|
||||||
not_compatible = (FAILURE == compare_function(&compare_result,
|
not_compatible = (FAILURE == compare_function(&compare_result,
|
||||||
&ce->default_properties_table[coliding_prop->offset],
|
&ce->default_properties_table[OBJ_PROP_TO_NUM(coliding_prop->offset)],
|
||||||
&ce->traits[i]->default_properties_table[property_info->offset] TSRMLS_CC))
|
&ce->traits[i]->default_properties_table[OBJ_PROP_TO_NUM(property_info->offset)] TSRMLS_CC))
|
||||||
|| (Z_LVAL(compare_result) != 0);
|
|| (Z_LVAL(compare_result) != 0);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1454,7 +1457,7 @@ static void zend_do_traits_property_binding(zend_class_entry *ce TSRMLS_DC) /* {
|
||||||
if (flags & ZEND_ACC_STATIC) {
|
if (flags & ZEND_ACC_STATIC) {
|
||||||
prop_value = &ce->traits[i]->default_static_members_table[property_info->offset];
|
prop_value = &ce->traits[i]->default_static_members_table[property_info->offset];
|
||||||
} else {
|
} else {
|
||||||
prop_value = &ce->traits[i]->default_properties_table[property_info->offset];
|
prop_value = &ce->traits[i]->default_properties_table[OBJ_PROP_TO_NUM(property_info->offset)];
|
||||||
}
|
}
|
||||||
if (Z_REFCOUNTED_P(prop_value)) Z_ADDREF_P(prop_value);
|
if (Z_REFCOUNTED_P(prop_value)) Z_ADDREF_P(prop_value);
|
||||||
|
|
||||||
|
|
|
@ -658,7 +658,7 @@ ZEND_API ZEND_INI_MH(OnUpdateLong) /* {{{ */
|
||||||
|
|
||||||
p = (zend_long *) (base+(size_t) mh_arg1);
|
p = (zend_long *) (base+(size_t) mh_arg1);
|
||||||
|
|
||||||
*p = zend_atol(new_value->val, new_value->len);
|
*p = zend_atol(new_value->val, (int)new_value->len);
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
@ -674,7 +674,7 @@ ZEND_API ZEND_INI_MH(OnUpdateLongGEZero) /* {{{ */
|
||||||
base = (char *) ts_resource(*((int *) mh_arg2));
|
base = (char *) ts_resource(*((int *) mh_arg2));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
tmp = zend_atol(new_value->val, new_value->len);
|
tmp = zend_atol(new_value->val, (int)new_value->len);
|
||||||
if (tmp < 0) {
|
if (tmp < 0) {
|
||||||
return FAILURE;
|
return FAILURE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,11 @@ int ini_parse(void);
|
||||||
#define ZEND_INI_PARSER_CB (CG(ini_parser_param))->ini_parser_cb
|
#define ZEND_INI_PARSER_CB (CG(ini_parser_param))->ini_parser_cb
|
||||||
#define ZEND_INI_PARSER_ARG (CG(ini_parser_param))->arg
|
#define ZEND_INI_PARSER_ARG (CG(ini_parser_param))->arg
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#define YYMALLOC malloc
|
||||||
|
#define YYFREE free
|
||||||
|
#endif
|
||||||
|
|
||||||
/* {{{ zend_ini_do_op()
|
/* {{{ zend_ini_do_op()
|
||||||
*/
|
*/
|
||||||
static void zend_ini_do_op(char type, zval *result, zval *op1, zval *op2)
|
static void zend_ini_do_op(char type, zval *result, zval *op1, zval *op2)
|
||||||
|
@ -93,8 +98,8 @@ static void zend_ini_init_string(zval *result)
|
||||||
*/
|
*/
|
||||||
static void zend_ini_add_string(zval *result, zval *op1, zval *op2)
|
static void zend_ini_add_string(zval *result, zval *op1, zval *op2)
|
||||||
{
|
{
|
||||||
int op1_len = Z_STRLEN_P(op1);
|
int op1_len = (int)Z_STRLEN_P(op1);
|
||||||
int length = op1_len + Z_STRLEN_P(op2);
|
int length = op1_len + (int)Z_STRLEN_P(op2);
|
||||||
|
|
||||||
ZVAL_NEW_STR(result, zend_string_realloc(Z_STR_P(op1), length, 1));
|
ZVAL_NEW_STR(result, zend_string_realloc(Z_STR_P(op1), length, 1));
|
||||||
memcpy(Z_STRVAL_P(result)+op1_len, Z_STRVAL_P(op2), Z_STRLEN_P(op2));
|
memcpy(Z_STRVAL_P(result)+op1_len, Z_STRVAL_P(op2), Z_STRLEN_P(op2));
|
||||||
|
@ -162,7 +167,7 @@ static void ini_error(const char *msg)
|
||||||
|
|
||||||
currently_parsed_filename = zend_ini_scanner_get_filename(TSRMLS_C);
|
currently_parsed_filename = zend_ini_scanner_get_filename(TSRMLS_C);
|
||||||
if (currently_parsed_filename) {
|
if (currently_parsed_filename) {
|
||||||
error_buf_len = 128 + strlen(msg) + strlen(currently_parsed_filename); /* should be more than enough */
|
error_buf_len = 128 + (int)strlen(msg) + (int)strlen(currently_parsed_filename); /* should be more than enough */
|
||||||
error_buf = (char *) emalloc(error_buf_len);
|
error_buf = (char *) emalloc(error_buf_len);
|
||||||
|
|
||||||
sprintf(error_buf, "%s in %s on line %d\n", msg, currently_parsed_filename, zend_ini_scanner_get_lineno(TSRMLS_C));
|
sprintf(error_buf, "%s in %s on line %d\n", msg, currently_parsed_filename, zend_ini_scanner_get_lineno(TSRMLS_C));
|
||||||
|
|
|
@ -283,7 +283,7 @@ int zend_ini_open_file_for_scanning(zend_file_handle *fh, int scanner_mode TSRML
|
||||||
return FAILURE;
|
return FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
yy_scan_buffer(buf, size TSRMLS_CC);
|
yy_scan_buffer(buf, (unsigned int)size TSRMLS_CC);
|
||||||
|
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -293,7 +293,7 @@ int zend_ini_open_file_for_scanning(zend_file_handle *fh, int scanner_mode TSRML
|
||||||
*/
|
*/
|
||||||
int zend_ini_prepare_string_for_scanning(char *str, int scanner_mode TSRMLS_DC)
|
int zend_ini_prepare_string_for_scanning(char *str, int scanner_mode TSRMLS_DC)
|
||||||
{
|
{
|
||||||
int len = strlen(str);
|
int len = (int)strlen(str);
|
||||||
|
|
||||||
if (init_ini_scanner(scanner_mode, NULL TSRMLS_CC) == FAILURE) {
|
if (init_ini_scanner(scanner_mode, NULL TSRMLS_CC) == FAILURE) {
|
||||||
return FAILURE;
|
return FAILURE;
|
||||||
|
|
|
@ -281,7 +281,7 @@ int zend_ini_open_file_for_scanning(zend_file_handle *fh, int scanner_mode TSRML
|
||||||
return FAILURE;
|
return FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
yy_scan_buffer(buf, size TSRMLS_CC);
|
yy_scan_buffer(buf, (unsigned int)size TSRMLS_CC);
|
||||||
|
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -291,7 +291,7 @@ int zend_ini_open_file_for_scanning(zend_file_handle *fh, int scanner_mode TSRML
|
||||||
*/
|
*/
|
||||||
int zend_ini_prepare_string_for_scanning(char *str, int scanner_mode TSRMLS_DC)
|
int zend_ini_prepare_string_for_scanning(char *str, int scanner_mode TSRMLS_DC)
|
||||||
{
|
{
|
||||||
int len = strlen(str);
|
int len = (int)strlen(str);
|
||||||
|
|
||||||
if (init_ini_scanner(scanner_mode, NULL TSRMLS_CC) == FAILURE) {
|
if (init_ini_scanner(scanner_mode, NULL TSRMLS_CC) == FAILURE) {
|
||||||
return FAILURE;
|
return FAILURE;
|
||||||
|
|
|
@ -31,7 +31,7 @@ ZEND_API zend_class_entry *zend_ce_serializable;
|
||||||
|
|
||||||
/* {{{ zend_call_method
|
/* {{{ zend_call_method
|
||||||
Only returns the returned zval if retval_ptr != NULL */
|
Only returns the returned zval if retval_ptr != NULL */
|
||||||
ZEND_API zval* zend_call_method(zval *object, zend_class_entry *obj_ce, zend_function **fn_proxy, const char *function_name, int function_name_len, zval *retval_ptr, int param_count, zval* arg1, zval* arg2 TSRMLS_DC)
|
ZEND_API zval* zend_call_method(zval *object, zend_class_entry *obj_ce, zend_function **fn_proxy, const char *function_name, size_t function_name_len, zval *retval_ptr, int param_count, zval* arg1, zval* arg2 TSRMLS_DC)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
zend_fcall_info fci;
|
zend_fcall_info fci;
|
||||||
|
|
|
@ -38,7 +38,7 @@ typedef struct _zend_user_iterator {
|
||||||
zval value;
|
zval value;
|
||||||
} zend_user_iterator;
|
} zend_user_iterator;
|
||||||
|
|
||||||
ZEND_API zval* zend_call_method(zval *object_pp, zend_class_entry *obj_ce, zend_function **fn_proxy, const char *function_name, int function_name_len, zval *retval, int param_count, zval* arg1, zval* arg2 TSRMLS_DC);
|
ZEND_API zval* zend_call_method(zval *object_pp, zend_class_entry *obj_ce, zend_function **fn_proxy, const char *function_name, size_t function_name_len, zval *retval, int param_count, zval* arg1, zval* arg2 TSRMLS_DC);
|
||||||
|
|
||||||
#define zend_call_method_with_0_params(obj, obj_ce, fn_proxy, function_name, retval) \
|
#define zend_call_method_with_0_params(obj, obj_ce, fn_proxy, function_name, retval) \
|
||||||
zend_call_method(obj, obj_ce, fn_proxy, function_name, sizeof(function_name)-1, retval, 0, NULL, NULL TSRMLS_CC)
|
zend_call_method(obj, obj_ce, fn_proxy, function_name, sizeof(function_name)-1, retval, 0, NULL, NULL TSRMLS_CC)
|
||||||
|
|
|
@ -43,6 +43,11 @@ static YYSIZE_T zend_yytnamerr(char*, const char*);
|
||||||
#define YYERROR_VERBOSE
|
#define YYERROR_VERBOSE
|
||||||
#define YYSTYPE zend_parser_stack_elem
|
#define YYSTYPE zend_parser_stack_elem
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#define YYMALLOC malloc
|
||||||
|
#define YYFREE free
|
||||||
|
#endif
|
||||||
|
|
||||||
%}
|
%}
|
||||||
|
|
||||||
%pure_parser
|
%pure_parser
|
||||||
|
@ -1183,7 +1188,7 @@ static YYSIZE_T zend_yytnamerr(char *yyres, const char *yystr)
|
||||||
|
|
||||||
str = LANG_SCNG(yy_text);
|
str = LANG_SCNG(yy_text);
|
||||||
end = memchr(str, '\n', LANG_SCNG(yy_leng));
|
end = memchr(str, '\n', LANG_SCNG(yy_leng));
|
||||||
yystr_len = yystrlen(yystr);
|
yystr_len = (unsigned int)yystrlen(yystr);
|
||||||
|
|
||||||
if ((tok1 = memchr(yystr, '(', yystr_len)) != NULL
|
if ((tok1 = memchr(yystr, '(', yystr_len)) != NULL
|
||||||
&& (tok2 = zend_memrchr(yystr, ')', yystr_len)) != NULL) {
|
&& (tok2 = zend_memrchr(yystr, ')', yystr_len)) != NULL) {
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -284,7 +284,8 @@ static const zend_encoding *zend_multibyte_detect_utf_encoding(const unsigned ch
|
||||||
|
|
||||||
/* utf-16 or utf-32? */
|
/* utf-16 or utf-32? */
|
||||||
p = script;
|
p = script;
|
||||||
while ((p-script) < script_size) {
|
assert(p >= script);
|
||||||
|
while ((size_t)(p-script) < script_size) {
|
||||||
p = memchr(p, 0, script_size-(p-script)-2);
|
p = memchr(p, 0, script_size-(p-script)-2);
|
||||||
if (!p) {
|
if (!p) {
|
||||||
break;
|
break;
|
||||||
|
@ -300,7 +301,8 @@ static const zend_encoding *zend_multibyte_detect_utf_encoding(const unsigned ch
|
||||||
|
|
||||||
/* BE or LE? */
|
/* BE or LE? */
|
||||||
p = script;
|
p = script;
|
||||||
while ((p-script) < script_size) {
|
assert(p >= script);
|
||||||
|
while ((size_t)(p-script) < script_size) {
|
||||||
if (*p == '\0' && *(p+wchar_size-1) != '\0') {
|
if (*p == '\0' && *(p+wchar_size-1) != '\0') {
|
||||||
/* BE */
|
/* BE */
|
||||||
le = 0;
|
le = 0;
|
||||||
|
@ -520,7 +522,7 @@ ZEND_API int open_file_for_scanning(zend_file_handle *file_handle TSRMLS_DC)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SCNG(yy_start) = (unsigned char *)buf - offset;
|
SCNG(yy_start) = (unsigned char *)buf - offset;
|
||||||
yy_scan_buffer(buf, size TSRMLS_CC);
|
yy_scan_buffer(buf, (unsigned int)size TSRMLS_CC);
|
||||||
} else {
|
} else {
|
||||||
zend_error_noreturn(E_COMPILE_ERROR, "zend_stream_mmap() failed");
|
zend_error_noreturn(E_COMPILE_ERROR, "zend_stream_mmap() failed");
|
||||||
}
|
}
|
||||||
|
@ -681,7 +683,7 @@ ZEND_API int zend_prepare_string_for_scanning(zval *str, char *filename TSRMLS_D
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
yy_scan_buffer(buf, size TSRMLS_CC);
|
yy_scan_buffer(buf, (unsigned int)size TSRMLS_CC);
|
||||||
|
|
||||||
new_compiled_filename = zend_string_init(filename, strlen(filename), 0);
|
new_compiled_filename = zend_string_init(filename, strlen(filename), 0);
|
||||||
zend_set_compiled_filename(new_compiled_filename TSRMLS_CC);
|
zend_set_compiled_filename(new_compiled_filename TSRMLS_CC);
|
||||||
|
@ -1656,7 +1658,7 @@ inline_char_handler:
|
||||||
yyleng = YYCURSOR - SCNG(yy_text);
|
yyleng = YYCURSOR - SCNG(yy_text);
|
||||||
|
|
||||||
if (SCNG(output_filter)) {
|
if (SCNG(output_filter)) {
|
||||||
int readsize;
|
size_t readsize;
|
||||||
char *s = NULL;
|
char *s = NULL;
|
||||||
size_t sz = 0;
|
size_t sz = 0;
|
||||||
// TODO: avoid reallocation ???
|
// TODO: avoid reallocation ???
|
||||||
|
|
|
@ -243,7 +243,7 @@ ZEND_API void zend_llist_apply_with_arguments(zend_llist *l, llist_apply_with_ar
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ZEND_API int zend_llist_count(zend_llist *l)
|
ZEND_API size_t zend_llist_count(zend_llist *l)
|
||||||
{
|
{
|
||||||
return l->count;
|
return l->count;
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,7 @@ ZEND_API void zend_llist_apply(zend_llist *l, llist_apply_func_t func TSRMLS_DC)
|
||||||
ZEND_API void zend_llist_apply_with_del(zend_llist *l, int (*func)(void *data));
|
ZEND_API void zend_llist_apply_with_del(zend_llist *l, int (*func)(void *data));
|
||||||
ZEND_API void zend_llist_apply_with_argument(zend_llist *l, llist_apply_with_arg_func_t func, void *arg TSRMLS_DC);
|
ZEND_API void zend_llist_apply_with_argument(zend_llist *l, llist_apply_with_arg_func_t func, void *arg TSRMLS_DC);
|
||||||
ZEND_API void zend_llist_apply_with_arguments(zend_llist *l, llist_apply_with_args_func_t func TSRMLS_DC, int num_args, ...);
|
ZEND_API void zend_llist_apply_with_arguments(zend_llist *l, llist_apply_with_args_func_t func TSRMLS_DC, int num_args, ...);
|
||||||
ZEND_API int zend_llist_count(zend_llist *l);
|
ZEND_API size_t zend_llist_count(zend_llist *l);
|
||||||
ZEND_API void zend_llist_sort(zend_llist *l, llist_compare_func_t comp_func TSRMLS_DC);
|
ZEND_API void zend_llist_sort(zend_llist *l, llist_compare_func_t comp_func TSRMLS_DC);
|
||||||
|
|
||||||
/* traversal */
|
/* traversal */
|
||||||
|
|
|
@ -80,11 +80,10 @@ ZEND_API void rebuild_object_properties(zend_object *zobj) /* {{{ */
|
||||||
ZEND_HASH_FOREACH_PTR(&ce->properties_info, prop_info) {
|
ZEND_HASH_FOREACH_PTR(&ce->properties_info, prop_info) {
|
||||||
if (/*prop_info->ce == ce &&*/
|
if (/*prop_info->ce == ce &&*/
|
||||||
(prop_info->flags & ZEND_ACC_STATIC) == 0 &&
|
(prop_info->flags & ZEND_ACC_STATIC) == 0 &&
|
||||||
prop_info->offset >= 0 &&
|
Z_TYPE_P(OBJ_PROP(zobj, prop_info->offset)) != IS_UNDEF) {
|
||||||
Z_TYPE(zobj->properties_table[prop_info->offset]) != IS_UNDEF) {
|
|
||||||
zval zv;
|
zval zv;
|
||||||
|
|
||||||
ZVAL_INDIRECT(&zv, &zobj->properties_table[prop_info->offset]);
|
ZVAL_INDIRECT(&zv, OBJ_PROP(zobj, prop_info->offset));
|
||||||
zend_hash_add_new(zobj->properties, prop_info->name, &zv);
|
zend_hash_add_new(zobj->properties, prop_info->name, &zv);
|
||||||
}
|
}
|
||||||
} ZEND_HASH_FOREACH_END();
|
} ZEND_HASH_FOREACH_END();
|
||||||
|
@ -94,11 +93,10 @@ ZEND_API void rebuild_object_properties(zend_object *zobj) /* {{{ */
|
||||||
if (prop_info->ce == ce &&
|
if (prop_info->ce == ce &&
|
||||||
(prop_info->flags & ZEND_ACC_STATIC) == 0 &&
|
(prop_info->flags & ZEND_ACC_STATIC) == 0 &&
|
||||||
(prop_info->flags & ZEND_ACC_PRIVATE) != 0 &&
|
(prop_info->flags & ZEND_ACC_PRIVATE) != 0 &&
|
||||||
prop_info->offset >= 0 &&
|
Z_TYPE_P(OBJ_PROP(zobj, prop_info->offset)) != IS_UNDEF) {
|
||||||
Z_TYPE(zobj->properties_table[prop_info->offset]) != IS_UNDEF) {
|
|
||||||
zval zv;
|
zval zv;
|
||||||
|
|
||||||
ZVAL_INDIRECT(&zv, &zobj->properties_table[prop_info->offset]);
|
ZVAL_INDIRECT(&zv, OBJ_PROP(zobj, prop_info->offset));
|
||||||
zend_hash_add(zobj->properties, prop_info->name, &zv);
|
zend_hash_add(zobj->properties, prop_info->name, &zv);
|
||||||
}
|
}
|
||||||
} ZEND_HASH_FOREACH_END();
|
} ZEND_HASH_FOREACH_END();
|
||||||
|
@ -288,7 +286,7 @@ static zend_always_inline zend_bool is_derived_class(zend_class_entry *child_cla
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
static zend_always_inline zend_property_info *zend_get_property_info_quick(zend_class_entry *ce, zend_string *member, int silent, void **cache_slot TSRMLS_DC) /* {{{ */
|
static zend_always_inline zend_property_info *zend_get_property_info_quick(zend_class_entry *ce, zend_string *member, int silent, int allow_static, void **cache_slot TSRMLS_DC) /* {{{ */
|
||||||
{
|
{
|
||||||
zval *zv;
|
zval *zv;
|
||||||
zend_property_info *property_info = NULL;
|
zend_property_info *property_info = NULL;
|
||||||
|
@ -324,9 +322,14 @@ static zend_always_inline zend_property_info *zend_get_property_info_quick(zend_
|
||||||
if (EXPECTED(zend_verify_property_access(property_info, ce TSRMLS_CC) != 0)) {
|
if (EXPECTED(zend_verify_property_access(property_info, ce TSRMLS_CC) != 0)) {
|
||||||
if (UNEXPECTED(!(flags & ZEND_ACC_CHANGED))
|
if (UNEXPECTED(!(flags & ZEND_ACC_CHANGED))
|
||||||
|| UNEXPECTED((flags & ZEND_ACC_PRIVATE))) {
|
|| UNEXPECTED((flags & ZEND_ACC_PRIVATE))) {
|
||||||
if (UNEXPECTED((flags & ZEND_ACC_STATIC) != 0) && !silent) {
|
if (UNEXPECTED((flags & ZEND_ACC_STATIC) != 0)) {
|
||||||
|
if (!silent) {
|
||||||
zend_error(E_STRICT, "Accessing static property %s::$%s as non static", ce->name->val, member->val);
|
zend_error(E_STRICT, "Accessing static property %s::$%s as non static", ce->name->val, member->val);
|
||||||
}
|
}
|
||||||
|
if (!allow_static) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -342,7 +345,9 @@ static zend_always_inline zend_property_info *zend_get_property_info_quick(zend_
|
||||||
&& (zv = zend_hash_find(&EG(scope)->properties_info, member)) != NULL
|
&& (zv = zend_hash_find(&EG(scope)->properties_info, member)) != NULL
|
||||||
&& ((zend_property_info*)Z_PTR_P(zv))->flags & ZEND_ACC_PRIVATE) {
|
&& ((zend_property_info*)Z_PTR_P(zv))->flags & ZEND_ACC_PRIVATE) {
|
||||||
property_info = (zend_property_info*)Z_PTR_P(zv);
|
property_info = (zend_property_info*)Z_PTR_P(zv);
|
||||||
goto exit;
|
if (!allow_static && UNEXPECTED((property_info->flags & ZEND_ACC_STATIC) != 0)) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
} else if (UNEXPECTED(property_info == NULL)) {
|
} else if (UNEXPECTED(property_info == NULL)) {
|
||||||
exit_dynamic:
|
exit_dynamic:
|
||||||
if (cache_slot) {
|
if (cache_slot) {
|
||||||
|
@ -354,9 +359,6 @@ exit_dynamic:
|
||||||
if (!silent) {
|
if (!silent) {
|
||||||
zend_error_noreturn(E_ERROR, "Cannot access %s property %s::$%s", zend_visibility_string(flags), ce->name->val, member->val);
|
zend_error_noreturn(E_ERROR, "Cannot access %s property %s::$%s", zend_visibility_string(flags), ce->name->val, member->val);
|
||||||
}
|
}
|
||||||
if (cache_slot) {
|
|
||||||
CACHE_POLYMORPHIC_PTR_EX(cache_slot, ce, ZEND_WRONG_PROPERTY_INFO);
|
|
||||||
}
|
|
||||||
return ZEND_WRONG_PROPERTY_INFO;
|
return ZEND_WRONG_PROPERTY_INFO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -370,7 +372,7 @@ exit:
|
||||||
|
|
||||||
ZEND_API zend_property_info *zend_get_property_info(zend_class_entry *ce, zend_string *member, int silent TSRMLS_DC) /* {{{ */
|
ZEND_API zend_property_info *zend_get_property_info(zend_class_entry *ce, zend_string *member, int silent TSRMLS_DC) /* {{{ */
|
||||||
{
|
{
|
||||||
return zend_get_property_info_quick(ce, member, silent, NULL TSRMLS_CC);
|
return zend_get_property_info_quick(ce, member, silent, 1, NULL TSRMLS_CC);
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
|
@ -388,7 +390,7 @@ ZEND_API int zend_check_property_access(zend_object *zobj, zend_string *prop_inf
|
||||||
} else {
|
} else {
|
||||||
member = zend_string_copy(prop_info_name);
|
member = zend_string_copy(prop_info_name);
|
||||||
}
|
}
|
||||||
property_info = zend_get_property_info_quick(zobj->ce, member, 1, NULL TSRMLS_CC);
|
property_info = zend_get_property_info_quick(zobj->ce, member, 1, 1, NULL TSRMLS_CC);
|
||||||
zend_string_release(member);
|
zend_string_release(member);
|
||||||
if (property_info == NULL) {
|
if (property_info == NULL) {
|
||||||
/* undefined public property */
|
/* undefined public property */
|
||||||
|
@ -451,13 +453,11 @@ zval *zend_std_read_property(zval *object, zval *member, int type, void **cache_
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* make zend_get_property_info silent if we have getter - we may want to use it */
|
/* make zend_get_property_info silent if we have getter - we may want to use it */
|
||||||
property_info = zend_get_property_info_quick(zobj->ce, Z_STR_P(member), (type == BP_VAR_IS) || (zobj->ce->__get != NULL), cache_slot TSRMLS_CC);
|
property_info = zend_get_property_info_quick(zobj->ce, Z_STR_P(member), (type == BP_VAR_IS) || (zobj->ce->__get != NULL), 0, cache_slot TSRMLS_CC);
|
||||||
|
|
||||||
if (EXPECTED(property_info != ZEND_WRONG_PROPERTY_INFO)) {
|
if (EXPECTED(property_info != ZEND_WRONG_PROPERTY_INFO)) {
|
||||||
if (EXPECTED(property_info != NULL) &&
|
if (EXPECTED(property_info != NULL)) {
|
||||||
EXPECTED((property_info->flags & ZEND_ACC_STATIC) == 0)) {
|
retval = OBJ_PROP(zobj, property_info->offset);
|
||||||
|
|
||||||
retval = &zobj->properties_table[property_info->offset];
|
|
||||||
if (EXPECTED(Z_TYPE_P(retval) != IS_UNDEF)) {
|
if (EXPECTED(Z_TYPE_P(retval) != IS_UNDEF)) {
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -534,13 +534,11 @@ ZEND_API void zend_std_write_property(zval *object, zval *member, zval *value, v
|
||||||
cache_slot = NULL;
|
cache_slot = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
property_info = zend_get_property_info_quick(zobj->ce, Z_STR_P(member), (zobj->ce->__set != NULL), cache_slot TSRMLS_CC);
|
property_info = zend_get_property_info_quick(zobj->ce, Z_STR_P(member), (zobj->ce->__set != NULL), 0, cache_slot TSRMLS_CC);
|
||||||
|
|
||||||
if (EXPECTED(property_info != ZEND_WRONG_PROPERTY_INFO)) {
|
if (EXPECTED(property_info != ZEND_WRONG_PROPERTY_INFO)) {
|
||||||
if (EXPECTED(property_info != NULL) &&
|
if (EXPECTED(property_info != NULL)) {
|
||||||
EXPECTED((property_info->flags & ZEND_ACC_STATIC) == 0)) {
|
variable_ptr = OBJ_PROP(zobj, property_info->offset);
|
||||||
|
|
||||||
variable_ptr = &zobj->properties_table[property_info->offset];
|
|
||||||
if (Z_TYPE_P(variable_ptr) != IS_UNDEF) {
|
if (Z_TYPE_P(variable_ptr) != IS_UNDEF) {
|
||||||
goto found;
|
goto found;
|
||||||
}
|
}
|
||||||
|
@ -638,12 +636,12 @@ write_std_property:
|
||||||
if (EXPECTED(property_info != NULL) &&
|
if (EXPECTED(property_info != NULL) &&
|
||||||
EXPECTED((property_info->flags & ZEND_ACC_STATIC) == 0)) {
|
EXPECTED((property_info->flags & ZEND_ACC_STATIC) == 0)) {
|
||||||
|
|
||||||
ZVAL_COPY_VALUE(&zobj->properties_table[property_info->offset], value);
|
ZVAL_COPY_VALUE(OBJ_PROP(zobj, property_info->offset), value);
|
||||||
} else {
|
} else {
|
||||||
if (!zobj->properties) {
|
if (!zobj->properties) {
|
||||||
rebuild_object_properties(zobj);
|
rebuild_object_properties(zobj);
|
||||||
}
|
}
|
||||||
zend_hash_update(zobj->properties, Z_STR_P(member), value);
|
zend_hash_add_new(zobj->properties, Z_STR_P(member), value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -754,13 +752,11 @@ static zval *zend_std_get_property_ptr_ptr(zval *object, zval *member, int type,
|
||||||
fprintf(stderr, "Ptr object #%d property: %s\n", Z_OBJ_HANDLE_P(object), name->val);
|
fprintf(stderr, "Ptr object #%d property: %s\n", Z_OBJ_HANDLE_P(object), name->val);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
property_info = zend_get_property_info_quick(zobj->ce, name, (zobj->ce->__get != NULL), cache_slot TSRMLS_CC);
|
property_info = zend_get_property_info_quick(zobj->ce, name, (zobj->ce->__get != NULL), 0, cache_slot TSRMLS_CC);
|
||||||
|
|
||||||
if (EXPECTED(property_info != ZEND_WRONG_PROPERTY_INFO)) {
|
if (EXPECTED(property_info != ZEND_WRONG_PROPERTY_INFO)) {
|
||||||
if (EXPECTED(property_info != NULL) &&
|
if (EXPECTED(property_info != NULL)) {
|
||||||
EXPECTED((property_info->flags & ZEND_ACC_STATIC) == 0)) {
|
retval = OBJ_PROP(zobj, property_info->offset);
|
||||||
|
|
||||||
retval = &zobj->properties_table[property_info->offset];
|
|
||||||
if (UNEXPECTED(Z_TYPE_P(retval) == IS_UNDEF)) {
|
if (UNEXPECTED(Z_TYPE_P(retval) == IS_UNDEF)) {
|
||||||
if (EXPECTED(!zobj->ce->__get) ||
|
if (EXPECTED(!zobj->ce->__get) ||
|
||||||
UNEXPECTED((*zend_get_property_guard(zobj, name)) & IN_GET)) {
|
UNEXPECTED((*zend_get_property_guard(zobj, name)) & IN_GET)) {
|
||||||
|
@ -816,15 +812,15 @@ static void zend_std_unset_property(zval *object, zval *member, void **cache_slo
|
||||||
cache_slot = NULL;
|
cache_slot = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
property_info = zend_get_property_info_quick(zobj->ce, Z_STR_P(member), (zobj->ce->__unset != NULL), cache_slot TSRMLS_CC);
|
property_info = zend_get_property_info_quick(zobj->ce, Z_STR_P(member), (zobj->ce->__unset != NULL), 0, cache_slot TSRMLS_CC);
|
||||||
|
|
||||||
if (EXPECTED(property_info != ZEND_WRONG_PROPERTY_INFO)) {
|
if (EXPECTED(property_info != ZEND_WRONG_PROPERTY_INFO)) {
|
||||||
if (EXPECTED(property_info != NULL) &&
|
if (EXPECTED(property_info != NULL)) {
|
||||||
EXPECTED((property_info->flags & ZEND_ACC_STATIC) == 0)) {
|
zval *slot = OBJ_PROP(zobj, property_info->offset);
|
||||||
|
|
||||||
if (Z_TYPE(zobj->properties_table[property_info->offset]) != IS_UNDEF) {
|
if (Z_TYPE_P(slot) != IS_UNDEF) {
|
||||||
zval_ptr_dtor(&zobj->properties_table[property_info->offset]);
|
zval_ptr_dtor(slot);
|
||||||
ZVAL_UNDEF(&zobj->properties_table[property_info->offset]);
|
ZVAL_UNDEF(slot);
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
} else if (EXPECTED(zobj->properties != NULL) &&
|
} else if (EXPECTED(zobj->properties != NULL) &&
|
||||||
|
@ -1413,13 +1409,11 @@ static int zend_std_has_property(zval *object, zval *member, int has_set_exists,
|
||||||
cache_slot = NULL;
|
cache_slot = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
property_info = zend_get_property_info_quick(zobj->ce, Z_STR_P(member), 1, cache_slot TSRMLS_CC);
|
property_info = zend_get_property_info_quick(zobj->ce, Z_STR_P(member), 1, 0, cache_slot TSRMLS_CC);
|
||||||
|
|
||||||
if (EXPECTED(property_info != ZEND_WRONG_PROPERTY_INFO)) {
|
if (EXPECTED(property_info != ZEND_WRONG_PROPERTY_INFO)) {
|
||||||
if (EXPECTED(property_info != NULL) &&
|
if (EXPECTED(property_info != NULL)) {
|
||||||
EXPECTED((property_info->flags & ZEND_ACC_STATIC) == 0)) {
|
value = OBJ_PROP(zobj, property_info->offset);
|
||||||
|
|
||||||
value = &zobj->properties_table[property_info->offset];
|
|
||||||
if (Z_TYPE_P(value) != IS_UNDEF) {
|
if (Z_TYPE_P(value) != IS_UNDEF) {
|
||||||
goto found;
|
goto found;
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,7 +84,7 @@ ZEND_API int zend_atoi(const char *str, int str_len) /* {{{ */
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
if (!str_len) {
|
if (!str_len) {
|
||||||
str_len = strlen(str);
|
str_len = (int)strlen(str);
|
||||||
}
|
}
|
||||||
retval = ZEND_STRTOL(str, NULL, 0);
|
retval = ZEND_STRTOL(str, NULL, 0);
|
||||||
if (str_len>0) {
|
if (str_len>0) {
|
||||||
|
@ -112,7 +112,7 @@ ZEND_API zend_long zend_atol(const char *str, int str_len) /* {{{ */
|
||||||
zend_long retval;
|
zend_long retval;
|
||||||
|
|
||||||
if (!str_len) {
|
if (!str_len) {
|
||||||
str_len = strlen(str);
|
str_len = (int)strlen(str);
|
||||||
}
|
}
|
||||||
retval = ZEND_STRTOL(str, NULL, 0);
|
retval = ZEND_STRTOL(str, NULL, 0);
|
||||||
if (str_len>0) {
|
if (str_len>0) {
|
||||||
|
|
|
@ -74,6 +74,10 @@
|
||||||
# include <alloca.h>
|
# include <alloca.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(ZEND_WIN32)
|
||||||
|
#include <intrin.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Only use this macro if you know for sure that all of the switches values
|
/* Only use this macro if you know for sure that all of the switches values
|
||||||
are covered by its case statements */
|
are covered by its case statements */
|
||||||
#if ZEND_DEBUG
|
#if ZEND_DEBUG
|
||||||
|
@ -196,8 +200,10 @@ char *alloca();
|
||||||
|
|
||||||
#if defined(__GNUC__) && ZEND_GCC_VERSION >= 3004 && defined(__i386__)
|
#if defined(__GNUC__) && ZEND_GCC_VERSION >= 3004 && defined(__i386__)
|
||||||
# define ZEND_FASTCALL __attribute__((fastcall))
|
# define ZEND_FASTCALL __attribute__((fastcall))
|
||||||
#elif defined(_MSC_VER) && defined(_M_IX86)
|
#elif defined(_MSC_VER) && defined(_M_IX86) && _MSC_VER <= 1700
|
||||||
# define ZEND_FASTCALL __fastcall
|
# define ZEND_FASTCALL __fastcall
|
||||||
|
#elif defined(_MSC_VER) && _MSC_VER >= 1800
|
||||||
|
# define ZEND_FASTCALL __vectorcall
|
||||||
#else
|
#else
|
||||||
# define ZEND_FASTCALL
|
# define ZEND_FASTCALL
|
||||||
#endif
|
#endif
|
||||||
|
@ -388,6 +394,13 @@ char *alloca();
|
||||||
#define ZEND_SECURE_ZERO(var, size) memset((var), 0, (size))
|
#define ZEND_SECURE_ZERO(var, size) memset((var), 0, (size))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* This check should only be used on network socket, not file descriptors */
|
||||||
|
#ifdef ZEND_WIN32
|
||||||
|
#define ZEND_VALID_SOCKET(sock) (INVALID_SOCKET != (sock))
|
||||||
|
#else
|
||||||
|
#define ZEND_VALID_SOCKET(sock) ((sock) >= 0)
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* ZEND_PORTABILITY_H */
|
#endif /* ZEND_PORTABILITY_H */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -333,7 +333,7 @@ ZEND_API int zend_ts_hash_rehash(TsHashTable *ht)
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
ZEND_API zval *zend_ts_hash_str_find(TsHashTable *ht, const char *key, int len)
|
ZEND_API zval *zend_ts_hash_str_find(TsHashTable *ht, const char *key, size_t len)
|
||||||
{
|
{
|
||||||
zval *retval;
|
zval *retval;
|
||||||
|
|
||||||
|
@ -344,7 +344,7 @@ ZEND_API zval *zend_ts_hash_str_find(TsHashTable *ht, const char *key, int len)
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
ZEND_API zval *_zend_ts_hash_str_update(TsHashTable *ht, const char *key, int len, zval *pData ZEND_FILE_LINE_DC)
|
ZEND_API zval *_zend_ts_hash_str_update(TsHashTable *ht, const char *key, size_t len, zval *pData ZEND_FILE_LINE_DC)
|
||||||
{
|
{
|
||||||
zval *retval;
|
zval *retval;
|
||||||
|
|
||||||
|
@ -355,7 +355,7 @@ ZEND_API zval *_zend_ts_hash_str_update(TsHashTable *ht, const char *key, int le
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
ZEND_API zval *_zend_ts_hash_str_add(TsHashTable *ht, const char *key, int len, zval *pData ZEND_FILE_LINE_DC)
|
ZEND_API zval *_zend_ts_hash_str_add(TsHashTable *ht, const char *key, size_t len, zval *pData ZEND_FILE_LINE_DC)
|
||||||
{
|
{
|
||||||
zval *retval;
|
zval *retval;
|
||||||
|
|
||||||
|
|
|
@ -102,16 +102,16 @@ void zend_ts_hash_display_pListTail(TsHashTable *ht);
|
||||||
void zend_ts_hash_display(TsHashTable *ht);
|
void zend_ts_hash_display(TsHashTable *ht);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ZEND_API zval *zend_ts_hash_str_find(TsHashTable *ht, const char *key, int len);
|
ZEND_API zval *zend_ts_hash_str_find(TsHashTable *ht, const char *key, size_t len);
|
||||||
ZEND_API zval *_zend_ts_hash_str_update(TsHashTable *ht, const char *key, int len, zval *pData ZEND_FILE_LINE_DC);
|
ZEND_API zval *_zend_ts_hash_str_update(TsHashTable *ht, const char *key, size_t len, zval *pData ZEND_FILE_LINE_DC);
|
||||||
ZEND_API zval *_zend_ts_hash_str_add(TsHashTable *ht, const char *key, int len, zval *pData ZEND_FILE_LINE_DC);
|
ZEND_API zval *_zend_ts_hash_str_add(TsHashTable *ht, const char *key, size_t len, zval *pData ZEND_FILE_LINE_DC);
|
||||||
|
|
||||||
#define zend_ts_hash_str_update(ht, key, len, pData) \
|
#define zend_ts_hash_str_update(ht, key, len, pData) \
|
||||||
_zend_ts_hash_str_update(ht, key, len, pData ZEND_FILE_LINE_CC)
|
_zend_ts_hash_str_update(ht, key, len, pData ZEND_FILE_LINE_CC)
|
||||||
#define zend_ts_hash_str_add(ht, key, len, pData) \
|
#define zend_ts_hash_str_add(ht, key, len, pData) \
|
||||||
_zend_ts_hash_str_add(ht, key, len, pData ZEND_FILE_LINE_CC)
|
_zend_ts_hash_str_add(ht, key, len, pData ZEND_FILE_LINE_CC)
|
||||||
|
|
||||||
static zend_always_inline void *zend_ts_hash_str_find_ptr(TsHashTable *ht, const char *str, int len)
|
static zend_always_inline void *zend_ts_hash_str_find_ptr(TsHashTable *ht, const char *str, size_t len)
|
||||||
{
|
{
|
||||||
zval *zv;
|
zval *zv;
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ static zend_always_inline void *zend_ts_hash_str_find_ptr(TsHashTable *ht, const
|
||||||
return zv ? Z_PTR_P(zv) : NULL;
|
return zv ? Z_PTR_P(zv) : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static zend_always_inline void *zend_ts_hash_str_update_ptr(TsHashTable *ht, const char *str, int len, void *pData)
|
static zend_always_inline void *zend_ts_hash_str_update_ptr(TsHashTable *ht, const char *str, size_t len, void *pData)
|
||||||
{
|
{
|
||||||
zval tmp, *zv;
|
zval tmp, *zv;
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ static zend_always_inline void *zend_ts_hash_str_update_ptr(TsHashTable *ht, con
|
||||||
return zv ? Z_PTR_P(zv) : NULL;
|
return zv ? Z_PTR_P(zv) : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static zend_always_inline void *zend_ts_hash_str_add_ptr(TsHashTable *ht, const char *str, int len, void *pData)
|
static zend_always_inline void *zend_ts_hash_str_add_ptr(TsHashTable *ht, const char *str, size_t len, void *pData)
|
||||||
{
|
{
|
||||||
zval tmp, *zv;
|
zval tmp, *zv;
|
||||||
|
|
||||||
|
|
|
@ -145,9 +145,9 @@ struct _zend_string {
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct _Bucket {
|
typedef struct _Bucket {
|
||||||
|
zval val;
|
||||||
zend_ulong h; /* hash value (or numeric index) */
|
zend_ulong h; /* hash value (or numeric index) */
|
||||||
zend_string *key; /* string key or NULL for numerics */
|
zend_string *key; /* string key or NULL for numerics */
|
||||||
zval val;
|
|
||||||
} Bucket;
|
} Bucket;
|
||||||
|
|
||||||
typedef struct _HashTable {
|
typedef struct _HashTable {
|
||||||
|
|
|
@ -347,7 +347,7 @@ CWD_API int php_sys_stat_ex(const char *path, zend_stat_t *buf, int lstat) /* {{
|
||||||
/* File is a reparse point. Get the target */
|
/* File is a reparse point. Get the target */
|
||||||
HANDLE hLink = NULL;
|
HANDLE hLink = NULL;
|
||||||
REPARSE_DATA_BUFFER * pbuffer;
|
REPARSE_DATA_BUFFER * pbuffer;
|
||||||
unsigned int retlength = 0;
|
DWORD retlength = 0;
|
||||||
|
|
||||||
hLink = CreateFile(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_FLAG_OPEN_REPARSE_POINT|FILE_FLAG_BACKUP_SEMANTICS, NULL);
|
hLink = CreateFile(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_FLAG_OPEN_REPARSE_POINT|FILE_FLAG_BACKUP_SEMANTICS, NULL);
|
||||||
if(hLink == INVALID_HANDLE_VALUE) {
|
if(hLink == INVALID_HANDLE_VALUE) {
|
||||||
|
@ -898,7 +898,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
|
||||||
/* File is a reparse point. Get the target */
|
/* File is a reparse point. Get the target */
|
||||||
HANDLE hLink = NULL;
|
HANDLE hLink = NULL;
|
||||||
REPARSE_DATA_BUFFER * pbuffer;
|
REPARSE_DATA_BUFFER * pbuffer;
|
||||||
unsigned int retlength = 0;
|
DWORD retlength = 0;
|
||||||
int bufindex = 0, isabsolute = 0;
|
int bufindex = 0, isabsolute = 0;
|
||||||
wchar_t * reparsetarget;
|
wchar_t * reparsetarget;
|
||||||
BOOL isVolume = FALSE;
|
BOOL isVolume = FALSE;
|
||||||
|
@ -1394,7 +1394,7 @@ CWD_API int virtual_chdir(const char *path TSRMLS_DC) /* {{{ */
|
||||||
|
|
||||||
CWD_API int virtual_chdir_file(const char *path, int (*p_chdir)(const char *path TSRMLS_DC) TSRMLS_DC) /* {{{ */
|
CWD_API int virtual_chdir_file(const char *path, int (*p_chdir)(const char *path TSRMLS_DC) TSRMLS_DC) /* {{{ */
|
||||||
{
|
{
|
||||||
size_t length = strlen(path);
|
int length = (int)strlen(path);
|
||||||
char *temp;
|
char *temp;
|
||||||
int retval;
|
int retval;
|
||||||
ALLOCA_FLAG(use_heap)
|
ALLOCA_FLAG(use_heap)
|
||||||
|
@ -1540,55 +1540,6 @@ CWD_API int virtual_access(const char *pathname, int mode TSRMLS_DC) /* {{{ */
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
#if HAVE_UTIME
|
#if HAVE_UTIME
|
||||||
#ifdef TSRM_WIN32
|
|
||||||
static void UnixTimeToFileTime(time_t t, LPFILETIME pft) /* {{{ */
|
|
||||||
{
|
|
||||||
// Note that LONGLONG is a 64-bit value
|
|
||||||
LONGLONG ll;
|
|
||||||
|
|
||||||
ll = Int32x32To64(t, 10000000) + 116444736000000000;
|
|
||||||
pft->dwLowDateTime = (DWORD)ll;
|
|
||||||
pft->dwHighDateTime = ll >> 32;
|
|
||||||
}
|
|
||||||
/* }}} */
|
|
||||||
|
|
||||||
TSRM_API int win32_utime(const char *filename, struct utimbuf *buf) /* {{{ */
|
|
||||||
{
|
|
||||||
FILETIME mtime, atime;
|
|
||||||
HANDLE hFile;
|
|
||||||
|
|
||||||
hFile = CreateFile(filename, GENERIC_WRITE, FILE_SHARE_WRITE|FILE_SHARE_READ, NULL,
|
|
||||||
OPEN_ALWAYS, FILE_FLAG_BACKUP_SEMANTICS, NULL);
|
|
||||||
|
|
||||||
/* OPEN_ALWAYS mode sets the last error to ERROR_ALREADY_EXISTS but
|
|
||||||
the CreateFile operation succeeds */
|
|
||||||
if (GetLastError() == ERROR_ALREADY_EXISTS) {
|
|
||||||
SetLastError(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( hFile == INVALID_HANDLE_VALUE ) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!buf) {
|
|
||||||
SYSTEMTIME st;
|
|
||||||
GetSystemTime(&st);
|
|
||||||
SystemTimeToFileTime(&st, &mtime);
|
|
||||||
atime = mtime;
|
|
||||||
} else {
|
|
||||||
UnixTimeToFileTime(buf->modtime, &mtime);
|
|
||||||
UnixTimeToFileTime(buf->actime, &atime);
|
|
||||||
}
|
|
||||||
if (!SetFileTime(hFile, NULL, &atime, &mtime)) {
|
|
||||||
CloseHandle(hFile);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
CloseHandle(hFile);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
/* }}} */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
CWD_API int virtual_utime(const char *filename, struct utimbuf *buf TSRMLS_DC) /* {{{ */
|
CWD_API int virtual_utime(const char *filename, struct utimbuf *buf TSRMLS_DC) /* {{{ */
|
||||||
{
|
{
|
||||||
cwd_state new_state;
|
cwd_state new_state;
|
||||||
|
|
|
@ -1199,7 +1199,7 @@ ZEND_VM_HANDLER(84, ZEND_FETCH_DIM_W, VAR|CV, CONST|TMP|VAR|UNUSED|CV)
|
||||||
ZVAL_DEREF(container);
|
ZVAL_DEREF(container);
|
||||||
zend_fetch_dimension_address_W(EX_VAR(opline->result.var), container, GET_OP2_ZVAL_PTR_DEREF(BP_VAR_R), OP2_TYPE TSRMLS_CC);
|
zend_fetch_dimension_address_W(EX_VAR(opline->result.var), container, GET_OP2_ZVAL_PTR_DEREF(BP_VAR_R), OP2_TYPE TSRMLS_CC);
|
||||||
FREE_OP2();
|
FREE_OP2();
|
||||||
if (OP1_TYPE == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
|
if (OP1_TYPE == IS_VAR && READY_TO_DESTROY(free_op1)) {
|
||||||
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
|
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
|
||||||
}
|
}
|
||||||
FREE_OP1_VAR_PTR();
|
FREE_OP1_VAR_PTR();
|
||||||
|
@ -1222,7 +1222,7 @@ ZEND_VM_HANDLER(87, ZEND_FETCH_DIM_RW, VAR|CV, CONST|TMP|VAR|UNUSED|CV)
|
||||||
ZVAL_DEREF(container);
|
ZVAL_DEREF(container);
|
||||||
zend_fetch_dimension_address_RW(EX_VAR(opline->result.var), container, GET_OP2_ZVAL_PTR_DEREF(BP_VAR_R), OP2_TYPE TSRMLS_CC);
|
zend_fetch_dimension_address_RW(EX_VAR(opline->result.var), container, GET_OP2_ZVAL_PTR_DEREF(BP_VAR_R), OP2_TYPE TSRMLS_CC);
|
||||||
FREE_OP2();
|
FREE_OP2();
|
||||||
if (OP1_TYPE == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
|
if (OP1_TYPE == IS_VAR && READY_TO_DESTROY(free_op1)) {
|
||||||
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
|
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
|
||||||
}
|
}
|
||||||
FREE_OP1_VAR_PTR();
|
FREE_OP1_VAR_PTR();
|
||||||
|
@ -1263,7 +1263,7 @@ ZEND_VM_HANDLER(93, ZEND_FETCH_DIM_FUNC_ARG, CONST|TMP|VAR|CV, CONST|TMP|VAR|UNU
|
||||||
}
|
}
|
||||||
ZVAL_DEREF(container);
|
ZVAL_DEREF(container);
|
||||||
zend_fetch_dimension_address_W(EX_VAR(opline->result.var), container, GET_OP2_ZVAL_PTR_DEREF(BP_VAR_R), OP2_TYPE TSRMLS_CC);
|
zend_fetch_dimension_address_W(EX_VAR(opline->result.var), container, GET_OP2_ZVAL_PTR_DEREF(BP_VAR_R), OP2_TYPE TSRMLS_CC);
|
||||||
if (OP1_TYPE == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
|
if (OP1_TYPE == IS_VAR && READY_TO_DESTROY(free_op1)) {
|
||||||
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
|
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
|
||||||
}
|
}
|
||||||
FREE_OP2();
|
FREE_OP2();
|
||||||
|
@ -1296,7 +1296,7 @@ ZEND_VM_HANDLER(96, ZEND_FETCH_DIM_UNSET, VAR|CV, CONST|TMP|VAR|CV)
|
||||||
ZVAL_DEREF(container);
|
ZVAL_DEREF(container);
|
||||||
zend_fetch_dimension_address_UNSET(EX_VAR(opline->result.var), container, GET_OP2_ZVAL_PTR_DEREF(BP_VAR_R), OP2_TYPE TSRMLS_CC);
|
zend_fetch_dimension_address_UNSET(EX_VAR(opline->result.var), container, GET_OP2_ZVAL_PTR_DEREF(BP_VAR_R), OP2_TYPE TSRMLS_CC);
|
||||||
FREE_OP2();
|
FREE_OP2();
|
||||||
if (OP1_TYPE == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
|
if (OP1_TYPE == IS_VAR && READY_TO_DESTROY(free_op1)) {
|
||||||
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
|
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
|
||||||
}
|
}
|
||||||
FREE_OP1_VAR_PTR();
|
FREE_OP1_VAR_PTR();
|
||||||
|
@ -1324,11 +1324,33 @@ ZEND_VM_HANDLER(82, ZEND_FETCH_OBJ_R, CONST|TMP|VAR|UNUSED|CV, CONST|TMP|VAR|CV)
|
||||||
zval *retval;
|
zval *retval;
|
||||||
|
|
||||||
/* here we are sure we are dealing with an object */
|
/* here we are sure we are dealing with an object */
|
||||||
|
do {
|
||||||
|
if (OP2_TYPE == IS_CONST &&
|
||||||
|
EXPECTED(Z_OBJCE_P(container) == CACHED_PTR(Z_CACHE_SLOT_P(offset)))) {
|
||||||
|
zend_property_info *prop_info = CACHED_PTR(Z_CACHE_SLOT_P(offset) + 1);
|
||||||
|
zend_object *zobj = Z_OBJ_P(container);
|
||||||
|
|
||||||
|
if (EXPECTED(prop_info)) {
|
||||||
|
retval = OBJ_PROP(zobj, prop_info->offset);
|
||||||
|
if (EXPECTED(Z_TYPE_P(retval) != IS_UNDEF)) {
|
||||||
|
ZVAL_COPY(EX_VAR(opline->result.var), retval);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else if (EXPECTED(zobj->properties != NULL)) {
|
||||||
|
retval = zend_hash_find(zobj->properties, Z_STR_P(offset));
|
||||||
|
if (EXPECTED(retval)) {
|
||||||
|
ZVAL_COPY(EX_VAR(opline->result.var), retval);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_R, ((OP2_TYPE == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL), EX_VAR(opline->result.var) TSRMLS_CC);
|
retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_R, ((OP2_TYPE == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL), EX_VAR(opline->result.var) TSRMLS_CC);
|
||||||
|
|
||||||
if (retval != EX_VAR(opline->result.var)) {
|
if (retval != EX_VAR(opline->result.var)) {
|
||||||
ZVAL_COPY(EX_VAR(opline->result.var), retval);
|
ZVAL_COPY(EX_VAR(opline->result.var), retval);
|
||||||
}
|
}
|
||||||
|
} while (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
FREE_OP2();
|
FREE_OP2();
|
||||||
|
@ -1352,9 +1374,9 @@ ZEND_VM_HANDLER(85, ZEND_FETCH_OBJ_W, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
|
||||||
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
|
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
|
||||||
}
|
}
|
||||||
|
|
||||||
zend_fetch_property_address(EX_VAR(opline->result.var), container, OP1_TYPE, property, ((OP2_TYPE == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W TSRMLS_CC);
|
zend_fetch_property_address(EX_VAR(opline->result.var), container, OP1_TYPE, property, OP2_TYPE, ((OP2_TYPE == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W TSRMLS_CC);
|
||||||
FREE_OP2();
|
FREE_OP2();
|
||||||
if (OP1_TYPE == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
|
if (OP1_TYPE == IS_VAR && READY_TO_DESTROY(free_op1)) {
|
||||||
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
|
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
|
||||||
}
|
}
|
||||||
FREE_OP1_VAR_PTR();
|
FREE_OP1_VAR_PTR();
|
||||||
|
@ -1376,9 +1398,9 @@ ZEND_VM_HANDLER(88, ZEND_FETCH_OBJ_RW, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
|
||||||
if (OP1_TYPE == IS_VAR && UNEXPECTED(container == NULL)) {
|
if (OP1_TYPE == IS_VAR && UNEXPECTED(container == NULL)) {
|
||||||
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
|
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
|
||||||
}
|
}
|
||||||
zend_fetch_property_address(EX_VAR(opline->result.var), container, OP1_TYPE, property, ((OP2_TYPE == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_RW TSRMLS_CC);
|
zend_fetch_property_address(EX_VAR(opline->result.var), container, OP1_TYPE, property, OP2_TYPE, ((OP2_TYPE == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_RW TSRMLS_CC);
|
||||||
FREE_OP2();
|
FREE_OP2();
|
||||||
if (OP1_TYPE == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
|
if (OP1_TYPE == IS_VAR && READY_TO_DESTROY(free_op1)) {
|
||||||
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
|
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
|
||||||
}
|
}
|
||||||
FREE_OP1_VAR_PTR();
|
FREE_OP1_VAR_PTR();
|
||||||
|
@ -1405,11 +1427,33 @@ ZEND_VM_HANDLER(91, ZEND_FETCH_OBJ_IS, CONST|TMP|VAR|UNUSED|CV, CONST|TMP|VAR|CV
|
||||||
zval *retval;
|
zval *retval;
|
||||||
|
|
||||||
/* here we are sure we are dealing with an object */
|
/* here we are sure we are dealing with an object */
|
||||||
|
do {
|
||||||
|
if (OP2_TYPE == IS_CONST &&
|
||||||
|
EXPECTED(Z_OBJCE_P(container) == CACHED_PTR(Z_CACHE_SLOT_P(offset)))) {
|
||||||
|
zend_property_info *prop_info = CACHED_PTR(Z_CACHE_SLOT_P(offset) + 1);
|
||||||
|
zend_object *zobj = Z_OBJ_P(container);
|
||||||
|
|
||||||
|
if (EXPECTED(prop_info)) {
|
||||||
|
retval = OBJ_PROP(zobj, prop_info->offset);
|
||||||
|
if (EXPECTED(Z_TYPE_P(retval) != IS_UNDEF)) {
|
||||||
|
ZVAL_COPY(EX_VAR(opline->result.var), retval);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else if (EXPECTED(zobj->properties != NULL)) {
|
||||||
|
retval = zend_hash_find(zobj->properties, Z_STR_P(offset));
|
||||||
|
if (EXPECTED(retval)) {
|
||||||
|
ZVAL_COPY(EX_VAR(opline->result.var), retval);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_IS, ((OP2_TYPE == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL), EX_VAR(opline->result.var) TSRMLS_CC);
|
retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_IS, ((OP2_TYPE == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL), EX_VAR(opline->result.var) TSRMLS_CC);
|
||||||
|
|
||||||
if (retval != EX_VAR(opline->result.var)) {
|
if (retval != EX_VAR(opline->result.var)) {
|
||||||
ZVAL_COPY(EX_VAR(opline->result.var), retval);
|
ZVAL_COPY(EX_VAR(opline->result.var), retval);
|
||||||
}
|
}
|
||||||
|
} while (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
FREE_OP2();
|
FREE_OP2();
|
||||||
|
@ -1438,9 +1482,9 @@ ZEND_VM_HANDLER(94, ZEND_FETCH_OBJ_FUNC_ARG, CONST|TMP|VAR|UNUSED|CV, CONST|TMP|
|
||||||
if (OP1_TYPE == IS_VAR && UNEXPECTED(container == NULL)) {
|
if (OP1_TYPE == IS_VAR && UNEXPECTED(container == NULL)) {
|
||||||
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
|
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
|
||||||
}
|
}
|
||||||
zend_fetch_property_address(EX_VAR(opline->result.var), container, OP1_TYPE, property, ((OP2_TYPE == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W TSRMLS_CC);
|
zend_fetch_property_address(EX_VAR(opline->result.var), container, OP1_TYPE, property, OP2_TYPE, ((OP2_TYPE == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W TSRMLS_CC);
|
||||||
FREE_OP2();
|
FREE_OP2();
|
||||||
if (OP1_TYPE == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
|
if (OP1_TYPE == IS_VAR && READY_TO_DESTROY(free_op1)) {
|
||||||
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
|
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
|
||||||
}
|
}
|
||||||
FREE_OP1_VAR_PTR();
|
FREE_OP1_VAR_PTR();
|
||||||
|
@ -1464,9 +1508,9 @@ ZEND_VM_HANDLER(97, ZEND_FETCH_OBJ_UNSET, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
|
||||||
if (OP1_TYPE == IS_VAR && UNEXPECTED(container == NULL)) {
|
if (OP1_TYPE == IS_VAR && UNEXPECTED(container == NULL)) {
|
||||||
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
|
zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
|
||||||
}
|
}
|
||||||
zend_fetch_property_address(EX_VAR(opline->result.var), container, OP1_TYPE, property, ((OP2_TYPE == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_UNSET TSRMLS_CC);
|
zend_fetch_property_address(EX_VAR(opline->result.var), container, OP1_TYPE, property, OP2_TYPE, ((OP2_TYPE == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_UNSET TSRMLS_CC);
|
||||||
FREE_OP2();
|
FREE_OP2();
|
||||||
if (OP1_TYPE == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
|
if (OP1_TYPE == IS_VAR && READY_TO_DESTROY(free_op1)) {
|
||||||
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
|
EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
|
||||||
}
|
}
|
||||||
FREE_OP1_VAR_PTR();
|
FREE_OP1_VAR_PTR();
|
||||||
|
@ -1910,13 +1954,14 @@ ZEND_VM_HANDLER(46, ZEND_JMPZ_EX, CONST|TMP|VAR|CV, ANY)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i_zend_is_true(val TSRMLS_CC)) {
|
if (i_zend_is_true(val TSRMLS_CC)) {
|
||||||
|
FREE_OP1();
|
||||||
ZVAL_TRUE(EX_VAR(opline->result.var));
|
ZVAL_TRUE(EX_VAR(opline->result.var));
|
||||||
opline++;
|
opline++;
|
||||||
} else {
|
} else {
|
||||||
|
FREE_OP1();
|
||||||
ZVAL_FALSE(EX_VAR(opline->result.var));
|
ZVAL_FALSE(EX_VAR(opline->result.var));
|
||||||
opline = opline->op2.jmp_addr;
|
opline = opline->op2.jmp_addr;
|
||||||
}
|
}
|
||||||
FREE_OP1();
|
|
||||||
if (UNEXPECTED(EG(exception) != NULL)) {
|
if (UNEXPECTED(EG(exception) != NULL)) {
|
||||||
HANDLE_EXCEPTION();
|
HANDLE_EXCEPTION();
|
||||||
}
|
}
|
||||||
|
@ -2069,7 +2114,7 @@ ZEND_VM_HANDLER(109, ZEND_FETCH_CLASS, ANY, CONST|TMP|VAR|UNUSED|CV)
|
||||||
if (CACHED_PTR(Z_CACHE_SLOT_P(class_name))) {
|
if (CACHED_PTR(Z_CACHE_SLOT_P(class_name))) {
|
||||||
Z_CE_P(EX_VAR(opline->result.var)) = CACHED_PTR(Z_CACHE_SLOT_P(class_name));
|
Z_CE_P(EX_VAR(opline->result.var)) = CACHED_PTR(Z_CACHE_SLOT_P(class_name));
|
||||||
} else {
|
} else {
|
||||||
Z_CE_P(EX_VAR(opline->result.var)) = zend_fetch_class_by_name(Z_STR_P(class_name), opline->op2.zv + 1, 0 TSRMLS_CC);
|
Z_CE_P(EX_VAR(opline->result.var)) = zend_fetch_class_by_name(Z_STR_P(class_name), opline->op2.zv + 1, opline->extended_value TSRMLS_CC);
|
||||||
CACHE_PTR(Z_CACHE_SLOT_P(class_name), Z_CE_P(EX_VAR(opline->result.var)));
|
CACHE_PTR(Z_CACHE_SLOT_P(class_name), Z_CE_P(EX_VAR(opline->result.var)));
|
||||||
}
|
}
|
||||||
} else if (Z_TYPE_P(class_name) == IS_OBJECT) {
|
} else if (Z_TYPE_P(class_name) == IS_OBJECT) {
|
||||||
|
@ -3017,11 +3062,8 @@ ZEND_VM_HANDLER(106, ZEND_SEND_VAR_NO_REF, VAR|CV, ANY)
|
||||||
zval *varptr, *arg;
|
zval *varptr, *arg;
|
||||||
|
|
||||||
SAVE_OPLINE();
|
SAVE_OPLINE();
|
||||||
if (opline->extended_value & ZEND_ARG_COMPILE_TIME_BOUND) { /* Had function_ptr at compile_time */
|
|
||||||
if (!(opline->extended_value & ZEND_ARG_SEND_BY_REF)) {
|
if (!(opline->extended_value & ZEND_ARG_COMPILE_TIME_BOUND)) {
|
||||||
ZEND_VM_DISPATCH_TO_HANDLER(ZEND_SEND_VAR);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (!ARG_SHOULD_BE_SENT_BY_REF(EX(call)->func, opline->op2.num)) {
|
if (!ARG_SHOULD_BE_SENT_BY_REF(EX(call)->func, opline->op2.num)) {
|
||||||
ZEND_VM_DISPATCH_TO_HANDLER(ZEND_SEND_VAR);
|
ZEND_VM_DISPATCH_TO_HANDLER(ZEND_SEND_VAR);
|
||||||
}
|
}
|
||||||
|
@ -3036,20 +3078,18 @@ ZEND_VM_HANDLER(106, ZEND_SEND_VAR_NO_REF, VAR|CV, ANY)
|
||||||
if (OP1_TYPE == IS_CV) {
|
if (OP1_TYPE == IS_CV) {
|
||||||
Z_ADDREF_P(varptr);
|
Z_ADDREF_P(varptr);
|
||||||
}
|
}
|
||||||
arg = ZEND_CALL_ARG(EX(call), opline->op2.num);
|
|
||||||
EX(call)->num_args = opline->op2.num;
|
|
||||||
ZVAL_COPY_VALUE(arg, varptr);
|
|
||||||
} else {
|
} else {
|
||||||
if ((opline->extended_value & ZEND_ARG_COMPILE_TIME_BOUND) ?
|
if ((opline->extended_value & ZEND_ARG_COMPILE_TIME_BOUND) ?
|
||||||
!(opline->extended_value & ZEND_ARG_SEND_SILENT) :
|
!(opline->extended_value & ZEND_ARG_SEND_SILENT) :
|
||||||
!ARG_MAY_BE_SENT_BY_REF(EX(call)->func, opline->op2.num)) {
|
!ARG_MAY_BE_SENT_BY_REF(EX(call)->func, opline->op2.num)) {
|
||||||
zend_error(E_STRICT, "Only variables should be passed by reference");
|
zend_error(E_STRICT, "Only variables should be passed by reference");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
arg = ZEND_CALL_ARG(EX(call), opline->op2.num);
|
arg = ZEND_CALL_ARG(EX(call), opline->op2.num);
|
||||||
EX(call)->num_args = opline->op2.num;
|
EX(call)->num_args = opline->op2.num;
|
||||||
ZVAL_COPY(arg, varptr);
|
ZVAL_COPY_VALUE(arg, varptr);
|
||||||
FREE_OP1_IF_VAR();
|
|
||||||
}
|
|
||||||
CHECK_EXCEPTION();
|
CHECK_EXCEPTION();
|
||||||
ZEND_VM_NEXT_OPCODE();
|
ZEND_VM_NEXT_OPCODE();
|
||||||
}
|
}
|
||||||
|
@ -3079,12 +3119,11 @@ ZEND_VM_HANDLER(67, ZEND_SEND_REF, VAR|CV, ANY)
|
||||||
ZVAL_COPY_VALUE(arg, varptr);
|
ZVAL_COPY_VALUE(arg, varptr);
|
||||||
} else if (OP1_TYPE == IS_VAR &&
|
} else if (OP1_TYPE == IS_VAR &&
|
||||||
UNEXPECTED(Z_TYPE_P(EX_VAR(opline->op1.var)) != IS_INDIRECT)) {
|
UNEXPECTED(Z_TYPE_P(EX_VAR(opline->op1.var)) != IS_INDIRECT)) {
|
||||||
ZVAL_COPY_VALUE(arg, varptr);
|
ZVAL_NEW_REF(arg, varptr);
|
||||||
ZVAL_MAKE_REF(arg);
|
|
||||||
} else {
|
} else {
|
||||||
ZVAL_MAKE_REF(varptr);
|
ZVAL_NEW_REF(arg, varptr);
|
||||||
Z_ADDREF_P(varptr);
|
Z_ADDREF_P(arg);
|
||||||
ZVAL_REF(arg, Z_REF_P(varptr));
|
ZVAL_REF(varptr, Z_REF_P(arg));
|
||||||
}
|
}
|
||||||
|
|
||||||
FREE_OP1_VAR_PTR();
|
FREE_OP1_VAR_PTR();
|
||||||
|
@ -3773,14 +3812,16 @@ ZEND_VM_HANDLER(99, ZEND_FETCH_CONSTANT, VAR|CONST|UNUSED, CONST)
|
||||||
} else if ((c = zend_quick_get_constant(opline->op2.zv + 1, opline->extended_value TSRMLS_CC)) == NULL) {
|
} else if ((c = zend_quick_get_constant(opline->op2.zv + 1, opline->extended_value TSRMLS_CC)) == NULL) {
|
||||||
if ((opline->extended_value & IS_CONSTANT_UNQUALIFIED) != 0) {
|
if ((opline->extended_value & IS_CONSTANT_UNQUALIFIED) != 0) {
|
||||||
char *actual = (char *)zend_memrchr(Z_STRVAL_P(opline->op2.zv), '\\', Z_STRLEN_P(opline->op2.zv));
|
char *actual = (char *)zend_memrchr(Z_STRVAL_P(opline->op2.zv), '\\', Z_STRLEN_P(opline->op2.zv));
|
||||||
if(!actual) {
|
if (!actual) {
|
||||||
actual = Z_STRVAL_P(opline->op2.zv);
|
ZVAL_STR(EX_VAR(opline->result.var), zend_string_copy(Z_STR_P(opline->op2.zv)));
|
||||||
} else {
|
} else {
|
||||||
actual++;
|
actual++;
|
||||||
|
ZVAL_STRINGL(EX_VAR(opline->result.var),
|
||||||
|
actual, Z_STRLEN_P(opline->op2.zv) - (actual - Z_STRVAL_P(opline->op2.zv)));
|
||||||
}
|
}
|
||||||
/* non-qualified constant - allow text substitution */
|
/* non-qualified constant - allow text substitution */
|
||||||
zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", actual, actual);
|
zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'",
|
||||||
ZVAL_STRINGL(EX_VAR(opline->result.var), actual, Z_STRLEN_P(opline->op2.zv)-(actual - Z_STRVAL_P(opline->op2.zv)));
|
Z_STRVAL_P(EX_VAR(opline->result.var)), Z_STRVAL_P(EX_VAR(opline->result.var)));
|
||||||
CHECK_EXCEPTION();
|
CHECK_EXCEPTION();
|
||||||
ZEND_VM_NEXT_OPCODE();
|
ZEND_VM_NEXT_OPCODE();
|
||||||
} else {
|
} else {
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -100,18 +100,18 @@ $op2_type = array(
|
||||||
);
|
);
|
||||||
|
|
||||||
$op1_free = array(
|
$op1_free = array(
|
||||||
"ANY" => "(free_op1.var != NULL)",
|
"ANY" => "(free_op1 != NULL)",
|
||||||
"TMP" => "1",
|
"TMP" => "1",
|
||||||
"VAR" => "(free_op1.var != NULL)",
|
"VAR" => "(free_op1 != NULL)",
|
||||||
"CONST" => "0",
|
"CONST" => "0",
|
||||||
"UNUSED" => "0",
|
"UNUSED" => "0",
|
||||||
"CV" => "0",
|
"CV" => "0",
|
||||||
);
|
);
|
||||||
|
|
||||||
$op2_free = array(
|
$op2_free = array(
|
||||||
"ANY" => "(free_op2.var != NULL)",
|
"ANY" => "(free_op2 != NULL)",
|
||||||
"TMP" => "1",
|
"TMP" => "1",
|
||||||
"VAR" => "(free_op2.var != NULL)",
|
"VAR" => "(free_op2 != NULL)",
|
||||||
"CONST" => "0",
|
"CONST" => "0",
|
||||||
"UNUSED" => "0",
|
"UNUSED" => "0",
|
||||||
"CV" => "0",
|
"CV" => "0",
|
||||||
|
@ -119,8 +119,8 @@ $op2_free = array(
|
||||||
|
|
||||||
$op1_get_zval_ptr = array(
|
$op1_get_zval_ptr = array(
|
||||||
"ANY" => "get_zval_ptr(opline->op1_type, &opline->op1, execute_data, &free_op1, \\1)",
|
"ANY" => "get_zval_ptr(opline->op1_type, &opline->op1, execute_data, &free_op1, \\1)",
|
||||||
"TMP" => "_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC)",
|
"TMP" => "_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1)",
|
||||||
"VAR" => "_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC)",
|
"VAR" => "_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1)",
|
||||||
"CONST" => "opline->op1.zv",
|
"CONST" => "opline->op1.zv",
|
||||||
"UNUSED" => "NULL",
|
"UNUSED" => "NULL",
|
||||||
"CV" => "_get_zval_ptr_cv_\\1(execute_data, opline->op1.var TSRMLS_CC)",
|
"CV" => "_get_zval_ptr_cv_\\1(execute_data, opline->op1.var TSRMLS_CC)",
|
||||||
|
@ -128,8 +128,8 @@ $op1_get_zval_ptr = array(
|
||||||
|
|
||||||
$op2_get_zval_ptr = array(
|
$op2_get_zval_ptr = array(
|
||||||
"ANY" => "get_zval_ptr(opline->op2_type, &opline->op2, execute_data, &free_op2, \\1)",
|
"ANY" => "get_zval_ptr(opline->op2_type, &opline->op2, execute_data, &free_op2, \\1)",
|
||||||
"TMP" => "_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC)",
|
"TMP" => "_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2)",
|
||||||
"VAR" => "_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC)",
|
"VAR" => "_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2)",
|
||||||
"CONST" => "opline->op2.zv",
|
"CONST" => "opline->op2.zv",
|
||||||
"UNUSED" => "NULL",
|
"UNUSED" => "NULL",
|
||||||
"CV" => "_get_zval_ptr_cv_\\1(execute_data, opline->op2.var TSRMLS_CC)",
|
"CV" => "_get_zval_ptr_cv_\\1(execute_data, opline->op2.var TSRMLS_CC)",
|
||||||
|
@ -138,7 +138,7 @@ $op2_get_zval_ptr = array(
|
||||||
$op1_get_zval_ptr_ptr = array(
|
$op1_get_zval_ptr_ptr = array(
|
||||||
"ANY" => "get_zval_ptr_ptr(opline->op1_type, &opline->op1, execute_data, &free_op1, \\1)",
|
"ANY" => "get_zval_ptr_ptr(opline->op1_type, &opline->op1, execute_data, &free_op1, \\1)",
|
||||||
"TMP" => "NULL",
|
"TMP" => "NULL",
|
||||||
"VAR" => "_get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC)",
|
"VAR" => "_get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1)",
|
||||||
"CONST" => "NULL",
|
"CONST" => "NULL",
|
||||||
"UNUSED" => "NULL",
|
"UNUSED" => "NULL",
|
||||||
"CV" => "_get_zval_ptr_cv_\\1(execute_data, opline->op1.var TSRMLS_CC)",
|
"CV" => "_get_zval_ptr_cv_\\1(execute_data, opline->op1.var TSRMLS_CC)",
|
||||||
|
@ -147,7 +147,7 @@ $op1_get_zval_ptr_ptr = array(
|
||||||
$op2_get_zval_ptr_ptr = array(
|
$op2_get_zval_ptr_ptr = array(
|
||||||
"ANY" => "get_zval_ptr_ptr(opline->op2_type, &opline->op2, execute_data, &free_op2, \\1)",
|
"ANY" => "get_zval_ptr_ptr(opline->op2_type, &opline->op2, execute_data, &free_op2, \\1)",
|
||||||
"TMP" => "NULL",
|
"TMP" => "NULL",
|
||||||
"VAR" => "_get_zval_ptr_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC)",
|
"VAR" => "_get_zval_ptr_ptr_var(opline->op2.var, execute_data, &free_op2)",
|
||||||
"CONST" => "NULL",
|
"CONST" => "NULL",
|
||||||
"UNUSED" => "NULL",
|
"UNUSED" => "NULL",
|
||||||
"CV" => "_get_zval_ptr_cv_\\1(execute_data, opline->op2.var TSRMLS_CC)",
|
"CV" => "_get_zval_ptr_cv_\\1(execute_data, opline->op2.var TSRMLS_CC)",
|
||||||
|
@ -155,8 +155,8 @@ $op2_get_zval_ptr_ptr = array(
|
||||||
|
|
||||||
$op1_get_zval_ptr_deref = array(
|
$op1_get_zval_ptr_deref = array(
|
||||||
"ANY" => "get_zval_ptr_deref(opline->op1_type, &opline->op1, execute_data, &free_op1, \\1)",
|
"ANY" => "get_zval_ptr_deref(opline->op1_type, &opline->op1, execute_data, &free_op1, \\1)",
|
||||||
"TMP" => "_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC)",
|
"TMP" => "_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1)",
|
||||||
"VAR" => "_get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC)",
|
"VAR" => "_get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1)",
|
||||||
"CONST" => "opline->op1.zv",
|
"CONST" => "opline->op1.zv",
|
||||||
"UNUSED" => "NULL",
|
"UNUSED" => "NULL",
|
||||||
"CV" => "_get_zval_ptr_cv_deref_\\1(execute_data, opline->op1.var TSRMLS_CC)",
|
"CV" => "_get_zval_ptr_cv_deref_\\1(execute_data, opline->op1.var TSRMLS_CC)",
|
||||||
|
@ -164,8 +164,8 @@ $op1_get_zval_ptr_deref = array(
|
||||||
|
|
||||||
$op2_get_zval_ptr_deref = array(
|
$op2_get_zval_ptr_deref = array(
|
||||||
"ANY" => "get_zval_ptr_deref(opline->op2_type, &opline->op2, execute_data, &free_op2, \\1)",
|
"ANY" => "get_zval_ptr_deref(opline->op2_type, &opline->op2, execute_data, &free_op2, \\1)",
|
||||||
"TMP" => "_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC)",
|
"TMP" => "_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2)",
|
||||||
"VAR" => "_get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2 TSRMLS_CC)",
|
"VAR" => "_get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2)",
|
||||||
"CONST" => "opline->op2.zv",
|
"CONST" => "opline->op2.zv",
|
||||||
"UNUSED" => "NULL",
|
"UNUSED" => "NULL",
|
||||||
"CV" => "_get_zval_ptr_cv_deref_\\1(execute_data, opline->op2.var TSRMLS_CC)",
|
"CV" => "_get_zval_ptr_cv_deref_\\1(execute_data, opline->op2.var TSRMLS_CC)",
|
||||||
|
@ -174,7 +174,7 @@ $op2_get_zval_ptr_deref = array(
|
||||||
$op1_get_zval_ptr_ptr_undef = array(
|
$op1_get_zval_ptr_ptr_undef = array(
|
||||||
"ANY" => "get_zval_ptr_ptr_undef(opline->op1_type, &opline->op1, execute_data, &free_op1, \\1)",
|
"ANY" => "get_zval_ptr_ptr_undef(opline->op1_type, &opline->op1, execute_data, &free_op1, \\1)",
|
||||||
"TMP" => "NULL",
|
"TMP" => "NULL",
|
||||||
"VAR" => "_get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC)",
|
"VAR" => "_get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1)",
|
||||||
"CONST" => "NULL",
|
"CONST" => "NULL",
|
||||||
"UNUSED" => "NULL",
|
"UNUSED" => "NULL",
|
||||||
"CV" => "_get_zval_ptr_cv_undef_\\1(execute_data, opline->op1.var TSRMLS_CC)",
|
"CV" => "_get_zval_ptr_cv_undef_\\1(execute_data, opline->op1.var TSRMLS_CC)",
|
||||||
|
@ -183,7 +183,7 @@ $op1_get_zval_ptr_ptr_undef = array(
|
||||||
$op2_get_zval_ptr_ptr_undef = array(
|
$op2_get_zval_ptr_ptr_undef = array(
|
||||||
"ANY" => "get_zval_ptr_ptr_undef(opline->op2_type, &opline->op2, execute_data, &free_op2, \\1)",
|
"ANY" => "get_zval_ptr_ptr_undef(opline->op2_type, &opline->op2, execute_data, &free_op2, \\1)",
|
||||||
"TMP" => "NULL",
|
"TMP" => "NULL",
|
||||||
"VAR" => "_get_zval_ptr_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC)",
|
"VAR" => "_get_zval_ptr_ptr_var(opline->op2.var, execute_data, &free_op2)",
|
||||||
"CONST" => "NULL",
|
"CONST" => "NULL",
|
||||||
"UNUSED" => "NULL",
|
"UNUSED" => "NULL",
|
||||||
"CV" => "_get_zval_ptr_cv_undef_\\1(execute_data, opline->op2.var TSRMLS_CC)",
|
"CV" => "_get_zval_ptr_cv_undef_\\1(execute_data, opline->op2.var TSRMLS_CC)",
|
||||||
|
@ -191,62 +191,62 @@ $op2_get_zval_ptr_ptr_undef = array(
|
||||||
|
|
||||||
$op1_get_obj_zval_ptr = array(
|
$op1_get_obj_zval_ptr = array(
|
||||||
"ANY" => "get_obj_zval_ptr(opline->op1_type, &opline->op1, execute_data, &free_op1, \\1)",
|
"ANY" => "get_obj_zval_ptr(opline->op1_type, &opline->op1, execute_data, &free_op1, \\1)",
|
||||||
"TMP" => "_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC)",
|
"TMP" => "_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1)",
|
||||||
"VAR" => "_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC)",
|
"VAR" => "_get_zval_ptr_var(opline->op1.var, execute_data, &free_op1)",
|
||||||
"CONST" => "opline->op1.zv",
|
"CONST" => "opline->op1.zv",
|
||||||
"UNUSED" => "_get_obj_zval_ptr_unused(TSRMLS_C)",
|
"UNUSED" => "_get_obj_zval_ptr_unused(execute_data)",
|
||||||
"CV" => "_get_zval_ptr_cv_\\1(execute_data, opline->op1.var TSRMLS_CC)",
|
"CV" => "_get_zval_ptr_cv_\\1(execute_data, opline->op1.var TSRMLS_CC)",
|
||||||
);
|
);
|
||||||
|
|
||||||
$op2_get_obj_zval_ptr = array(
|
$op2_get_obj_zval_ptr = array(
|
||||||
"ANY" => "get_obj_zval_ptr(opline->op2_type, &opline->op2, execute_data, &free_op2, \\1)",
|
"ANY" => "get_obj_zval_ptr(opline->op2_type, &opline->op2, execute_data, &free_op2, \\1)",
|
||||||
"TMP" => "_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC)",
|
"TMP" => "_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2)",
|
||||||
"VAR" => "_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC)",
|
"VAR" => "_get_zval_ptr_var(opline->op2.var, execute_data, &free_op2)",
|
||||||
"CONST" => "opline->op2.zv",
|
"CONST" => "opline->op2.zv",
|
||||||
"UNUSED" => "_get_obj_zval_ptr_unused(TSRMLS_C)",
|
"UNUSED" => "_get_obj_zval_ptr_unused(execute_data)",
|
||||||
"CV" => "_get_zval_ptr_cv_\\1(execute_data, opline->op2.var TSRMLS_CC)",
|
"CV" => "_get_zval_ptr_cv_\\1(execute_data, opline->op2.var TSRMLS_CC)",
|
||||||
);
|
);
|
||||||
|
|
||||||
$op1_get_obj_zval_ptr_deref = array(
|
$op1_get_obj_zval_ptr_deref = array(
|
||||||
"ANY" => "get_obj_zval_ptr(opline->op1_type, &opline->op1, execute_data, &free_op1, \\1)",
|
"ANY" => "get_obj_zval_ptr(opline->op1_type, &opline->op1, execute_data, &free_op1, \\1)",
|
||||||
"TMP" => "_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC)",
|
"TMP" => "_get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1)",
|
||||||
"VAR" => "_get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC)",
|
"VAR" => "_get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1)",
|
||||||
"CONST" => "opline->op1.zv",
|
"CONST" => "opline->op1.zv",
|
||||||
"UNUSED" => "_get_obj_zval_ptr_unused(execute_data TSRMLS_CC)",
|
"UNUSED" => "_get_obj_zval_ptr_unused(execute_data)",
|
||||||
"CV" => "_get_zval_ptr_cv_deref_\\1(execute_data, opline->op1.var TSRMLS_CC)",
|
"CV" => "_get_zval_ptr_cv_deref_\\1(execute_data, opline->op1.var TSRMLS_CC)",
|
||||||
);
|
);
|
||||||
|
|
||||||
$op2_get_obj_zval_ptr_deref = array(
|
$op2_get_obj_zval_ptr_deref = array(
|
||||||
"ANY" => "get_obj_zval_ptr(opline->op2_type, &opline->op2, execute_data, &free_op2, \\1)",
|
"ANY" => "get_obj_zval_ptr(opline->op2_type, &opline->op2, execute_data, &free_op2, \\1)",
|
||||||
"TMP" => "_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC)",
|
"TMP" => "_get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2)",
|
||||||
"VAR" => "_get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2 TSRMLS_CC)",
|
"VAR" => "_get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2)",
|
||||||
"CONST" => "opline->op2.zv",
|
"CONST" => "opline->op2.zv",
|
||||||
"UNUSED" => "_get_obj_zval_ptr_unused(execute_data TSRMLS_CC)",
|
"UNUSED" => "_get_obj_zval_ptr_unused(execute_data)",
|
||||||
"CV" => "_get_zval_ptr_cv_deref_\\1(execute_data, opline->op2.var TSRMLS_CC)",
|
"CV" => "_get_zval_ptr_cv_deref_\\1(execute_data, opline->op2.var TSRMLS_CC)",
|
||||||
);
|
);
|
||||||
|
|
||||||
$op1_get_obj_zval_ptr_ptr = array(
|
$op1_get_obj_zval_ptr_ptr = array(
|
||||||
"ANY" => "get_obj_zval_ptr_ptr(opline->op1_type, &opline->op1, execute_data, &free_op1, \\1)",
|
"ANY" => "get_obj_zval_ptr_ptr(opline->op1_type, &opline->op1, execute_data, &free_op1, \\1)",
|
||||||
"TMP" => "NULL",
|
"TMP" => "NULL",
|
||||||
"VAR" => "_get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC)",
|
"VAR" => "_get_zval_ptr_ptr_var(opline->op1.var, execute_data, &free_op1)",
|
||||||
"CONST" => "NULL",
|
"CONST" => "NULL",
|
||||||
"UNUSED" => "_get_obj_zval_ptr_unused(execute_data TSRMLS_CC)",
|
"UNUSED" => "_get_obj_zval_ptr_unused(execute_data)",
|
||||||
"CV" => "_get_zval_ptr_cv_\\1(execute_data, opline->op1.var TSRMLS_CC)",
|
"CV" => "_get_zval_ptr_cv_\\1(execute_data, opline->op1.var TSRMLS_CC)",
|
||||||
);
|
);
|
||||||
|
|
||||||
$op2_get_obj_zval_ptr_ptr = array(
|
$op2_get_obj_zval_ptr_ptr = array(
|
||||||
"ANY" => "get_obj_zval_ptr_ptr(opline->op2_type, &opline->op2, execute_data, &free_op2, \\1)",
|
"ANY" => "get_obj_zval_ptr_ptr(opline->op2_type, &opline->op2, execute_data, &free_op2, \\1)",
|
||||||
"TMP" => "NULL",
|
"TMP" => "NULL",
|
||||||
"VAR" => "_get_zval_ptr_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC)",
|
"VAR" => "_get_zval_ptr_ptr_var(opline->op2.var, execute_data, &free_op2)",
|
||||||
"CONST" => "NULL",
|
"CONST" => "NULL",
|
||||||
"UNUSED" => "_get_obj_zval_ptr_unused(execute_data TSRMLS_CC)",
|
"UNUSED" => "_get_obj_zval_ptr_unused(execute_data)",
|
||||||
"CV" => "_get_zval_ptr_cv_\\1(execute_data, opline->op2.var TSRMLS_CC)",
|
"CV" => "_get_zval_ptr_cv_\\1(execute_data, opline->op2.var TSRMLS_CC)",
|
||||||
);
|
);
|
||||||
|
|
||||||
$op1_free_op = array(
|
$op1_free_op = array(
|
||||||
"ANY" => "FREE_OP(free_op1)",
|
"ANY" => "FREE_OP(free_op1)",
|
||||||
"TMP" => "zval_ptr_dtor_nogc(free_op1.var)",
|
"TMP" => "zval_ptr_dtor_nogc(free_op1)",
|
||||||
"VAR" => "zval_ptr_dtor_nogc(free_op1.var)",
|
"VAR" => "zval_ptr_dtor_nogc(free_op1)",
|
||||||
"CONST" => "",
|
"CONST" => "",
|
||||||
"UNUSED" => "",
|
"UNUSED" => "",
|
||||||
"CV" => "",
|
"CV" => "",
|
||||||
|
@ -254,44 +254,44 @@ $op1_free_op = array(
|
||||||
|
|
||||||
$op2_free_op = array(
|
$op2_free_op = array(
|
||||||
"ANY" => "FREE_OP(free_op2)",
|
"ANY" => "FREE_OP(free_op2)",
|
||||||
"TMP" => "zval_ptr_dtor_nogc(free_op2.var)",
|
"TMP" => "zval_ptr_dtor_nogc(free_op2)",
|
||||||
"VAR" => "zval_ptr_dtor_nogc(free_op2.var)",
|
"VAR" => "zval_ptr_dtor_nogc(free_op2)",
|
||||||
"CONST" => "",
|
"CONST" => "",
|
||||||
"UNUSED" => "",
|
"UNUSED" => "",
|
||||||
"CV" => "",
|
"CV" => "",
|
||||||
);
|
);
|
||||||
|
|
||||||
$op1_free_op_if_var = array(
|
$op1_free_op_if_var = array(
|
||||||
"ANY" => "if (opline->op1_type == IS_VAR) {zval_ptr_dtor_nogc(free_op1.var);}",
|
"ANY" => "if (opline->op1_type == IS_VAR) {zval_ptr_dtor_nogc(free_op1);}",
|
||||||
"TMP" => "",
|
"TMP" => "",
|
||||||
"VAR" => "zval_ptr_dtor_nogc(free_op1.var)",
|
"VAR" => "zval_ptr_dtor_nogc(free_op1)",
|
||||||
"CONST" => "",
|
"CONST" => "",
|
||||||
"UNUSED" => "",
|
"UNUSED" => "",
|
||||||
"CV" => "",
|
"CV" => "",
|
||||||
);
|
);
|
||||||
|
|
||||||
$op2_free_op_if_var = array(
|
$op2_free_op_if_var = array(
|
||||||
"ANY" => "if (opline->op1_type == IS_VAR) {zval_ptr_dtor_nogc(free_op1.var);}",
|
"ANY" => "if (opline->op2_type == IS_VAR) {zval_ptr_dtor_nogc(free_op2);}",
|
||||||
"TMP" => "",
|
"TMP" => "",
|
||||||
"VAR" => "zval_ptr_dtor_nogc(free_op2.var)",
|
"VAR" => "zval_ptr_dtor_nogc(free_op2)",
|
||||||
"CONST" => "",
|
"CONST" => "",
|
||||||
"UNUSED" => "",
|
"UNUSED" => "",
|
||||||
"CV" => "",
|
"CV" => "",
|
||||||
);
|
);
|
||||||
|
|
||||||
$op1_free_op_var_ptr = array(
|
$op1_free_op_var_ptr = array(
|
||||||
"ANY" => "if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);}",
|
"ANY" => "if (free_op1) {zval_ptr_dtor_nogc(free_op1);}",
|
||||||
"TMP" => "",
|
"TMP" => "",
|
||||||
"VAR" => "if (free_op1.var) {zval_ptr_dtor_nogc(free_op1.var);}",
|
"VAR" => "if (free_op1) {zval_ptr_dtor_nogc(free_op1);}",
|
||||||
"CONST" => "",
|
"CONST" => "",
|
||||||
"UNUSED" => "",
|
"UNUSED" => "",
|
||||||
"CV" => "",
|
"CV" => "",
|
||||||
);
|
);
|
||||||
|
|
||||||
$op2_free_op_var_ptr = array(
|
$op2_free_op_var_ptr = array(
|
||||||
"ANY" => "if (free_op2.var) {zval_ptr_dtor_nogc(free_op2.var);}",
|
"ANY" => "if (free_op2) {zval_ptr_dtor_nogc(free_op2);}",
|
||||||
"TMP" => "",
|
"TMP" => "",
|
||||||
"VAR" => "if (free_op2.var) {zval_ptr_dtor_nogc(free_op2.var);}",
|
"VAR" => "if (free_op2) {zval_ptr_dtor_nogc(free_op2);}",
|
||||||
"CONST" => "",
|
"CONST" => "",
|
||||||
"UNUSED" => "",
|
"UNUSED" => "",
|
||||||
"CV" => "",
|
"CV" => "",
|
||||||
|
|
|
@ -215,14 +215,14 @@ PHP_FUNCTION(bcadd)
|
||||||
zend_long scale_param = 0;
|
zend_long scale_param = 0;
|
||||||
bc_num first, second, result;
|
bc_num first, second, result;
|
||||||
size_t left_len, right_len;
|
size_t left_len, right_len;
|
||||||
int scale = BCG(bc_precision), argc = ZEND_NUM_ARGS();
|
int scale = (int)BCG(bc_precision), argc = ZEND_NUM_ARGS();
|
||||||
|
|
||||||
if (zend_parse_parameters(argc TSRMLS_CC, "ss|l", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) {
|
if (zend_parse_parameters(argc TSRMLS_CC, "ss|l", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argc == 3) {
|
if (argc == 3) {
|
||||||
scale = (int) ((int)scale_param < 0) ? 0 : scale_param;
|
scale = (int) (scale_param < 0 ? 0 : scale_param);
|
||||||
}
|
}
|
||||||
|
|
||||||
bc_init_num(&first TSRMLS_CC);
|
bc_init_num(&first TSRMLS_CC);
|
||||||
|
@ -252,14 +252,14 @@ PHP_FUNCTION(bcsub)
|
||||||
size_t left_len, right_len;
|
size_t left_len, right_len;
|
||||||
zend_long scale_param = 0;
|
zend_long scale_param = 0;
|
||||||
bc_num first, second, result;
|
bc_num first, second, result;
|
||||||
int scale = BCG(bc_precision), argc = ZEND_NUM_ARGS();
|
int scale = (int)BCG(bc_precision), argc = ZEND_NUM_ARGS();
|
||||||
|
|
||||||
if (zend_parse_parameters(argc TSRMLS_CC, "ss|l", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) {
|
if (zend_parse_parameters(argc TSRMLS_CC, "ss|l", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argc == 3) {
|
if (argc == 3) {
|
||||||
scale = (int) ((int)scale_param < 0) ? 0 : scale_param;
|
scale = (int) ((int)scale_param < 0 ? 0 : scale_param);
|
||||||
}
|
}
|
||||||
|
|
||||||
bc_init_num(&first TSRMLS_CC);
|
bc_init_num(&first TSRMLS_CC);
|
||||||
|
@ -289,14 +289,14 @@ PHP_FUNCTION(bcmul)
|
||||||
size_t left_len, right_len;
|
size_t left_len, right_len;
|
||||||
zend_long scale_param = 0;
|
zend_long scale_param = 0;
|
||||||
bc_num first, second, result;
|
bc_num first, second, result;
|
||||||
int scale = BCG(bc_precision), argc = ZEND_NUM_ARGS();
|
int scale = (int)BCG(bc_precision), argc = ZEND_NUM_ARGS();
|
||||||
|
|
||||||
if (zend_parse_parameters(argc TSRMLS_CC, "ss|l", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) {
|
if (zend_parse_parameters(argc TSRMLS_CC, "ss|l", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argc == 3) {
|
if (argc == 3) {
|
||||||
scale = (int) ((int)scale_param < 0) ? 0 : scale_param;
|
scale = (int) ((int)scale_param < 0 ? 0 : scale_param);
|
||||||
}
|
}
|
||||||
|
|
||||||
bc_init_num(&first TSRMLS_CC);
|
bc_init_num(&first TSRMLS_CC);
|
||||||
|
@ -326,14 +326,14 @@ PHP_FUNCTION(bcdiv)
|
||||||
size_t left_len, right_len;
|
size_t left_len, right_len;
|
||||||
zend_long scale_param = 0;
|
zend_long scale_param = 0;
|
||||||
bc_num first, second, result;
|
bc_num first, second, result;
|
||||||
int scale = BCG(bc_precision), argc = ZEND_NUM_ARGS();
|
int scale = (int)BCG(bc_precision), argc = ZEND_NUM_ARGS();
|
||||||
|
|
||||||
if (zend_parse_parameters(argc TSRMLS_CC, "ss|l", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) {
|
if (zend_parse_parameters(argc TSRMLS_CC, "ss|l", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argc == 3) {
|
if (argc == 3) {
|
||||||
scale = (int) ((int)scale_param < 0) ? 0 : scale_param;
|
scale = (int) ((int)scale_param < 0 ? 0 : scale_param);
|
||||||
}
|
}
|
||||||
|
|
||||||
bc_init_num(&first TSRMLS_CC);
|
bc_init_num(&first TSRMLS_CC);
|
||||||
|
@ -417,11 +417,11 @@ PHP_FUNCTION(bcpowmod)
|
||||||
php_str2num(&second, right TSRMLS_CC);
|
php_str2num(&second, right TSRMLS_CC);
|
||||||
php_str2num(&mod, modulous TSRMLS_CC);
|
php_str2num(&mod, modulous TSRMLS_CC);
|
||||||
|
|
||||||
scale_int = (int) ((int)scale < 0) ? 0 : scale;
|
scale_int = (int) ((int)scale < 0 ? 0 : scale);
|
||||||
|
|
||||||
if (bc_raisemod(first, second, mod, &result, scale_int TSRMLS_CC) != -1) {
|
if (bc_raisemod(first, second, mod, &result, scale_int TSRMLS_CC) != -1) {
|
||||||
if (result->n_scale > scale) {
|
if (result->n_scale > scale) {
|
||||||
result->n_scale = scale;
|
result->n_scale = (int)scale;
|
||||||
}
|
}
|
||||||
RETVAL_STR(bc_num2str(result));
|
RETVAL_STR(bc_num2str(result));
|
||||||
} else {
|
} else {
|
||||||
|
@ -444,14 +444,14 @@ PHP_FUNCTION(bcpow)
|
||||||
size_t left_len, right_len;
|
size_t left_len, right_len;
|
||||||
zend_long scale_param = 0;
|
zend_long scale_param = 0;
|
||||||
bc_num first, second, result;
|
bc_num first, second, result;
|
||||||
int scale = BCG(bc_precision), argc = ZEND_NUM_ARGS();
|
int scale = (int)BCG(bc_precision), argc = ZEND_NUM_ARGS();
|
||||||
|
|
||||||
if (zend_parse_parameters(argc TSRMLS_CC, "ss|l", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) {
|
if (zend_parse_parameters(argc TSRMLS_CC, "ss|l", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argc == 3) {
|
if (argc == 3) {
|
||||||
scale = (int) ((int)scale_param < 0) ? 0 : scale_param;
|
scale = (int) ((int)scale_param < 0 ? 0 : scale_param);
|
||||||
}
|
}
|
||||||
|
|
||||||
bc_init_num(&first TSRMLS_CC);
|
bc_init_num(&first TSRMLS_CC);
|
||||||
|
@ -481,14 +481,14 @@ PHP_FUNCTION(bcsqrt)
|
||||||
size_t left_len;
|
size_t left_len;
|
||||||
zend_long scale_param = 0;
|
zend_long scale_param = 0;
|
||||||
bc_num result;
|
bc_num result;
|
||||||
int scale = BCG(bc_precision), argc = ZEND_NUM_ARGS();
|
int scale = (int)BCG(bc_precision), argc = ZEND_NUM_ARGS();
|
||||||
|
|
||||||
if (zend_parse_parameters(argc TSRMLS_CC, "s|l", &left, &left_len, &scale_param) == FAILURE) {
|
if (zend_parse_parameters(argc TSRMLS_CC, "s|l", &left, &left_len, &scale_param) == FAILURE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argc == 2) {
|
if (argc == 2) {
|
||||||
scale = (int) ((int)scale_param < 0) ? 0 : scale_param;
|
scale = (int) ((int)scale_param < 0 ? 0 : scale_param);
|
||||||
}
|
}
|
||||||
|
|
||||||
bc_init_num(&result TSRMLS_CC);
|
bc_init_num(&result TSRMLS_CC);
|
||||||
|
@ -516,14 +516,14 @@ PHP_FUNCTION(bccomp)
|
||||||
size_t left_len, right_len;
|
size_t left_len, right_len;
|
||||||
zend_long scale_param = 0;
|
zend_long scale_param = 0;
|
||||||
bc_num first, second;
|
bc_num first, second;
|
||||||
int scale = BCG(bc_precision), argc = ZEND_NUM_ARGS();
|
int scale = (int)BCG(bc_precision), argc = ZEND_NUM_ARGS();
|
||||||
|
|
||||||
if (zend_parse_parameters(argc TSRMLS_CC, "ss|l", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) {
|
if (zend_parse_parameters(argc TSRMLS_CC, "ss|l", &left, &left_len, &right, &right_len, &scale_param) == FAILURE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argc == 3) {
|
if (argc == 3) {
|
||||||
scale = (int) ((int)scale_param < 0) ? 0 : scale_param;
|
scale = (int) ((int)scale_param < 0 ? 0 : scale_param);
|
||||||
}
|
}
|
||||||
|
|
||||||
bc_init_num(&first TSRMLS_CC);
|
bc_init_num(&first TSRMLS_CC);
|
||||||
|
|
|
@ -138,22 +138,48 @@ struct php_bz2_stream_data_t {
|
||||||
static size_t php_bz2iop_read(php_stream *stream, char *buf, size_t count TSRMLS_DC)
|
static size_t php_bz2iop_read(php_stream *stream, char *buf, size_t count TSRMLS_DC)
|
||||||
{
|
{
|
||||||
struct php_bz2_stream_data_t *self = (struct php_bz2_stream_data_t *)stream->abstract;
|
struct php_bz2_stream_data_t *self = (struct php_bz2_stream_data_t *)stream->abstract;
|
||||||
size_t ret;
|
size_t ret = 0;
|
||||||
|
|
||||||
ret = BZ2_bzread(self->bz_file, buf, count);
|
do {
|
||||||
|
int just_read;
|
||||||
|
size_t remain = count - ret;
|
||||||
|
int to_read = (int)(remain <= INT_MAX ? remain : INT_MAX);
|
||||||
|
|
||||||
if (ret == 0) {
|
just_read = BZ2_bzread(self->bz_file, buf, to_read);
|
||||||
stream->eof = 1;
|
|
||||||
|
if (just_read < 1) {
|
||||||
|
stream->eof = 0 == just_read;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret += just_read;
|
||||||
|
} while (ret < count);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static size_t php_bz2iop_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC)
|
static size_t php_bz2iop_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC)
|
||||||
{
|
{
|
||||||
|
size_t wrote = 0;
|
||||||
struct php_bz2_stream_data_t *self = (struct php_bz2_stream_data_t *)stream->abstract;
|
struct php_bz2_stream_data_t *self = (struct php_bz2_stream_data_t *)stream->abstract;
|
||||||
|
|
||||||
return BZ2_bzwrite(self->bz_file, (char*)buf, count);
|
|
||||||
|
do {
|
||||||
|
int just_wrote;
|
||||||
|
size_t remain = count - wrote;
|
||||||
|
int to_write = (int)(remain <= INT_MAX ? remain : INT_MAX);
|
||||||
|
|
||||||
|
just_wrote = BZ2_bzwrite(self->bz_file, (char*)buf, to_write);
|
||||||
|
|
||||||
|
if (just_wrote < 1) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
wrote += just_wrote;
|
||||||
|
|
||||||
|
} while (wrote < count);
|
||||||
|
|
||||||
|
return wrote;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int php_bz2iop_close(php_stream *stream, int close_handle TSRMLS_DC)
|
static int php_bz2iop_close(php_stream *stream, int close_handle TSRMLS_DC)
|
||||||
|
@ -262,7 +288,7 @@ PHP_BZ2_API php_stream *_php_stream_bz2open(php_stream_wrapper *wrapper,
|
||||||
if (stream) {
|
if (stream) {
|
||||||
php_socket_t fd;
|
php_socket_t fd;
|
||||||
if (SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD, (void **) &fd, REPORT_ERRORS)) {
|
if (SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD, (void **) &fd, REPORT_ERRORS)) {
|
||||||
bz_file = BZ2_bzdopen(fd, mode);
|
bz_file = BZ2_bzdopen((int)fd, mode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -439,7 +465,7 @@ static PHP_FUNCTION(bzopen)
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bz = BZ2_bzdopen(fd, mode);
|
bz = BZ2_bzdopen((int)fd, mode);
|
||||||
|
|
||||||
stream = php_stream_bz2open_from_BZFILE(bz, mode, stream);
|
stream = php_stream_bz2open_from_BZFILE(bz, mode, stream);
|
||||||
} else {
|
} else {
|
||||||
|
@ -554,7 +580,7 @@ static PHP_FUNCTION(bzdecompress)
|
||||||
bzs.bzalloc = NULL;
|
bzs.bzalloc = NULL;
|
||||||
bzs.bzfree = NULL;
|
bzs.bzfree = NULL;
|
||||||
|
|
||||||
if (BZ2_bzDecompressInit(&bzs, 0, small) != BZ_OK) {
|
if (BZ2_bzDecompressInit(&bzs, 0, (int)small) != BZ_OK) {
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -384,7 +384,7 @@ static php_stream_filter *php_bz2_filter_create(const char *filtername, zval *fi
|
||||||
if (Z_LVAL(tmp) < 1 || Z_LVAL(tmp) > 9) {
|
if (Z_LVAL(tmp) < 1 || Z_LVAL(tmp) > 9) {
|
||||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter given for number of blocks to allocate. (%pd)", Z_LVAL_P(tmpzval));
|
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter given for number of blocks to allocate. (%pd)", Z_LVAL_P(tmpzval));
|
||||||
} else {
|
} else {
|
||||||
blockSize100k = Z_LVAL(tmp);
|
blockSize100k = (int)Z_LVAL(tmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -398,7 +398,7 @@ static php_stream_filter *php_bz2_filter_create(const char *filtername, zval *fi
|
||||||
if (Z_LVAL(tmp) < 0 || Z_LVAL(tmp) > 250) {
|
if (Z_LVAL(tmp) < 0 || Z_LVAL(tmp) > 250) {
|
||||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter given for work factor. (%pd)", Z_LVAL(tmp));
|
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter given for work factor. (%pd)", Z_LVAL(tmp));
|
||||||
} else {
|
} else {
|
||||||
workFactor = Z_LVAL(tmp);
|
workFactor = (int)Z_LVAL(tmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ PHP_FUNCTION(com_create_instance)
|
||||||
php_com_dotnet_object *obj;
|
php_com_dotnet_object *obj;
|
||||||
char *module_name, *typelib_name = NULL, *server_name = NULL;
|
char *module_name, *typelib_name = NULL, *server_name = NULL;
|
||||||
char *user_name = NULL, *domain_name = NULL, *password = NULL;
|
char *user_name = NULL, *domain_name = NULL, *password = NULL;
|
||||||
size_t module_name_len, typelib_name_len, server_name_len,
|
size_t module_name_len = 0, typelib_name_len = 0, server_name_len = 0,
|
||||||
user_name_len, domain_name_len, password_len;
|
user_name_len, domain_name_len, password_len;
|
||||||
OLECHAR *moniker;
|
OLECHAR *moniker;
|
||||||
CLSID clsid;
|
CLSID clsid;
|
||||||
|
@ -129,11 +129,11 @@ PHP_FUNCTION(com_create_instance)
|
||||||
|
|
||||||
if (user_name) {
|
if (user_name) {
|
||||||
authid.User = php_com_string_to_olestring(user_name, -1, obj->code_page TSRMLS_CC);
|
authid.User = php_com_string_to_olestring(user_name, -1, obj->code_page TSRMLS_CC);
|
||||||
authid.UserLength = user_name_len;
|
authid.UserLength = (ULONG)user_name_len;
|
||||||
|
|
||||||
if (password) {
|
if (password) {
|
||||||
authid.Password = (OLECHAR*)password;
|
authid.Password = (OLECHAR*)password;
|
||||||
authid.PasswordLength = password_len;
|
authid.PasswordLength = (ULONG)password_len;
|
||||||
} else {
|
} else {
|
||||||
authid.Password = (OLECHAR*)"";
|
authid.Password = (OLECHAR*)"";
|
||||||
authid.PasswordLength = 0;
|
authid.PasswordLength = 0;
|
||||||
|
@ -141,7 +141,7 @@ PHP_FUNCTION(com_create_instance)
|
||||||
|
|
||||||
if (domain_name) {
|
if (domain_name) {
|
||||||
authid.Domain = (OLECHAR*)domain_name;
|
authid.Domain = (OLECHAR*)domain_name;
|
||||||
authid.DomainLength = domain_name_len;
|
authid.DomainLength = (ULONG)domain_name_len;
|
||||||
} else {
|
} else {
|
||||||
authid.Domain = (OLECHAR*)"";
|
authid.Domain = (OLECHAR*)"";
|
||||||
authid.DomainLength = 0;
|
authid.DomainLength = 0;
|
||||||
|
@ -254,7 +254,7 @@ PHP_FUNCTION(com_create_instance)
|
||||||
ITypeLib_Release(TL);
|
ITypeLib_Release(TL);
|
||||||
}
|
}
|
||||||
} else if (obj->typeinfo && COMG(autoreg_on)) {
|
} else if (obj->typeinfo && COMG(autoreg_on)) {
|
||||||
int idx;
|
UINT idx;
|
||||||
|
|
||||||
if (SUCCEEDED(ITypeInfo_GetContainingTypeLib(obj->typeinfo, &TL, &idx))) {
|
if (SUCCEEDED(ITypeInfo_GetContainingTypeLib(obj->typeinfo, &TL, &idx))) {
|
||||||
/* check if the library is already in the cache by getting its name */
|
/* check if the library is already in the cache by getting its name */
|
||||||
|
@ -288,7 +288,7 @@ PHP_FUNCTION(com_get_active_object)
|
||||||
{
|
{
|
||||||
CLSID clsid;
|
CLSID clsid;
|
||||||
char *module_name;
|
char *module_name;
|
||||||
int module_name_len;
|
size_t module_name_len;
|
||||||
zend_long code_page = COMG(code_page);
|
zend_long code_page = COMG(code_page);
|
||||||
IUnknown *unk = NULL;
|
IUnknown *unk = NULL;
|
||||||
IDispatch *obj = NULL;
|
IDispatch *obj = NULL;
|
||||||
|
@ -302,7 +302,7 @@ PHP_FUNCTION(com_get_active_object)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
module = php_com_string_to_olestring(module_name, module_name_len, code_page TSRMLS_CC);
|
module = php_com_string_to_olestring(module_name, module_name_len, (int)code_page TSRMLS_CC);
|
||||||
|
|
||||||
res = CLSIDFromString(module, &clsid);
|
res = CLSIDFromString(module, &clsid);
|
||||||
|
|
||||||
|
@ -320,7 +320,7 @@ PHP_FUNCTION(com_get_active_object)
|
||||||
php_com_throw_exception(res, NULL TSRMLS_CC);
|
php_com_throw_exception(res, NULL TSRMLS_CC);
|
||||||
} else if (obj) {
|
} else if (obj) {
|
||||||
/* we got our dispatchable object */
|
/* we got our dispatchable object */
|
||||||
php_com_wrap_dispatch(return_value, obj, code_page TSRMLS_CC);
|
php_com_wrap_dispatch(return_value, obj, (int)code_page TSRMLS_CC);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -427,7 +427,7 @@ HRESULT php_com_get_id_of_name(php_com_dotnet_object *obj, char *name,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj->id_of_name_cache && NULL != (tmp = zend_hash_str_find(obj->id_of_name_cache, name, namelen))) {
|
if (obj->id_of_name_cache && NULL != (tmp = zend_hash_str_find(obj->id_of_name_cache, name, namelen))) {
|
||||||
*dispid = Z_LVAL_P(tmp);
|
*dispid = (DISPID)Z_LVAL_P(tmp);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -474,8 +474,8 @@ int php_com_do_invoke_byref(php_com_dotnet_object *obj, zend_internal_function *
|
||||||
int i, byref_count = 0, j;
|
int i, byref_count = 0, j;
|
||||||
|
|
||||||
/* assumption: that the active function (f) is the function we generated for the engine */
|
/* assumption: that the active function (f) is the function we generated for the engine */
|
||||||
if (!f || f->arg_info == NULL) {
|
if (!f) {
|
||||||
f = NULL;
|
return FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
hr = php_com_get_id_of_name(obj, f->function_name->val, f->function_name->len, &dispid TSRMLS_CC);
|
hr = php_com_get_id_of_name(obj, f->function_name->val, f->function_name->len, &dispid TSRMLS_CC);
|
||||||
|
@ -496,7 +496,7 @@ int php_com_do_invoke_byref(php_com_dotnet_object *obj, zend_internal_function *
|
||||||
vargs = (VARIANT*)safe_emalloc(sizeof(VARIANT), nargs, 0);
|
vargs = (VARIANT*)safe_emalloc(sizeof(VARIANT), nargs, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (f) {
|
if (f->arg_info) {
|
||||||
for (i = 0; i < nargs; i++) {
|
for (i = 0; i < nargs; i++) {
|
||||||
if (f->arg_info[nargs - i - 1].pass_by_reference) {
|
if (f->arg_info[nargs - i - 1].pass_by_reference) {
|
||||||
byref_count++;
|
byref_count++;
|
||||||
|
@ -551,9 +551,10 @@ int php_com_do_invoke_byref(php_com_dotnet_object *obj, zend_internal_function *
|
||||||
|
|
||||||
/* release variants */
|
/* release variants */
|
||||||
if (vargs) {
|
if (vargs) {
|
||||||
|
if (f && f->arg_info) {
|
||||||
for (i = 0, j = 0; i < nargs; i++) {
|
for (i = 0, j = 0; i < nargs; i++) {
|
||||||
/* if this was byref, update the zval */
|
/* if this was byref, update the zval */
|
||||||
if (f && f->arg_info[nargs - i - 1].pass_by_reference) {
|
if (f->arg_info[nargs - i - 1].pass_by_reference) {
|
||||||
SEPARATE_ZVAL_IF_NOT_REF(&args[nargs - i - 1]);
|
SEPARATE_ZVAL_IF_NOT_REF(&args[nargs - i - 1]);
|
||||||
|
|
||||||
/* if the variant is pointing at the byref_vals, we need to map
|
/* if the variant is pointing at the byref_vals, we need to map
|
||||||
|
@ -576,6 +577,11 @@ int php_com_do_invoke_byref(php_com_dotnet_object *obj, zend_internal_function *
|
||||||
}
|
}
|
||||||
VariantClear(&vargs[i]);
|
VariantClear(&vargs[i]);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
for (i = 0, j = 0; i < nargs; i++) {
|
||||||
|
VariantClear(&vargs[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
efree(vargs);
|
efree(vargs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -631,7 +637,7 @@ int php_com_do_invoke_by_id(php_com_dotnet_object *obj, DISPID dispid,
|
||||||
return SUCCEEDED(hr) ? SUCCESS : FAILURE;
|
return SUCCEEDED(hr) ? SUCCESS : FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int php_com_do_invoke(php_com_dotnet_object *obj, char *name, int namelen,
|
int php_com_do_invoke(php_com_dotnet_object *obj, char *name, size_t namelen,
|
||||||
WORD flags, VARIANT *v, int nargs, zval *args, int allow_noarg TSRMLS_DC)
|
WORD flags, VARIANT *v, int nargs, zval *args, int allow_noarg TSRMLS_DC)
|
||||||
{
|
{
|
||||||
DISPID dispid;
|
DISPID dispid;
|
||||||
|
@ -687,7 +693,6 @@ PHP_FUNCTION(com_event_sink)
|
||||||
{
|
{
|
||||||
zval *object, *sinkobject, *sink=NULL;
|
zval *object, *sinkobject, *sink=NULL;
|
||||||
char *dispname = NULL, *typelibname = NULL;
|
char *dispname = NULL, *typelibname = NULL;
|
||||||
zend_bool gotguid = 0;
|
|
||||||
php_com_dotnet_object *obj;
|
php_com_dotnet_object *obj;
|
||||||
ITypeInfo *typeinfo = NULL;
|
ITypeInfo *typeinfo = NULL;
|
||||||
|
|
||||||
|
@ -791,7 +796,7 @@ PHP_FUNCTION(com_message_pump)
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
|
|
||||||
php_com_initialize(TSRMLS_C);
|
php_com_initialize(TSRMLS_C);
|
||||||
result = MsgWaitForMultipleObjects(0, NULL, FALSE, timeoutms, QS_ALLINPUT);
|
result = MsgWaitForMultipleObjects(0, NULL, FALSE, (DWORD)timeoutms, QS_ALLINPUT);
|
||||||
|
|
||||||
if (result == WAIT_OBJECT_0) {
|
if (result == WAIT_OBJECT_0) {
|
||||||
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
|
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
|
||||||
|
|
|
@ -393,7 +393,7 @@ PHP_MINIT_FUNCTION(com_dotnet)
|
||||||
|
|
||||||
#define COM_ERR_CONST(x) { \
|
#define COM_ERR_CONST(x) { \
|
||||||
zend_long __tmp; \
|
zend_long __tmp; \
|
||||||
ULongToUIntPtr(x, &__tmp); \
|
ULongToIntPtr(x, &__tmp); \
|
||||||
REGISTER_LONG_CONSTANT(#x, __tmp, CONST_CS|CONST_PERSISTENT); \
|
REGISTER_LONG_CONSTANT(#x, __tmp, CONST_CS|CONST_PERSISTENT); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -460,6 +460,10 @@ PHP_MINIT_FUNCTION(com_dotnet)
|
||||||
COM_ERR_CONST(DISP_E_BADINDEX);
|
COM_ERR_CONST(DISP_E_BADINDEX);
|
||||||
COM_ERR_CONST(MK_E_UNAVAILABLE);
|
COM_ERR_CONST(MK_E_UNAVAILABLE);
|
||||||
|
|
||||||
|
#if SIZEOF_ZEND_LONG == 8
|
||||||
|
COM_CONST(VT_UI8);
|
||||||
|
COM_CONST(VT_I8);
|
||||||
|
#endif
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
|
@ -101,7 +101,7 @@ static zval *com_read_dimension(zval *object, zval *offset, int type, zval *rv T
|
||||||
convert_to_long(offset);
|
convert_to_long(offset);
|
||||||
|
|
||||||
if (SafeArrayGetDim(V_ARRAY(&obj->v)) == 1) {
|
if (SafeArrayGetDim(V_ARRAY(&obj->v)) == 1) {
|
||||||
if (php_com_safearray_get_elem(&obj->v, &v, Z_LVAL_P(offset) TSRMLS_CC)) {
|
if (php_com_safearray_get_elem(&obj->v, &v, (LONG)Z_LVAL_P(offset) TSRMLS_CC)) {
|
||||||
php_com_wrap_variant(rv, &v, obj->code_page TSRMLS_CC);
|
php_com_wrap_variant(rv, &v, obj->code_page TSRMLS_CC);
|
||||||
VariantClear(&v);
|
VariantClear(&v);
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,7 @@ static void com_write_dimension(zval *object, zval *offset, zval *value TSRMLS_D
|
||||||
}
|
}
|
||||||
|
|
||||||
convert_to_long(offset);
|
convert_to_long(offset);
|
||||||
indices = Z_LVAL_P(offset);
|
indices = (LONG)Z_LVAL_P(offset);
|
||||||
|
|
||||||
VariantInit(&v);
|
VariantInit(&v);
|
||||||
php_com_variant_from_zval(&v, value, obj->code_page TSRMLS_CC);
|
php_com_variant_from_zval(&v, value, obj->code_page TSRMLS_CC);
|
||||||
|
|
|
@ -36,7 +36,11 @@ void php_com_throw_exception(HRESULT code, char *message TSRMLS_DC)
|
||||||
message = php_win32_error_to_msg(code);
|
message = php_win32_error_to_msg(code);
|
||||||
free_msg = 1;
|
free_msg = 1;
|
||||||
}
|
}
|
||||||
|
#if SIZEOF_ZEND_LONG == 8
|
||||||
|
zend_throw_exception(php_com_exception_class_entry, message, (zend_long)(uint32_t)code TSRMLS_CC);
|
||||||
|
#else
|
||||||
zend_throw_exception(php_com_exception_class_entry, message, (zend_long)code TSRMLS_CC);
|
zend_throw_exception(php_com_exception_class_entry, message, (zend_long)code TSRMLS_CC);
|
||||||
|
#endif
|
||||||
if (free_msg) {
|
if (free_msg) {
|
||||||
LocalFree(message);
|
LocalFree(message);
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ PHP_COM_DOTNET_API OLECHAR *php_com_string_to_olestring(char *string, size_t str
|
||||||
/* XXX if that's a real multibyte string, olestring is obviously allocated excessively.
|
/* XXX if that's a real multibyte string, olestring is obviously allocated excessively.
|
||||||
This should be fixed by reallocating the olestring, but as emalloc is used, that doesn't
|
This should be fixed by reallocating the olestring, but as emalloc is used, that doesn't
|
||||||
matter much. */
|
matter much. */
|
||||||
ok = MultiByteToWideChar(codepage, flags, string, string_len, olestring, string_len);
|
ok = MultiByteToWideChar(codepage, flags, string, (int)string_len, olestring, (int)string_len);
|
||||||
if (ok > 0 && ok < string_len) {
|
if (ok > 0 && ok < string_len) {
|
||||||
olestring[ok] = '\0';
|
olestring[ok] = '\0';
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,10 +105,10 @@ static ULONG STDMETHODCALLTYPE stm_release(IStream *This)
|
||||||
|
|
||||||
static HRESULT STDMETHODCALLTYPE stm_read(IStream *This, void *pv, ULONG cb, ULONG *pcbRead)
|
static HRESULT STDMETHODCALLTYPE stm_read(IStream *This, void *pv, ULONG cb, ULONG *pcbRead)
|
||||||
{
|
{
|
||||||
int nread;
|
ULONG nread;
|
||||||
FETCH_STM();
|
FETCH_STM();
|
||||||
|
|
||||||
nread = php_stream_read(stm->stream, pv, cb);
|
nread = (ULONG)php_stream_read(stm->stream, pv, cb);
|
||||||
|
|
||||||
if (pcbRead) {
|
if (pcbRead) {
|
||||||
*pcbRead = nread > 0 ? nread : 0;
|
*pcbRead = nread > 0 ? nread : 0;
|
||||||
|
@ -121,10 +121,10 @@ static HRESULT STDMETHODCALLTYPE stm_read(IStream *This, void *pv, ULONG cb, ULO
|
||||||
|
|
||||||
static HRESULT STDMETHODCALLTYPE stm_write(IStream *This, void const *pv, ULONG cb, ULONG *pcbWritten)
|
static HRESULT STDMETHODCALLTYPE stm_write(IStream *This, void const *pv, ULONG cb, ULONG *pcbWritten)
|
||||||
{
|
{
|
||||||
int nwrote;
|
ULONG nwrote;
|
||||||
FETCH_STM();
|
FETCH_STM();
|
||||||
|
|
||||||
nwrote = php_stream_write(stm->stream, pv, cb);
|
nwrote = (ULONG)php_stream_write(stm->stream, pv, cb);
|
||||||
|
|
||||||
if (pcbWritten) {
|
if (pcbWritten) {
|
||||||
*pcbWritten = nwrote > 0 ? nwrote : 0;
|
*pcbWritten = nwrote > 0 ? nwrote : 0;
|
||||||
|
@ -466,7 +466,7 @@ CPH_METHOD(LoadFromFile)
|
||||||
olefilename = php_com_string_to_olestring(fullpath, strlen(fullpath), helper->codepage TSRMLS_CC);
|
olefilename = php_com_string_to_olestring(fullpath, strlen(fullpath), helper->codepage TSRMLS_CC);
|
||||||
efree(fullpath);
|
efree(fullpath);
|
||||||
|
|
||||||
res = IPersistFile_Load(helper->ipf, olefilename, flags);
|
res = IPersistFile_Load(helper->ipf, olefilename, (DWORD)flags);
|
||||||
efree(olefilename);
|
efree(olefilename);
|
||||||
|
|
||||||
if (FAILED(res)) {
|
if (FAILED(res)) {
|
||||||
|
|
|
@ -167,11 +167,11 @@ static zval *saproxy_read_dimension(zval *object, zval *offset, int type, zval *
|
||||||
/* copy indices from proxy */
|
/* copy indices from proxy */
|
||||||
for (i = 0; i < dims; i++) {
|
for (i = 0; i < dims; i++) {
|
||||||
convert_to_long(&proxy->indices[i]);
|
convert_to_long(&proxy->indices[i]);
|
||||||
indices[i] = Z_LVAL(proxy->indices[i]);
|
indices[i] = (LONG)Z_LVAL(proxy->indices[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* add user-supplied index */
|
/* add user-supplied index */
|
||||||
indices[dims-1] = Z_LVAL_P(offset);
|
indices[dims-1] = (LONG)Z_LVAL_P(offset);
|
||||||
|
|
||||||
/* now fetch the value */
|
/* now fetch the value */
|
||||||
if (FAILED(SafeArrayGetVartype(sa, &vt)) || vt == VT_EMPTY) {
|
if (FAILED(SafeArrayGetVartype(sa, &vt)) || vt == VT_EMPTY) {
|
||||||
|
@ -241,12 +241,12 @@ static void saproxy_write_dimension(zval *object, zval *offset, zval *value TSRM
|
||||||
/* copy indices from proxy */
|
/* copy indices from proxy */
|
||||||
for (i = 0; i < dims; i++) {
|
for (i = 0; i < dims; i++) {
|
||||||
convert_to_long(&proxy->indices[i]);
|
convert_to_long(&proxy->indices[i]);
|
||||||
indices[i] = Z_LVAL(proxy->indices[i]);
|
indices[i] = (LONG)Z_LVAL(proxy->indices[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* add user-supplied index */
|
/* add user-supplied index */
|
||||||
convert_to_long(offset);
|
convert_to_long(offset);
|
||||||
indices[dims-1] = Z_LVAL_P(offset);
|
indices[dims-1] = (LONG)Z_LVAL_P(offset);
|
||||||
|
|
||||||
if (FAILED(SafeArrayGetVartype(V_ARRAY(&proxy->obj->v), &vt)) || vt == VT_EMPTY) {
|
if (FAILED(SafeArrayGetVartype(V_ARRAY(&proxy->obj->v), &vt)) || vt == VT_EMPTY) {
|
||||||
vt = V_VT(&proxy->obj->v) & ~VT_ARRAY;
|
vt = V_VT(&proxy->obj->v) & ~VT_ARRAY;
|
||||||
|
@ -555,7 +555,7 @@ zend_object_iterator *php_com_saproxy_iter_get(zend_class_entry *ce, zval *objec
|
||||||
I->indices = safe_emalloc(proxy->dimensions + 1, sizeof(LONG), 0);
|
I->indices = safe_emalloc(proxy->dimensions + 1, sizeof(LONG), 0);
|
||||||
for (i = 0; i < proxy->dimensions; i++) {
|
for (i = 0; i < proxy->dimensions; i++) {
|
||||||
convert_to_long(&proxy->indices[i]);
|
convert_to_long(&proxy->indices[i]);
|
||||||
I->indices[i] = Z_LVAL(proxy->indices[i]);
|
I->indices[i] = (LONG)Z_LVAL(proxy->indices[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
SafeArrayGetLBound(V_ARRAY(&proxy->obj->v), proxy->dimensions, &I->imin);
|
SafeArrayGetLBound(V_ARRAY(&proxy->obj->v), proxy->dimensions, &I->imin);
|
||||||
|
|
|
@ -71,7 +71,7 @@ PHP_COM_DOTNET_API ITypeLib *php_com_load_typelib(char *search_string, int codep
|
||||||
if (FAILED(hr) && (major == NULL || minor == NULL)) {
|
if (FAILED(hr) && (major == NULL || minor == NULL)) {
|
||||||
IDispatch *disp = NULL;
|
IDispatch *disp = NULL;
|
||||||
ITypeInfo *info = NULL;
|
ITypeInfo *info = NULL;
|
||||||
int idx;
|
UINT idx;
|
||||||
|
|
||||||
if (SUCCEEDED(hr = CoCreateInstance(&clsid, NULL, CLSCTX_SERVER, &IID_IDispatch, (LPVOID*)&disp)) &&
|
if (SUCCEEDED(hr = CoCreateInstance(&clsid, NULL, CLSCTX_SERVER, &IID_IDispatch, (LPVOID*)&disp)) &&
|
||||||
SUCCEEDED(hr = IDispatch_GetTypeInfo(disp, 0, LANG_NEUTRAL, &info))) {
|
SUCCEEDED(hr = IDispatch_GetTypeInfo(disp, 0, LANG_NEUTRAL, &info))) {
|
||||||
|
@ -96,7 +96,7 @@ PHP_COM_DOTNET_API ITypeLib *php_com_load_typelib(char *search_string, int codep
|
||||||
DWORD VersionCount;
|
DWORD VersionCount;
|
||||||
char version[20];
|
char version[20];
|
||||||
char *libname;
|
char *libname;
|
||||||
DWORD libnamelen;
|
long libnamelen;
|
||||||
|
|
||||||
if (ERROR_SUCCESS == RegOpenKeyEx(HKEY_CLASSES_ROOT, "TypeLib", 0, KEY_READ, &hkey) &&
|
if (ERROR_SUCCESS == RegOpenKeyEx(HKEY_CLASSES_ROOT, "TypeLib", 0, KEY_READ, &hkey) &&
|
||||||
ERROR_SUCCESS == RegQueryInfoKey(hkey, NULL, NULL, NULL, &SubKeys,
|
ERROR_SUCCESS == RegQueryInfoKey(hkey, NULL, NULL, NULL, &SubKeys,
|
||||||
|
@ -116,7 +116,7 @@ PHP_COM_DOTNET_API ITypeLib *php_com_load_typelib(char *search_string, int codep
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
/* get the default value for this key and compare */
|
/* get the default value for this key and compare */
|
||||||
libnamelen = strlen(search_string)+1;
|
libnamelen = (long)strlen(search_string)+1;
|
||||||
if (ERROR_SUCCESS == RegQueryValue(hsubkey, version, libname, &libnamelen)) {
|
if (ERROR_SUCCESS == RegQueryValue(hsubkey, version, libname, &libnamelen)) {
|
||||||
if (0 == stricmp(libname, search_string)) {
|
if (0 == stricmp(libname, search_string)) {
|
||||||
char *str = NULL;
|
char *str = NULL;
|
||||||
|
@ -234,7 +234,7 @@ PHP_COM_DOTNET_API ITypeLib *php_com_load_typelib_via_cache(char *search_string,
|
||||||
{
|
{
|
||||||
ITypeLib *TL;
|
ITypeLib *TL;
|
||||||
char *name_dup;
|
char *name_dup;
|
||||||
int l;
|
size_t l;
|
||||||
|
|
||||||
l = strlen(search_string);
|
l = strlen(search_string);
|
||||||
|
|
||||||
|
|
|
@ -39,8 +39,7 @@ static void safe_array_from_zval(VARIANT *v, zval *z, int codepage TSRMLS_DC)
|
||||||
HashPosition pos;
|
HashPosition pos;
|
||||||
int keytype;
|
int keytype;
|
||||||
zend_string *strindex;
|
zend_string *strindex;
|
||||||
zend_long intindex = -1;
|
zend_ulong intindex = 0;
|
||||||
zend_long max_index = 0;
|
|
||||||
VARIANT *va;
|
VARIANT *va;
|
||||||
zval *item;
|
zval *item;
|
||||||
|
|
||||||
|
@ -54,15 +53,15 @@ static void safe_array_from_zval(VARIANT *v, zval *z, int codepage TSRMLS_DC)
|
||||||
goto bogus;
|
goto bogus;
|
||||||
} else if (HASH_KEY_NON_EXISTENT == keytype) {
|
} else if (HASH_KEY_NON_EXISTENT == keytype) {
|
||||||
break;
|
break;
|
||||||
}
|
} else if (intindex > UINT_MAX) {
|
||||||
if (intindex > max_index) {
|
php_error_docref(NULL TSRMLS_CC, E_WARNING, "COM: max number %u of elements in safe array exceeded", UINT_MAX);
|
||||||
max_index = intindex;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* allocate the structure */
|
/* allocate the structure */
|
||||||
bound.lLbound = 0;
|
bound.lLbound = 0;
|
||||||
bound.cElements = intindex + 1;
|
bound.cElements = zend_hash_num_elements(HASH_OF(z));
|
||||||
sa = SafeArrayCreate(VT_VARIANT, 1, &bound);
|
sa = SafeArrayCreate(VT_VARIANT, 1, &bound);
|
||||||
|
|
||||||
/* get a lock on the array itself */
|
/* get a lock on the array itself */
|
||||||
|
@ -146,8 +145,13 @@ PHP_COM_DOTNET_API void php_com_variant_from_zval(VARIANT *v, zval *z, int codep
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IS_LONG:
|
case IS_LONG:
|
||||||
|
#if SIZEOF_ZEND_LONG == 4
|
||||||
V_VT(v) = VT_I4;
|
V_VT(v) = VT_I4;
|
||||||
V_I4(v) = Z_LVAL_P(z);
|
V_I4(v) = Z_LVAL_P(z);
|
||||||
|
#else
|
||||||
|
V_VT(v) = VT_I8;
|
||||||
|
V_I8(v) = Z_LVAL_P(z);
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IS_DOUBLE:
|
case IS_DOUBLE:
|
||||||
|
@ -159,9 +163,9 @@ PHP_COM_DOTNET_API void php_com_variant_from_zval(VARIANT *v, zval *z, int codep
|
||||||
V_VT(v) = VT_BSTR;
|
V_VT(v) = VT_BSTR;
|
||||||
olestring = php_com_string_to_olestring(Z_STRVAL_P(z), Z_STRLEN_P(z), codepage TSRMLS_CC);
|
olestring = php_com_string_to_olestring(Z_STRVAL_P(z), Z_STRLEN_P(z), codepage TSRMLS_CC);
|
||||||
if (CP_UTF8 == codepage) {
|
if (CP_UTF8 == codepage) {
|
||||||
V_BSTR(v) = SysAllocStringByteLen((char*)olestring, wcslen(olestring) * sizeof(OLECHAR));
|
V_BSTR(v) = SysAllocStringByteLen((char*)olestring, (UINT)(wcslen(olestring) * sizeof(OLECHAR)));
|
||||||
} else {
|
} else {
|
||||||
V_BSTR(v) = SysAllocStringByteLen((char*)olestring, Z_STRLEN_P(z) * sizeof(OLECHAR));
|
V_BSTR(v) = SysAllocStringByteLen((char*)olestring, (UINT)(Z_STRLEN_P(z) * sizeof(OLECHAR)));
|
||||||
}
|
}
|
||||||
efree(olestring);
|
efree(olestring);
|
||||||
break;
|
break;
|
||||||
|
@ -199,11 +203,19 @@ PHP_COM_DOTNET_API int php_com_zval_from_variant(zval *z, VARIANT *v, int codepa
|
||||||
ZVAL_LONG(z, (zend_long)V_I2(v));
|
ZVAL_LONG(z, (zend_long)V_I2(v));
|
||||||
break;
|
break;
|
||||||
case VT_UI4: /* TODO: promote to double if large? */
|
case VT_UI4: /* TODO: promote to double if large? */
|
||||||
ZVAL_LONG(z, (zend_long)V_UI4(v));
|
ZVAL_LONG(z, (long)V_UI4(v));
|
||||||
break;
|
break;
|
||||||
case VT_I4:
|
case VT_I4:
|
||||||
ZVAL_LONG(z, (zend_long)V_I4(v));
|
ZVAL_LONG(z, (long)V_I4(v));
|
||||||
break;
|
break;
|
||||||
|
#if SIZEOF_ZEND_LONG == 8
|
||||||
|
case VT_UI8:
|
||||||
|
ZVAL_LONG(z, (zend_long)V_UI8(v));
|
||||||
|
break;
|
||||||
|
case VT_I8:
|
||||||
|
ZVAL_LONG(z, (zend_long)V_I8(v));
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
case VT_INT:
|
case VT_INT:
|
||||||
ZVAL_LONG(z, V_INT(v));
|
ZVAL_LONG(z, V_INT(v));
|
||||||
break;
|
break;
|
||||||
|
@ -328,7 +340,23 @@ PHP_COM_DOTNET_API int php_com_copy_variant(VARIANT *dstvar, VARIANT *srcvar TSR
|
||||||
V_I4(dstvar) = V_I4(srcvar);
|
V_I4(dstvar) = V_I4(srcvar);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
#if SIZEOF_ZEND_LONG == 8
|
||||||
|
case VT_UI8:
|
||||||
|
if (V_VT(dstvar) & VT_BYREF) {
|
||||||
|
*V_UI8REF(dstvar) = V_UI8(srcvar);
|
||||||
|
} else {
|
||||||
|
V_UI8(dstvar) = V_UI8(srcvar);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VT_I8:
|
||||||
|
if (V_VT(dstvar) & VT_BYREF) {
|
||||||
|
*V_I8REF(dstvar) = V_I8(srcvar);
|
||||||
|
} else {
|
||||||
|
V_I8(dstvar) = V_I8(srcvar);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
case VT_INT:
|
case VT_INT:
|
||||||
if (V_VT(dstvar) & VT_BYREF) {
|
if (V_VT(dstvar) & VT_BYREF) {
|
||||||
*V_INTREF(dstvar) = V_INT(srcvar);
|
*V_INTREF(dstvar) = V_INT(srcvar);
|
||||||
|
@ -428,7 +456,7 @@ PHP_FUNCTION(com_variant_create_instance)
|
||||||
|
|
||||||
php_com_initialize(TSRMLS_C);
|
php_com_initialize(TSRMLS_C);
|
||||||
if (ZEND_NUM_ARGS() == 3) {
|
if (ZEND_NUM_ARGS() == 3) {
|
||||||
obj->code_page = codepage;
|
obj->code_page = (int)codepage;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (zvalue) {
|
if (zvalue) {
|
||||||
|
@ -849,7 +877,7 @@ PHP_FUNCTION(variant_round)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SUCCEEDED(VarRound(vleft, decimals, &vres))) {
|
if (SUCCEEDED(VarRound(vleft, (int)decimals, &vres))) {
|
||||||
php_com_wrap_variant(return_value, &vres, codepage TSRMLS_CC);
|
php_com_wrap_variant(return_value, &vres, codepage TSRMLS_CC);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -909,7 +937,7 @@ PHP_FUNCTION(variant_cmp)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ZVAL_LONG(return_value, VarCmp(vleft, vright, lcid, flags));
|
ZVAL_LONG(return_value, VarCmp(vleft, vright, (LCID)lcid, (ULONG)flags));
|
||||||
|
|
||||||
VariantClear(&left_val);
|
VariantClear(&left_val);
|
||||||
VariantClear(&right_val);
|
VariantClear(&right_val);
|
||||||
|
|
|
@ -186,7 +186,7 @@ static HRESULT STDMETHODCALLTYPE disp_getidsofnames(
|
||||||
ret = DISP_E_UNKNOWNNAME;
|
ret = DISP_E_UNKNOWNNAME;
|
||||||
rgDispId[i] = 0;
|
rgDispId[i] = 0;
|
||||||
} else {
|
} else {
|
||||||
rgDispId[i] = Z_LVAL_P(tmp);
|
rgDispId[i] = (DISPID)Z_LVAL_P(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
efree(name);
|
efree(name);
|
||||||
|
@ -231,7 +231,7 @@ static HRESULT STDMETHODCALLTYPE disp_getdispid(
|
||||||
/* Lookup the name in the hash */
|
/* Lookup the name in the hash */
|
||||||
if ((tmp = zend_hash_str_find(disp->name_to_dispid, name, namelen)) != NULL) {
|
if ((tmp = zend_hash_str_find(disp->name_to_dispid, name, namelen)) != NULL) {
|
||||||
trace("found it\n");
|
trace("found it\n");
|
||||||
*pid = Z_LVAL_P(tmp);
|
*pid = (DISPID)Z_LVAL_P(tmp);
|
||||||
ret = S_OK;
|
ret = S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,8 +37,9 @@ typedef struct _php_com_dotnet_object {
|
||||||
VARIANT v;
|
VARIANT v;
|
||||||
int modified;
|
int modified;
|
||||||
|
|
||||||
|
int code_page;
|
||||||
|
|
||||||
ITypeInfo *typeinfo;
|
ITypeInfo *typeinfo;
|
||||||
zend_long code_page;
|
|
||||||
|
|
||||||
zend_class_entry *ce;
|
zend_class_entry *ce;
|
||||||
|
|
||||||
|
@ -107,7 +108,7 @@ HRESULT php_com_get_id_of_name(php_com_dotnet_object *obj, char *name,
|
||||||
size_t namelen, DISPID *dispid TSRMLS_DC);
|
size_t namelen, DISPID *dispid TSRMLS_DC);
|
||||||
int php_com_do_invoke_by_id(php_com_dotnet_object *obj, DISPID dispid,
|
int php_com_do_invoke_by_id(php_com_dotnet_object *obj, DISPID dispid,
|
||||||
WORD flags, VARIANT *v, int nargs, zval *args, int silent, int allow_noarg TSRMLS_DC);
|
WORD flags, VARIANT *v, int nargs, zval *args, int silent, int allow_noarg TSRMLS_DC);
|
||||||
int php_com_do_invoke(php_com_dotnet_object *obj, char *name, int namelen,
|
int php_com_do_invoke(php_com_dotnet_object *obj, char *name, size_t namelen,
|
||||||
WORD flags, VARIANT *v, int nargs, zval *args, int allow_noarg TSRMLS_DC);
|
WORD flags, VARIANT *v, int nargs, zval *args, int allow_noarg TSRMLS_DC);
|
||||||
int php_com_do_invoke_byref(php_com_dotnet_object *obj, zend_internal_function *f,
|
int php_com_do_invoke_byref(php_com_dotnet_object *obj, zend_internal_function *f,
|
||||||
WORD flags, VARIANT *v, int nargs, zval *args TSRMLS_DC);
|
WORD flags, VARIANT *v, int nargs, zval *args TSRMLS_DC);
|
||||||
|
|
|
@ -2,7 +2,9 @@
|
||||||
Bug #33386 (ScriptControl only sees last function of class)
|
Bug #33386 (ScriptControl only sees last function of class)
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
if (!extension_loaded("com_dotnet")) print "skip COM/.Net support not present"; ?>
|
if (!extension_loaded("com_dotnet")) print "skip COM/.Net support not present";
|
||||||
|
if (4 != PHP_INT_SIZE) print "skip MSScriptControl isn't available under x64";
|
||||||
|
?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
error_reporting(E_ALL);
|
error_reporting(E_ALL);
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
COM: General variant tests
|
COM: General variant tests
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php # vim:ft=php
|
<?php # vim:ft=php
|
||||||
if (!extension_loaded("com_dotnet")) print "skip COM/.Net support not present"; ?>
|
if (!extension_loaded("com_dotnet")) print "skip COM/.Net support not present";
|
||||||
|
if (4 != PHP_INT_SIZE) print "skip x86 only"; ?>
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php // $Id$
|
<?php // $Id$
|
||||||
error_reporting(E_ALL);
|
error_reporting(E_ALL);
|
||||||
|
|
638
ext/com_dotnet/tests/variants_x64.phpt
Normal file
638
ext/com_dotnet/tests/variants_x64.phpt
Normal file
|
@ -0,0 +1,638 @@
|
||||||
|
--TEST--
|
||||||
|
COM: General variant tests
|
||||||
|
--SKIPIF--
|
||||||
|
<?php # vim:ft=php
|
||||||
|
if (!extension_loaded("com_dotnet")) print "skip COM/.Net support not present";
|
||||||
|
if (8 != PHP_INT_SIZE) print "skip x64 only"; ?>
|
||||||
|
--FILE--
|
||||||
|
<?php // $Id$
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
|
||||||
|
$v = new VARIANT();
|
||||||
|
if (VT_EMPTY != variant_get_type($v)) {
|
||||||
|
echo "VT_EMPTY: bork\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
$values = array(VT_I8 => 42, VT_R8 => 3.5, VT_BSTR => "hello", VT_BOOL => false);
|
||||||
|
$binary_ops = array('add', 'cat', 'sub', 'mul', 'and', 'div',
|
||||||
|
'eqv', 'idiv', 'imp', 'mod', 'or', 'pow', 'xor');
|
||||||
|
|
||||||
|
foreach ($values as $t => $val) {
|
||||||
|
$v = new VARIANT($val);
|
||||||
|
if ($t != variant_get_type($v)) {
|
||||||
|
printf("Bork: [%d] %d: %s\n", $t, variant_get_type($v), $val);
|
||||||
|
print $v . "\n";
|
||||||
|
}
|
||||||
|
$results = array();
|
||||||
|
|
||||||
|
foreach ($values as $op2) {
|
||||||
|
echo "--\n";
|
||||||
|
foreach ($binary_ops as $op) {
|
||||||
|
try {
|
||||||
|
echo "$op: " . call_user_func('variant_' . $op, $v, $op2) . "\n";
|
||||||
|
} catch (com_exception $e) {
|
||||||
|
echo "$op:\n";
|
||||||
|
echo "\tvariant_$op($v, $op2)\n";
|
||||||
|
echo "\texception " . $e->getMessage();
|
||||||
|
printf("\tcode %08x\n\n", $e->getCode());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "OK!";
|
||||||
|
?>
|
||||||
|
--EXPECT--
|
||||||
|
--
|
||||||
|
add: 84
|
||||||
|
cat: 4242
|
||||||
|
sub: 0
|
||||||
|
mul: 1764
|
||||||
|
and: 42
|
||||||
|
div: 1
|
||||||
|
eqv: -1
|
||||||
|
idiv: 1
|
||||||
|
imp: -1
|
||||||
|
mod: 0
|
||||||
|
or: 42
|
||||||
|
pow: 1.50130937545297E+68
|
||||||
|
xor: 0
|
||||||
|
--
|
||||||
|
add: 45.5
|
||||||
|
cat: 423.5
|
||||||
|
sub: 38.5
|
||||||
|
mul: 147
|
||||||
|
and: 0
|
||||||
|
div: 12
|
||||||
|
eqv: -47
|
||||||
|
idiv: 10
|
||||||
|
imp: -43
|
||||||
|
mod: 2
|
||||||
|
or: 46
|
||||||
|
pow: 480145.116863642
|
||||||
|
xor: 46
|
||||||
|
--
|
||||||
|
add:
|
||||||
|
variant_add(42, hello)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
cat: 42hello
|
||||||
|
sub:
|
||||||
|
variant_sub(42, hello)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
mul:
|
||||||
|
variant_mul(42, hello)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
and:
|
||||||
|
variant_and(42, hello)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
div:
|
||||||
|
variant_div(42, hello)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
eqv:
|
||||||
|
variant_eqv(42, hello)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
idiv:
|
||||||
|
variant_idiv(42, hello)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
imp:
|
||||||
|
variant_imp(42, hello)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
mod:
|
||||||
|
variant_mod(42, hello)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
or:
|
||||||
|
variant_or(42, hello)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
pow:
|
||||||
|
variant_pow(42, hello)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
xor:
|
||||||
|
variant_xor(42, hello)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
--
|
||||||
|
add: 42
|
||||||
|
cat: 42False
|
||||||
|
sub: 42
|
||||||
|
mul: 0
|
||||||
|
and: 0
|
||||||
|
div:
|
||||||
|
variant_div(42, )
|
||||||
|
exception Division by zero.
|
||||||
|
code 80020012
|
||||||
|
|
||||||
|
eqv: -43
|
||||||
|
idiv:
|
||||||
|
variant_idiv(42, )
|
||||||
|
exception Division by zero.
|
||||||
|
code 80020012
|
||||||
|
|
||||||
|
imp: -43
|
||||||
|
mod:
|
||||||
|
variant_mod(42, )
|
||||||
|
exception Division by zero.
|
||||||
|
code 80020012
|
||||||
|
|
||||||
|
or: 42
|
||||||
|
pow: 1
|
||||||
|
xor: 42
|
||||||
|
--
|
||||||
|
add: 45.5
|
||||||
|
cat: 3.542
|
||||||
|
sub: -38.5
|
||||||
|
mul: 147
|
||||||
|
and: 0
|
||||||
|
div: 8.33333333333333E-02
|
||||||
|
eqv: -47
|
||||||
|
idiv: 0
|
||||||
|
imp: -5
|
||||||
|
mod: 4
|
||||||
|
or: 46
|
||||||
|
pow: 7.09345573078604E+22
|
||||||
|
xor: 46
|
||||||
|
--
|
||||||
|
add: 7
|
||||||
|
cat: 3.53.5
|
||||||
|
sub: 0
|
||||||
|
mul: 12.25
|
||||||
|
and: 4
|
||||||
|
div: 1
|
||||||
|
eqv: -1
|
||||||
|
idiv: 1
|
||||||
|
imp: -1
|
||||||
|
mod: 0
|
||||||
|
or: 4
|
||||||
|
pow: 80.2117802289664
|
||||||
|
xor: 0
|
||||||
|
--
|
||||||
|
add:
|
||||||
|
variant_add(3.5, hello)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
cat: 3.5hello
|
||||||
|
sub:
|
||||||
|
variant_sub(3.5, hello)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
mul:
|
||||||
|
variant_mul(3.5, hello)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
and:
|
||||||
|
variant_and(3.5, hello)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
div:
|
||||||
|
variant_div(3.5, hello)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
eqv:
|
||||||
|
variant_eqv(3.5, hello)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
idiv:
|
||||||
|
variant_idiv(3.5, hello)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
imp:
|
||||||
|
variant_imp(3.5, hello)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
mod:
|
||||||
|
variant_mod(3.5, hello)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
or:
|
||||||
|
variant_or(3.5, hello)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
pow:
|
||||||
|
variant_pow(3.5, hello)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
xor:
|
||||||
|
variant_xor(3.5, hello)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
--
|
||||||
|
add: 3.5
|
||||||
|
cat: 3.5False
|
||||||
|
sub: 3.5
|
||||||
|
mul: 0
|
||||||
|
and: 0
|
||||||
|
div:
|
||||||
|
variant_div(3.5, )
|
||||||
|
exception Division by zero.
|
||||||
|
code 80020012
|
||||||
|
|
||||||
|
eqv: -5
|
||||||
|
idiv:
|
||||||
|
variant_idiv(3.5, )
|
||||||
|
exception Division by zero.
|
||||||
|
code 80020012
|
||||||
|
|
||||||
|
imp: -5
|
||||||
|
mod:
|
||||||
|
variant_mod(3.5, )
|
||||||
|
exception Division by zero.
|
||||||
|
code 80020012
|
||||||
|
|
||||||
|
or: 4
|
||||||
|
pow: 1
|
||||||
|
xor: 4
|
||||||
|
--
|
||||||
|
add:
|
||||||
|
variant_add(hello, 42)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
cat: hello42
|
||||||
|
sub:
|
||||||
|
variant_sub(hello, 42)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
mul:
|
||||||
|
variant_mul(hello, 42)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
and:
|
||||||
|
variant_and(hello, 42)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
div:
|
||||||
|
variant_div(hello, 42)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
eqv:
|
||||||
|
variant_eqv(hello, 42)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
idiv:
|
||||||
|
variant_idiv(hello, 42)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
imp:
|
||||||
|
variant_imp(hello, 42)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
mod:
|
||||||
|
variant_mod(hello, 42)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
or:
|
||||||
|
variant_or(hello, 42)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
pow:
|
||||||
|
variant_pow(hello, 42)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
xor:
|
||||||
|
variant_xor(hello, 42)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
--
|
||||||
|
add:
|
||||||
|
variant_add(hello, 3.5)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
cat: hello3.5
|
||||||
|
sub:
|
||||||
|
variant_sub(hello, 3.5)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
mul:
|
||||||
|
variant_mul(hello, 3.5)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
and:
|
||||||
|
variant_and(hello, 3.5)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
div:
|
||||||
|
variant_div(hello, 3.5)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
eqv:
|
||||||
|
variant_eqv(hello, 3.5)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
idiv:
|
||||||
|
variant_idiv(hello, 3.5)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
imp:
|
||||||
|
variant_imp(hello, 3.5)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
mod:
|
||||||
|
variant_mod(hello, 3.5)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
or:
|
||||||
|
variant_or(hello, 3.5)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
pow:
|
||||||
|
variant_pow(hello, 3.5)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
xor:
|
||||||
|
variant_xor(hello, 3.5)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
--
|
||||||
|
add: hellohello
|
||||||
|
cat: hellohello
|
||||||
|
sub:
|
||||||
|
variant_sub(hello, hello)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
mul:
|
||||||
|
variant_mul(hello, hello)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
and:
|
||||||
|
variant_and(hello, hello)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
div:
|
||||||
|
variant_div(hello, hello)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
eqv:
|
||||||
|
variant_eqv(hello, hello)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
idiv:
|
||||||
|
variant_idiv(hello, hello)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
imp:
|
||||||
|
variant_imp(hello, hello)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
mod:
|
||||||
|
variant_mod(hello, hello)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
or:
|
||||||
|
variant_or(hello, hello)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
pow:
|
||||||
|
variant_pow(hello, hello)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
xor:
|
||||||
|
variant_xor(hello, hello)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
--
|
||||||
|
add:
|
||||||
|
variant_add(hello, )
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
cat: helloFalse
|
||||||
|
sub:
|
||||||
|
variant_sub(hello, )
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
mul:
|
||||||
|
variant_mul(hello, )
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
and:
|
||||||
|
variant_and(hello, )
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
div:
|
||||||
|
variant_div(hello, )
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
eqv:
|
||||||
|
variant_eqv(hello, )
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
idiv:
|
||||||
|
variant_idiv(hello, )
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
imp:
|
||||||
|
variant_imp(hello, )
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
mod:
|
||||||
|
variant_mod(hello, )
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
or:
|
||||||
|
variant_or(hello, )
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
pow:
|
||||||
|
variant_pow(hello, )
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
xor:
|
||||||
|
variant_xor(hello, )
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
--
|
||||||
|
add: 42
|
||||||
|
cat: False42
|
||||||
|
sub: -42
|
||||||
|
mul: 0
|
||||||
|
and: 0
|
||||||
|
div: 0
|
||||||
|
eqv: -43
|
||||||
|
idiv: 0
|
||||||
|
imp: -1
|
||||||
|
mod: 0
|
||||||
|
or: 42
|
||||||
|
pow: 0
|
||||||
|
xor: 42
|
||||||
|
--
|
||||||
|
add: 3.5
|
||||||
|
cat: False3.5
|
||||||
|
sub: -3.5
|
||||||
|
mul: 0
|
||||||
|
and: 0
|
||||||
|
div: 0
|
||||||
|
eqv: -5
|
||||||
|
idiv: 0
|
||||||
|
imp: -1
|
||||||
|
mod: 0
|
||||||
|
or: 4
|
||||||
|
pow: 0
|
||||||
|
xor: 4
|
||||||
|
--
|
||||||
|
add:
|
||||||
|
variant_add(0, hello)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
cat: Falsehello
|
||||||
|
sub:
|
||||||
|
variant_sub(0, hello)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
mul:
|
||||||
|
variant_mul(0, hello)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
and:
|
||||||
|
variant_and(0, hello)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
div:
|
||||||
|
variant_div(0, hello)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
eqv:
|
||||||
|
variant_eqv(0, hello)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
idiv:
|
||||||
|
variant_idiv(0, hello)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
imp:
|
||||||
|
variant_imp(0, hello)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
mod:
|
||||||
|
variant_mod(0, hello)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
or:
|
||||||
|
variant_or(0, hello)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
pow:
|
||||||
|
variant_pow(0, hello)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
xor:
|
||||||
|
variant_xor(0, hello)
|
||||||
|
exception Type mismatch.
|
||||||
|
code 80020005
|
||||||
|
|
||||||
|
--
|
||||||
|
add: 0
|
||||||
|
cat: FalseFalse
|
||||||
|
sub: 0
|
||||||
|
mul: 0
|
||||||
|
and: 0
|
||||||
|
div:
|
||||||
|
variant_div(0, )
|
||||||
|
exception Out of present range.
|
||||||
|
code 8002000a
|
||||||
|
|
||||||
|
eqv: -1
|
||||||
|
idiv:
|
||||||
|
variant_idiv(0, )
|
||||||
|
exception Division by zero.
|
||||||
|
code 80020012
|
||||||
|
|
||||||
|
imp: -1
|
||||||
|
mod:
|
||||||
|
variant_mod(0, )
|
||||||
|
exception Division by zero.
|
||||||
|
code 80020012
|
||||||
|
|
||||||
|
or: 0
|
||||||
|
pow: 1
|
||||||
|
xor: 0
|
||||||
|
OK!
|
|
@ -148,9 +148,9 @@ static PHP_MINFO_FUNCTION(ctype)
|
||||||
return; \
|
return; \
|
||||||
if (Z_TYPE_P(c) == IS_LONG) { \
|
if (Z_TYPE_P(c) == IS_LONG) { \
|
||||||
if (Z_LVAL_P(c) <= 255 && Z_LVAL_P(c) >= 0) { \
|
if (Z_LVAL_P(c) <= 255 && Z_LVAL_P(c) >= 0) { \
|
||||||
RETURN_BOOL(iswhat(Z_LVAL_P(c))); \
|
RETURN_BOOL(iswhat((int)Z_LVAL_P(c))); \
|
||||||
} else if (Z_LVAL_P(c) >= -128 && Z_LVAL_P(c) < 0) { \
|
} else if (Z_LVAL_P(c) >= -128 && Z_LVAL_P(c) < 0) { \
|
||||||
RETURN_BOOL(iswhat(Z_LVAL_P(c) + 256)); \
|
RETURN_BOOL(iswhat((int)Z_LVAL_P(c) + 256)); \
|
||||||
} \
|
} \
|
||||||
tmp = *c; \
|
tmp = *c; \
|
||||||
zval_copy_ctor(&tmp); \
|
zval_copy_ctor(&tmp); \
|
||||||
|
|
|
@ -13,6 +13,6 @@ var_dump(curl_setopt($ch, CURLOPT_URL, $url));
|
||||||
?>
|
?>
|
||||||
Done
|
Done
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
Warning: curl_setopt(): Curl option contains invalid characters (\0) in %s/bug68089.php on line 4
|
Warning: curl_setopt(): Curl option contains invalid characters (\0) in %s%ebug68089.php on line 4
|
||||||
bool(false)
|
bool(false)
|
||||||
Done
|
Done
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Generated by re2c 0.13.5 on Tue Aug 26 10:40:19 2014 */
|
/* Generated by re2c 0.13.5 on Thu Oct 30 18:16:16 2014 */
|
||||||
#line 1 "ext/date/lib/parse_date.re"
|
#line 1 "ext/date/lib/parse_date.re"
|
||||||
/*
|
/*
|
||||||
+----------------------------------------------------------------------+
|
+----------------------------------------------------------------------+
|
||||||
|
@ -24712,7 +24712,7 @@ yy1537:
|
||||||
|
|
||||||
#define YYMAXFILL 31
|
#define YYMAXFILL 31
|
||||||
|
|
||||||
timelib_time* timelib_strtotime(char *s, int len, struct timelib_error_container **errors, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_get_wrapper)
|
timelib_time* timelib_strtotime(char *s, size_t len, struct timelib_error_container **errors, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_get_wrapper)
|
||||||
{
|
{
|
||||||
Scanner in;
|
Scanner in;
|
||||||
int t;
|
int t;
|
||||||
|
@ -24823,7 +24823,7 @@ static void timelib_time_reset_unset_fields(timelib_time *time)
|
||||||
if (time->f == TIMELIB_UNSET ) time->f = 0.0;
|
if (time->f == TIMELIB_UNSET ) time->f = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
timelib_time *timelib_parse_from_format(char *format, char *string, int len, timelib_error_container **errors, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_get_wrapper)
|
timelib_time *timelib_parse_from_format(char *format, char *string, size_t len, timelib_error_container **errors, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_get_wrapper)
|
||||||
{
|
{
|
||||||
char *fptr = format;
|
char *fptr = format;
|
||||||
char *ptr = string;
|
char *ptr = string;
|
||||||
|
|
|
@ -1721,7 +1721,7 @@ weekdayof = (reltextnumber|reltexttext) space (dayfull|dayabbr) space 'of
|
||||||
|
|
||||||
/*!max:re2c */
|
/*!max:re2c */
|
||||||
|
|
||||||
timelib_time* timelib_strtotime(char *s, int len, struct timelib_error_container **errors, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_get_wrapper)
|
timelib_time* timelib_strtotime(char *s, size_t len, struct timelib_error_container **errors, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_get_wrapper)
|
||||||
{
|
{
|
||||||
Scanner in;
|
Scanner in;
|
||||||
int t;
|
int t;
|
||||||
|
@ -1832,7 +1832,7 @@ static void timelib_time_reset_unset_fields(timelib_time *time)
|
||||||
if (time->f == TIMELIB_UNSET ) time->f = 0.0;
|
if (time->f == TIMELIB_UNSET ) time->f = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
timelib_time *timelib_parse_from_format(char *format, char *string, int len, timelib_error_container **errors, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_get_wrapper)
|
timelib_time *timelib_parse_from_format(char *format, char *string, size_t len, timelib_error_container **errors, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_get_wrapper)
|
||||||
{
|
{
|
||||||
char *fptr = format;
|
char *fptr = format;
|
||||||
char *ptr = string;
|
char *ptr = string;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Generated by re2c 0.13.5 on Tue Aug 26 10:39:58 2014 */
|
/* Generated by re2c 0.13.5 on Thu Oct 30 18:20:16 2014 */
|
||||||
#line 1 "ext/date/lib/parse_iso_intervals.re"
|
#line 1 "ext/date/lib/parse_iso_intervals.re"
|
||||||
/*
|
/*
|
||||||
+----------------------------------------------------------------------+
|
+----------------------------------------------------------------------+
|
||||||
|
@ -1004,7 +1004,7 @@ yy100:
|
||||||
|
|
||||||
#define YYMAXFILL 20
|
#define YYMAXFILL 20
|
||||||
|
|
||||||
void timelib_strtointerval(char *s, int len,
|
void timelib_strtointerval(char *s, size_t len,
|
||||||
timelib_time **begin, timelib_time **end,
|
timelib_time **begin, timelib_time **end,
|
||||||
timelib_rel_time **period, int *recurrences,
|
timelib_rel_time **period, int *recurrences,
|
||||||
struct timelib_error_container **errors)
|
struct timelib_error_container **errors)
|
||||||
|
|
|
@ -398,7 +398,7 @@ isoweek = year4 "-"? "W" weekofyear;
|
||||||
|
|
||||||
/*!max:re2c */
|
/*!max:re2c */
|
||||||
|
|
||||||
void timelib_strtointerval(char *s, int len,
|
void timelib_strtointerval(char *s, size_t len,
|
||||||
timelib_time **begin, timelib_time **end,
|
timelib_time **begin, timelib_time **end,
|
||||||
timelib_rel_time **period, int *recurrences,
|
timelib_rel_time **period, int *recurrences,
|
||||||
struct timelib_error_container **errors)
|
struct timelib_error_container **errors)
|
||||||
|
|
|
@ -68,15 +68,15 @@ int timelib_valid_time(timelib_sll h, timelib_sll i, timelib_sll s);
|
||||||
int timelib_valid_date(timelib_sll y, timelib_sll m, timelib_sll d);
|
int timelib_valid_date(timelib_sll y, timelib_sll m, timelib_sll d);
|
||||||
|
|
||||||
/* From parse_date.re */
|
/* From parse_date.re */
|
||||||
timelib_time *timelib_strtotime(char *s, int len, timelib_error_container **errors, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_get_wrapper);
|
timelib_time *timelib_strtotime(char *s, size_t len, timelib_error_container **errors, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_get_wrapper);
|
||||||
timelib_time *timelib_parse_from_format(char *format, char *s, int len, timelib_error_container **errors, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_get_wrapper);
|
timelib_time *timelib_parse_from_format(char *format, char *s, size_t len, timelib_error_container **errors, const timelib_tzdb *tzdb, timelib_tz_get_wrapper tz_get_wrapper);
|
||||||
void timelib_fill_holes(timelib_time *parsed, timelib_time *now, int options);
|
void timelib_fill_holes(timelib_time *parsed, timelib_time *now, int options);
|
||||||
char *timelib_timezone_id_from_abbr(const char *abbr, timelib_long gmtoffset, int isdst);
|
char *timelib_timezone_id_from_abbr(const char *abbr, timelib_long gmtoffset, int isdst);
|
||||||
const timelib_tz_lookup_table *timelib_timezone_abbreviations_list(void);
|
const timelib_tz_lookup_table *timelib_timezone_abbreviations_list(void);
|
||||||
timelib_long timelib_parse_tz_cor(char**);
|
timelib_long timelib_parse_tz_cor(char**);
|
||||||
|
|
||||||
/* From parse_iso_intervals.re */
|
/* From parse_iso_intervals.re */
|
||||||
void timelib_strtointerval(char *s, int len,
|
void timelib_strtointerval(char *s, size_t len,
|
||||||
timelib_time **begin, timelib_time **end,
|
timelib_time **begin, timelib_time **end,
|
||||||
timelib_rel_time **period, int *recurrences,
|
timelib_rel_time **period, int *recurrences,
|
||||||
struct timelib_error_container **errors);
|
struct timelib_error_container **errors);
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1230,7 +1230,7 @@ static void php_date(INTERNAL_FUNCTION_PARAMETERS, int localtime)
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
PHPAPI zend_string *php_format_date(char *format, int format_len, time_t ts, int localtime TSRMLS_DC) /* {{{ */
|
PHPAPI zend_string *php_format_date(char *format, size_t format_len, time_t ts, int localtime TSRMLS_DC) /* {{{ */
|
||||||
{
|
{
|
||||||
timelib_time *t;
|
timelib_time *t;
|
||||||
timelib_tzinfo *tzi;
|
timelib_tzinfo *tzi;
|
||||||
|
@ -3031,7 +3031,7 @@ PHP_FUNCTION(date_format)
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
static int php_date_modify(zval *object, char *modify, int modify_len TSRMLS_DC) /* {{{ */
|
static int php_date_modify(zval *object, char *modify, size_t modify_len TSRMLS_DC) /* {{{ */
|
||||||
{
|
{
|
||||||
php_date_obj *dateobj;
|
php_date_obj *dateobj;
|
||||||
timelib_time *tmp_time;
|
timelib_time *tmp_time;
|
||||||
|
@ -3938,7 +3938,7 @@ PHP_FUNCTION(timezone_location_get)
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
static int date_interval_initialize(timelib_rel_time **rt, /*const*/ char *format, int format_length TSRMLS_DC) /* {{{ */
|
static int date_interval_initialize(timelib_rel_time **rt, /*const*/ char *format, size_t format_length TSRMLS_DC) /* {{{ */
|
||||||
{
|
{
|
||||||
timelib_time *b = NULL, *e = NULL;
|
timelib_time *b = NULL, *e = NULL;
|
||||||
timelib_rel_time *p = NULL;
|
timelib_rel_time *p = NULL;
|
||||||
|
@ -4221,7 +4221,7 @@ PHP_FUNCTION(date_interval_create_from_date_string)
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
/* {{{ date_interval_format - */
|
/* {{{ date_interval_format - */
|
||||||
static zend_string *date_interval_format(char *format, int format_len, timelib_rel_time *t TSRMLS_DC)
|
static zend_string *date_interval_format(char *format, size_t format_len, timelib_rel_time *t TSRMLS_DC)
|
||||||
{
|
{
|
||||||
smart_str string = {0};
|
smart_str string = {0};
|
||||||
int i, length, have_format_spec = 0;
|
int i, length, have_format_spec = 0;
|
||||||
|
@ -4302,7 +4302,7 @@ PHP_FUNCTION(date_interval_format)
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
static int date_period_initialize(timelib_time **st, timelib_time **et, timelib_rel_time **d, zend_long *recurrences, /*const*/ char *format, int format_length TSRMLS_DC) /* {{{ */
|
static int date_period_initialize(timelib_time **st, timelib_time **et, timelib_rel_time **d, zend_long *recurrences, /*const*/ char *format, size_t format_length TSRMLS_DC) /* {{{ */
|
||||||
{
|
{
|
||||||
timelib_time *b = NULL, *e = NULL;
|
timelib_time *b = NULL, *e = NULL;
|
||||||
timelib_rel_time *p = NULL;
|
timelib_rel_time *p = NULL;
|
||||||
|
|
|
@ -210,7 +210,7 @@ PHPAPI int php_idate(char format, time_t ts, int localtime TSRMLS_DC);
|
||||||
#define _php_strftime php_strftime
|
#define _php_strftime php_strftime
|
||||||
PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gm);
|
PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gm);
|
||||||
#endif
|
#endif
|
||||||
PHPAPI zend_string *php_format_date(char *format, int format_len, time_t ts, int localtime TSRMLS_DC);
|
PHPAPI zend_string *php_format_date(char *format, size_t format_len, time_t ts, int localtime TSRMLS_DC);
|
||||||
|
|
||||||
/* Mechanism to set new TZ database */
|
/* Mechanism to set new TZ database */
|
||||||
PHPAPI void php_date_set_tzdb(timelib_tzdb *tzdb);
|
PHPAPI void php_date_set_tzdb(timelib_tzdb *tzdb);
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -492,6 +492,13 @@ donote(struct magic_set *ms, void *vbuf, size_t offset, size_t size,
|
||||||
uint32_t namesz, descsz;
|
uint32_t namesz, descsz;
|
||||||
unsigned char *nbuf = CAST(unsigned char *, vbuf);
|
unsigned char *nbuf = CAST(unsigned char *, vbuf);
|
||||||
|
|
||||||
|
if (xnh_sizeof + offset > size) {
|
||||||
|
/*
|
||||||
|
* We're out of note headers.
|
||||||
|
*/
|
||||||
|
return xnh_sizeof + offset;
|
||||||
|
}
|
||||||
|
|
||||||
(void)memcpy(xnh_addr, &nbuf[offset], xnh_sizeof);
|
(void)memcpy(xnh_addr, &nbuf[offset], xnh_sizeof);
|
||||||
offset += xnh_sizeof;
|
offset += xnh_sizeof;
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@
|
||||||
#define FORMAT_IPV4 4
|
#define FORMAT_IPV4 4
|
||||||
#define FORMAT_IPV6 6
|
#define FORMAT_IPV6 6
|
||||||
|
|
||||||
static int php_filter_parse_int(const char *str, unsigned int str_len, zend_long *ret TSRMLS_DC) { /* {{{ */
|
static int php_filter_parse_int(const char *str, size_t str_len, zend_long *ret TSRMLS_DC) { /* {{{ */
|
||||||
zend_long ctx_value;
|
zend_long ctx_value;
|
||||||
int sign = 0, digit = 0;
|
int sign = 0, digit = 0;
|
||||||
const char *end = str + str_len;
|
const char *end = str + str_len;
|
||||||
|
@ -132,7 +132,7 @@ static int php_filter_parse_int(const char *str, unsigned int str_len, zend_long
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
static int php_filter_parse_octal(const char *str, unsigned int str_len, zend_long *ret TSRMLS_DC) { /* {{{ */
|
static int php_filter_parse_octal(const char *str, size_t str_len, zend_long *ret TSRMLS_DC) { /* {{{ */
|
||||||
zend_ulong ctx_value = 0;
|
zend_ulong ctx_value = 0;
|
||||||
const char *end = str + str_len;
|
const char *end = str + str_len;
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ static int php_filter_parse_octal(const char *str, unsigned int str_len, zend_lo
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
static int php_filter_parse_hex(const char *str, unsigned int str_len, zend_long *ret TSRMLS_DC) { /* {{{ */
|
static int php_filter_parse_hex(const char *str, size_t str_len, zend_long *ret TSRMLS_DC) { /* {{{ */
|
||||||
zend_ulong ctx_value = 0;
|
zend_ulong ctx_value = 0;
|
||||||
const char *end = str + str_len;
|
const char *end = str + str_len;
|
||||||
zend_ulong n;
|
zend_ulong n;
|
||||||
|
@ -188,7 +188,8 @@ void php_filter_int(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
|
||||||
zend_long min_range, max_range, option_flags;
|
zend_long min_range, max_range, option_flags;
|
||||||
int min_range_set, max_range_set;
|
int min_range_set, max_range_set;
|
||||||
int allow_octal = 0, allow_hex = 0;
|
int allow_octal = 0, allow_hex = 0;
|
||||||
int len, error = 0;
|
size_t len;
|
||||||
|
int error = 0;
|
||||||
zend_long ctx_value;
|
zend_long ctx_value;
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
|
@ -250,7 +251,7 @@ void php_filter_int(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
|
||||||
void php_filter_boolean(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
|
void php_filter_boolean(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
|
||||||
{
|
{
|
||||||
char *str = Z_STRVAL_P(value);
|
char *str = Z_STRVAL_P(value);
|
||||||
int len = Z_STRLEN_P(value);
|
size_t len = Z_STRLEN_P(value);
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
PHP_FILTER_TRIM_DEFAULT_EX(str, len, 0);
|
PHP_FILTER_TRIM_DEFAULT_EX(str, len, 0);
|
||||||
|
@ -318,12 +319,13 @@ void php_filter_boolean(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
|
||||||
|
|
||||||
void php_filter_float(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
|
void php_filter_float(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
|
||||||
{
|
{
|
||||||
int len;
|
size_t len;
|
||||||
char *str, *end;
|
char *str, *end;
|
||||||
char *num, *p;
|
char *num, *p;
|
||||||
zval *option_val;
|
zval *option_val;
|
||||||
char *decimal;
|
char *decimal;
|
||||||
int decimal_set, decimal_len;
|
int decimal_set;
|
||||||
|
size_t decimal_len;
|
||||||
char dec_sep = '.';
|
char dec_sep = '.';
|
||||||
char tsd_sep[3] = "',.";
|
char tsd_sep[3] = "',.";
|
||||||
|
|
||||||
|
@ -400,7 +402,7 @@ void php_filter_float(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
|
||||||
switch (is_numeric_string(num, p - num, &lval, &dval, 0)) {
|
switch (is_numeric_string(num, p - num, &lval, &dval, 0)) {
|
||||||
case IS_LONG:
|
case IS_LONG:
|
||||||
zval_ptr_dtor(value);
|
zval_ptr_dtor(value);
|
||||||
ZVAL_DOUBLE(value, lval);
|
ZVAL_DOUBLE(value, (double)lval);
|
||||||
break;
|
break;
|
||||||
case IS_DOUBLE:
|
case IS_DOUBLE:
|
||||||
if ((!dval && p - num > 1 && strpbrk(num, "123456789")) || !zend_finite(dval)) {
|
if ((!dval && p - num > 1 && strpbrk(num, "123456789")) || !zend_finite(dval)) {
|
||||||
|
@ -443,7 +445,7 @@ void php_filter_validate_regexp(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
|
||||||
if (!re) {
|
if (!re) {
|
||||||
RETURN_VALIDATION_FAILED
|
RETURN_VALIDATION_FAILED
|
||||||
}
|
}
|
||||||
matches = pcre_exec(re, NULL, Z_STRVAL_P(value), Z_STRLEN_P(value), 0, 0, ovector, 3);
|
matches = pcre_exec(re, NULL, Z_STRVAL_P(value), (int)Z_STRLEN_P(value), 0, 0, ovector, 3);
|
||||||
|
|
||||||
/* 0 means that the vector is too small to hold all the captured substring offsets */
|
/* 0 means that the vector is too small to hold all the captured substring offsets */
|
||||||
if (matches < 0) {
|
if (matches < 0) {
|
||||||
|
@ -455,7 +457,7 @@ void php_filter_validate_regexp(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
|
||||||
void php_filter_validate_url(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
|
void php_filter_validate_url(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
|
||||||
{
|
{
|
||||||
php_url *url;
|
php_url *url;
|
||||||
int old_len = Z_STRLEN_P(value);
|
int old_len = (int)Z_STRLEN_P(value);
|
||||||
|
|
||||||
php_filter_url(value, flags, option_array, charset TSRMLS_CC);
|
php_filter_url(value, flags, option_array, charset TSRMLS_CC);
|
||||||
|
|
||||||
|
@ -554,7 +556,7 @@ void php_filter_validate_email(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
|
||||||
RETURN_VALIDATION_FAILED
|
RETURN_VALIDATION_FAILED
|
||||||
}
|
}
|
||||||
zend_string_release(sregexp);
|
zend_string_release(sregexp);
|
||||||
matches = pcre_exec(re, NULL, Z_STRVAL_P(value), Z_STRLEN_P(value), 0, 0, ovector, 3);
|
matches = pcre_exec(re, NULL, Z_STRVAL_P(value), (int)Z_STRLEN_P(value), 0, 0, ovector, 3);
|
||||||
|
|
||||||
/* 0 means that the vector is too small to hold all the captured substring offsets */
|
/* 0 means that the vector is too small to hold all the captured substring offsets */
|
||||||
if (matches < 0) {
|
if (matches < 0) {
|
||||||
|
@ -564,7 +566,7 @@ void php_filter_validate_email(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
static int _php_filter_validate_ipv4(char *str, int str_len, int *ip) /* {{{ */
|
static int _php_filter_validate_ipv4(char *str, size_t str_len, int *ip) /* {{{ */
|
||||||
{
|
{
|
||||||
const char *end = str + str_len;
|
const char *end = str + str_len;
|
||||||
int num, m;
|
int num, m;
|
||||||
|
@ -599,7 +601,7 @@ static int _php_filter_validate_ipv4(char *str, int str_len, int *ip) /* {{{ */
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
static int _php_filter_validate_ipv6(char *str, int str_len TSRMLS_DC) /* {{{ */
|
static int _php_filter_validate_ipv6(char *str, size_t str_len TSRMLS_DC) /* {{{ */
|
||||||
{
|
{
|
||||||
int compressed = 0;
|
int compressed = 0;
|
||||||
int blocks = 0;
|
int blocks = 0;
|
||||||
|
@ -792,8 +794,9 @@ void php_filter_validate_ip(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
|
||||||
void php_filter_validate_mac(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
|
void php_filter_validate_mac(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
|
||||||
{
|
{
|
||||||
char *input = Z_STRVAL_P(value);
|
char *input = Z_STRVAL_P(value);
|
||||||
int input_len = Z_STRLEN_P(value);
|
size_t input_len = Z_STRLEN_P(value);
|
||||||
int tokens, length, i, offset, exp_separator_set, exp_separator_len;
|
int tokens, length, i, offset, exp_separator_set;
|
||||||
|
size_t exp_separator_len;
|
||||||
char separator;
|
char separator;
|
||||||
char *exp_separator;
|
char *exp_separator;
|
||||||
zend_long ret = 0;
|
zend_long ret = 0;
|
||||||
|
|
|
@ -30,7 +30,7 @@ typedef unsigned long filter_map[256];
|
||||||
static void php_filter_encode_html(zval *value, const unsigned char *chars)
|
static void php_filter_encode_html(zval *value, const unsigned char *chars)
|
||||||
{
|
{
|
||||||
smart_str str = {0};
|
smart_str str = {0};
|
||||||
int len = Z_STRLEN_P(value);
|
size_t len = Z_STRLEN_P(value);
|
||||||
unsigned char *s = (unsigned char *)Z_STRVAL_P(value);
|
unsigned char *s = (unsigned char *)Z_STRVAL_P(value);
|
||||||
unsigned char *e = s + len;
|
unsigned char *e = s + len;
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ static void filter_map_init(filter_map *map)
|
||||||
|
|
||||||
static void filter_map_update(filter_map *map, int flag, const unsigned char *allowed_list)
|
static void filter_map_update(filter_map *map, int flag, const unsigned char *allowed_list)
|
||||||
{
|
{
|
||||||
int l, i;
|
size_t l, i;
|
||||||
|
|
||||||
l = strlen((const char*)allowed_list);
|
l = strlen((const char*)allowed_list);
|
||||||
for (i = 0; i < l; ++i) {
|
for (i = 0; i < l; ++i) {
|
||||||
|
|
|
@ -83,6 +83,9 @@ if (PHP_GD != "no") {
|
||||||
/D USE_GD_IOCTX \
|
/D USE_GD_IOCTX \
|
||||||
/D MSWIN32 \
|
/D MSWIN32 \
|
||||||
");
|
");
|
||||||
|
if (ICC_TOOLSET) {
|
||||||
|
ADD_FLAG("LDFLAGS_GD", "/nodefaultlib:libcmt");
|
||||||
|
}
|
||||||
|
|
||||||
PHP_INSTALL_HEADERS("", "ext/gd ext/gd/libgd" );
|
PHP_INSTALL_HEADERS("", "ext/gd ext/gd/libgd" );
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -362,30 +362,6 @@ static inline void gmp_zval_unary_ui_op(zval *return_value, zval *a_arg, gmp_una
|
||||||
#define gmp_unary_opl(op) _gmp_unary_opl(INTERNAL_FUNCTION_PARAM_PASSTHRU, op)
|
#define gmp_unary_opl(op) _gmp_unary_opl(INTERNAL_FUNCTION_PARAM_PASSTHRU, op)
|
||||||
#define gmp_unary_ui_op(op) _gmp_unary_ui_op(INTERNAL_FUNCTION_PARAM_PASSTHRU, op)
|
#define gmp_unary_ui_op(op) _gmp_unary_ui_op(INTERNAL_FUNCTION_PARAM_PASSTHRU, op)
|
||||||
|
|
||||||
/* {{{ gmp_emalloc
|
|
||||||
*/
|
|
||||||
static void *gmp_emalloc(size_t size)
|
|
||||||
{
|
|
||||||
return emalloc(size);
|
|
||||||
}
|
|
||||||
/* }}} */
|
|
||||||
|
|
||||||
/* {{{ gmp_erealloc
|
|
||||||
*/
|
|
||||||
static void *gmp_erealloc(void *ptr, size_t old_size, size_t new_size)
|
|
||||||
{
|
|
||||||
return erealloc(ptr, new_size);
|
|
||||||
}
|
|
||||||
/* }}} */
|
|
||||||
|
|
||||||
/* {{{ gmp_efree
|
|
||||||
*/
|
|
||||||
static void gmp_efree(void *ptr, size_t size)
|
|
||||||
{
|
|
||||||
efree(ptr);
|
|
||||||
}
|
|
||||||
/* }}} */
|
|
||||||
|
|
||||||
static void gmp_free_object_storage(zend_object *obj TSRMLS_DC) /* {{{ */
|
static void gmp_free_object_storage(zend_object *obj TSRMLS_DC) /* {{{ */
|
||||||
{
|
{
|
||||||
gmp_object *intern = GET_GMP_OBJECT_FROM_OBJ(obj);
|
gmp_object *intern = GET_GMP_OBJECT_FROM_OBJ(obj);
|
||||||
|
@ -693,8 +669,6 @@ ZEND_MINIT_FUNCTION(gmp)
|
||||||
REGISTER_LONG_CONSTANT("GMP_BIG_ENDIAN", GMP_BIG_ENDIAN, CONST_CS | CONST_PERSISTENT);
|
REGISTER_LONG_CONSTANT("GMP_BIG_ENDIAN", GMP_BIG_ENDIAN, CONST_CS | CONST_PERSISTENT);
|
||||||
REGISTER_LONG_CONSTANT("GMP_NATIVE_ENDIAN", GMP_NATIVE_ENDIAN, CONST_CS | CONST_PERSISTENT);
|
REGISTER_LONG_CONSTANT("GMP_NATIVE_ENDIAN", GMP_NATIVE_ENDIAN, CONST_CS | CONST_PERSISTENT);
|
||||||
|
|
||||||
mp_set_memory_functions(gmp_emalloc, gmp_erealloc, gmp_efree);
|
|
||||||
|
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
|
@ -414,7 +414,7 @@ static int php_iconv_output_handler(void **nothing, php_output_context *output_c
|
||||||
mimetype = SG(sapi_headers).mimetype;
|
mimetype = SG(sapi_headers).mimetype;
|
||||||
} else {
|
} else {
|
||||||
mimetype = SG(sapi_headers).mimetype;
|
mimetype = SG(sapi_headers).mimetype;
|
||||||
mimetype_len = s - SG(sapi_headers).mimetype;
|
mimetype_len = (int)(s - SG(sapi_headers).mimetype);
|
||||||
}
|
}
|
||||||
} else if (SG(sapi_headers).send_default_content_type) {
|
} else if (SG(sapi_headers).send_default_content_type) {
|
||||||
mimetype = SG(default_mimetype) ? SG(default_mimetype) : SAPI_DEFAULT_MIMETYPE;
|
mimetype = SG(default_mimetype) ? SG(default_mimetype) : SAPI_DEFAULT_MIMETYPE;
|
||||||
|
@ -429,7 +429,7 @@ static int php_iconv_output_handler(void **nothing, php_output_context *output_c
|
||||||
} else {
|
} else {
|
||||||
len = spprintf(&content_type, 0, "Content-Type:%.*s; charset=%s", mimetype_len ? mimetype_len : (size_t) strlen(mimetype), mimetype, get_output_encoding(TSRMLS_C));
|
len = spprintf(&content_type, 0, "Content-Type:%.*s; charset=%s", mimetype_len ? mimetype_len : (size_t) strlen(mimetype), mimetype, get_output_encoding(TSRMLS_C));
|
||||||
}
|
}
|
||||||
if (content_type && SUCCESS == sapi_add_header(content_type, len, 0)) {
|
if (content_type && SUCCESS == sapi_add_header(content_type, (uint)len, 0)) {
|
||||||
SG(sapi_headers).send_default_content_type = 0;
|
SG(sapi_headers).send_default_content_type = 0;
|
||||||
php_output_handler_hook(PHP_OUTPUT_HANDLER_HOOK_IMMUTABLE, NULL TSRMLS_CC);
|
php_output_handler_hook(PHP_OUTPUT_HANDLER_HOOK_IMMUTABLE, NULL TSRMLS_CC);
|
||||||
}
|
}
|
||||||
|
@ -2306,7 +2306,7 @@ PHP_FUNCTION(iconv_mime_decode)
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = _php_iconv_mime_decode(&retval, encoded_str->val, encoded_str->len, charset, NULL, mode);
|
err = _php_iconv_mime_decode(&retval, encoded_str->val, encoded_str->len, charset, NULL, (int)mode);
|
||||||
_php_iconv_show_error(err, charset, "???" TSRMLS_CC);
|
_php_iconv_show_error(err, charset, "???" TSRMLS_CC);
|
||||||
|
|
||||||
if (err == PHP_ICONV_ERR_SUCCESS) {
|
if (err == PHP_ICONV_ERR_SUCCESS) {
|
||||||
|
@ -2359,7 +2359,7 @@ PHP_FUNCTION(iconv_mime_decode_headers)
|
||||||
char *p, *limit;
|
char *p, *limit;
|
||||||
const char *next_pos;
|
const char *next_pos;
|
||||||
|
|
||||||
if (PHP_ICONV_ERR_SUCCESS != (err = _php_iconv_mime_decode(&decoded_header, enc_str_tmp, enc_str_len_tmp, charset, &next_pos, mode))) {
|
if (PHP_ICONV_ERR_SUCCESS != (err = _php_iconv_mime_decode(&decoded_header, enc_str_tmp, enc_str_len_tmp, charset, &next_pos, (int)mode))) {
|
||||||
smart_str_free(&decoded_header);
|
smart_str_free(&decoded_header);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -573,7 +573,7 @@ PHP_FUNCTION(mcrypt_generic_init)
|
||||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Key size too large; supplied length: %d, max: %d", key_len, max_key_size);
|
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Key size too large; supplied length: %d, max: %d", key_len, max_key_size);
|
||||||
key_size = max_key_size;
|
key_size = max_key_size;
|
||||||
} else {
|
} else {
|
||||||
key_size = key_len;
|
key_size = (int)key_len;
|
||||||
}
|
}
|
||||||
memcpy(key_s, key, key_len);
|
memcpy(key_s, key, key_len);
|
||||||
|
|
||||||
|
@ -636,12 +636,12 @@ PHP_FUNCTION(mcrypt_generic)
|
||||||
/* Check blocksize */
|
/* Check blocksize */
|
||||||
if (mcrypt_enc_is_block_mode(pm->td) == 1) { /* It's a block algorithm */
|
if (mcrypt_enc_is_block_mode(pm->td) == 1) { /* It's a block algorithm */
|
||||||
block_size = mcrypt_enc_get_block_size(pm->td);
|
block_size = mcrypt_enc_get_block_size(pm->td);
|
||||||
data_size = (((data_len - 1) / block_size) + 1) * block_size;
|
data_size = ((((int)data_len - 1) / block_size) + 1) * block_size;
|
||||||
data_s = emalloc(data_size + 1);
|
data_s = emalloc(data_size + 1);
|
||||||
memset(data_s, 0, data_size);
|
memset(data_s, 0, data_size);
|
||||||
memcpy(data_s, data, data_len);
|
memcpy(data_s, data, data_len);
|
||||||
} else { /* It's not a block algorithm */
|
} else { /* It's not a block algorithm */
|
||||||
data_size = data_len;
|
data_size = (int)data_len;
|
||||||
data_s = emalloc(data_size + 1);
|
data_s = emalloc(data_size + 1);
|
||||||
memset(data_s, 0, data_size);
|
memset(data_s, 0, data_size);
|
||||||
memcpy(data_s, data, data_len);
|
memcpy(data_s, data, data_len);
|
||||||
|
@ -681,12 +681,12 @@ PHP_FUNCTION(mdecrypt_generic)
|
||||||
/* Check blocksize */
|
/* Check blocksize */
|
||||||
if (mcrypt_enc_is_block_mode(pm->td) == 1) { /* It's a block algorithm */
|
if (mcrypt_enc_is_block_mode(pm->td) == 1) { /* It's a block algorithm */
|
||||||
block_size = mcrypt_enc_get_block_size(pm->td);
|
block_size = mcrypt_enc_get_block_size(pm->td);
|
||||||
data_size = (((data_len - 1) / block_size) + 1) * block_size;
|
data_size = ((((int)data_len - 1) / block_size) + 1) * block_size;
|
||||||
data_s = emalloc(data_size + 1);
|
data_s = emalloc(data_size + 1);
|
||||||
memset(data_s, 0, data_size);
|
memset(data_s, 0, data_size);
|
||||||
memcpy(data_s, data, data_len);
|
memcpy(data_s, data, data_len);
|
||||||
} else { /* It's not a block algorithm */
|
} else { /* It's not a block algorithm */
|
||||||
data_size = data_len;
|
data_size = (int)data_len;
|
||||||
data_s = emalloc(data_size + 1);
|
data_s = emalloc(data_size + 1);
|
||||||
memset(data_s, 0, data_size);
|
memset(data_s, 0, data_size);
|
||||||
memcpy(data_s, data, data_len);
|
memcpy(data_s, data, data_len);
|
||||||
|
@ -1238,7 +1238,7 @@ static int php_mcrypt_ensure_valid_iv(MCRYPT td, const char *iv, int iv_size TSR
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
static void php_mcrypt_do_crypt(char* cipher, const char *key, int key_len, const char *data, int data_len, char *mode, const char *iv, size_t iv_len, size_t dencrypt, zval* return_value TSRMLS_DC) /* {{{ */
|
static void php_mcrypt_do_crypt(char* cipher, const char *key, size_t key_len, const char *data, size_t data_len, char *mode, const char *iv, size_t iv_len, size_t dencrypt, zval* return_value TSRMLS_DC) /* {{{ */
|
||||||
{
|
{
|
||||||
char *cipher_dir_string;
|
char *cipher_dir_string;
|
||||||
char *module_dir_string;
|
char *module_dir_string;
|
||||||
|
@ -1254,12 +1254,12 @@ static void php_mcrypt_do_crypt(char* cipher, const char *key, int key_len, cons
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (php_mcrypt_ensure_valid_key_size(td, key_len TSRMLS_CC) == FAILURE) {
|
if (php_mcrypt_ensure_valid_key_size(td, (int)key_len TSRMLS_CC) == FAILURE) {
|
||||||
mcrypt_module_close(td);
|
mcrypt_module_close(td);
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (php_mcrypt_ensure_valid_iv(td, iv, iv_len TSRMLS_CC) == FAILURE) {
|
if (php_mcrypt_ensure_valid_iv(td, iv, (int)iv_len TSRMLS_CC) == FAILURE) {
|
||||||
mcrypt_module_close(td);
|
mcrypt_module_close(td);
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
@ -1267,7 +1267,7 @@ static void php_mcrypt_do_crypt(char* cipher, const char *key, int key_len, cons
|
||||||
/* Check blocksize */
|
/* Check blocksize */
|
||||||
if (mcrypt_enc_is_block_mode(td) == 1) { /* It's a block algorithm */
|
if (mcrypt_enc_is_block_mode(td) == 1) { /* It's a block algorithm */
|
||||||
int block_size = mcrypt_enc_get_block_size(td);
|
int block_size = mcrypt_enc_get_block_size(td);
|
||||||
data_size = (((data_len - 1) / block_size) + 1) * block_size;
|
data_size = ((((zend_long)data_len - 1) / block_size) + 1) * block_size;
|
||||||
data_s = emalloc(data_size + 1);
|
data_s = emalloc(data_size + 1);
|
||||||
memset(data_s, 0, data_size);
|
memset(data_s, 0, data_size);
|
||||||
memcpy(data_s, data, data_len);
|
memcpy(data_s, data, data_len);
|
||||||
|
@ -1277,16 +1277,16 @@ static void php_mcrypt_do_crypt(char* cipher, const char *key, int key_len, cons
|
||||||
memcpy(data_s, data, data_len);
|
memcpy(data_s, data, data_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mcrypt_generic_init(td, (void *) key, key_len, (void *) iv) < 0) {
|
if (mcrypt_generic_init(td, (void *) key, (int)key_len, (void *) iv) < 0) {
|
||||||
php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "Mcrypt initialisation failed");
|
php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "Mcrypt initialisation failed");
|
||||||
mcrypt_module_close(td);
|
mcrypt_module_close(td);
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dencrypt == MCRYPT_ENCRYPT) {
|
if (dencrypt == MCRYPT_ENCRYPT) {
|
||||||
mcrypt_generic(td, data_s, data_size);
|
mcrypt_generic(td, data_s, (int)data_size);
|
||||||
} else {
|
} else {
|
||||||
mdecrypt_generic(td, data_s, data_size);
|
mdecrypt_generic(td, data_s, (int)data_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
data_s[data_size] = 0;
|
data_s[data_size] = 0;
|
||||||
|
@ -1424,7 +1424,7 @@ PHP_FUNCTION(mcrypt_create_iv)
|
||||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not gather sufficient random data");
|
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not gather sufficient random data");
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
n = size;
|
n = (int)size;
|
||||||
#else
|
#else
|
||||||
int fd;
|
int fd;
|
||||||
size_t read_bytes = 0;
|
size_t read_bytes = 0;
|
||||||
|
@ -1451,7 +1451,7 @@ PHP_FUNCTION(mcrypt_create_iv)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
n = size;
|
n = (int)size;
|
||||||
while (size) {
|
while (size) {
|
||||||
iv[--size] = (char) (255.0 * php_rand(TSRMLS_C) / RAND_MAX);
|
iv[--size] = (char) (255.0 * php_rand(TSRMLS_C) / RAND_MAX);
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ static php_stream_filter_status_t php_mcrypt_filter(
|
||||||
if (data->blocksize) {
|
if (data->blocksize) {
|
||||||
/* Blockmode cipher */
|
/* Blockmode cipher */
|
||||||
char *outchunk;
|
char *outchunk;
|
||||||
int chunklen = bucket->buflen + data->block_used, n;
|
int chunklen = (int)(bucket->buflen + data->block_used), n;
|
||||||
php_stream_bucket *newbucket;
|
php_stream_bucket *newbucket;
|
||||||
|
|
||||||
outchunk = pemalloc(chunklen, data->persistent);
|
outchunk = pemalloc(chunklen, data->persistent);
|
||||||
|
@ -91,9 +91,9 @@ static php_stream_filter_status_t php_mcrypt_filter(
|
||||||
/* Stream cipher */
|
/* Stream cipher */
|
||||||
php_stream_bucket_make_writeable(bucket TSRMLS_CC);
|
php_stream_bucket_make_writeable(bucket TSRMLS_CC);
|
||||||
if (data->encrypt) {
|
if (data->encrypt) {
|
||||||
mcrypt_generic(data->module, bucket->buf, bucket->buflen);
|
mcrypt_generic(data->module, bucket->buf, (int)bucket->buflen);
|
||||||
} else {
|
} else {
|
||||||
mdecrypt_generic(data->module, bucket->buf, bucket->buflen);
|
mdecrypt_generic(data->module, bucket->buf, (int)bucket->buflen);
|
||||||
}
|
}
|
||||||
php_stream_bucket_append(buckets_out, bucket TSRMLS_CC);
|
php_stream_bucket_append(buckets_out, bucket TSRMLS_CC);
|
||||||
|
|
||||||
|
@ -201,13 +201,13 @@ static php_stream_filter *php_mcrypt_filter_create(const char *filtername, zval
|
||||||
if ((tmpzval = zend_hash_str_find(HASH_OF(filterparams), ZEND_STRL("key"))) &&
|
if ((tmpzval = zend_hash_str_find(HASH_OF(filterparams), ZEND_STRL("key"))) &&
|
||||||
Z_TYPE_P(tmpzval) == IS_STRING) {
|
Z_TYPE_P(tmpzval) == IS_STRING) {
|
||||||
key = Z_STRVAL_P(tmpzval);
|
key = Z_STRVAL_P(tmpzval);
|
||||||
key_len = Z_STRLEN_P(tmpzval);
|
key_len = (int)Z_STRLEN_P(tmpzval);
|
||||||
} else {
|
} else {
|
||||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "key not specified or is not a string");
|
php_error_docref(NULL TSRMLS_CC, E_WARNING, "key not specified or is not a string");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
mcrypt_module = mcrypt_module_open(cipher, algo_dir, mode, mode_dir);
|
mcrypt_module = mcrypt_module_open((char *)cipher, algo_dir, mode, mode_dir);
|
||||||
if (mcrypt_module == MCRYPT_FAILED) {
|
if (mcrypt_module == MCRYPT_FAILED) {
|
||||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not open encryption module");
|
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not open encryption module");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -1306,7 +1306,7 @@ static int mysqlnd_stream_array_to_fd_set(MYSQLND ** conn_array, fd_set * fds, p
|
||||||
stream = (*p)->data->net->data->m.get_stream((*p)->data->net TSRMLS_CC);
|
stream = (*p)->data->net->data->m.get_stream((*p)->data->net TSRMLS_CC);
|
||||||
DBG_INF_FMT("conn=%llu stream=%p", (*p)->data->thread_id, stream);
|
DBG_INF_FMT("conn=%llu stream=%p", (*p)->data->thread_id, stream);
|
||||||
if (stream != NULL && SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL,
|
if (stream != NULL && SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL,
|
||||||
(void*)&this_fd, 1) && this_fd >= 0) {
|
(void*)&this_fd, 1) && ZEND_VALID_SOCKET(this_fd)) {
|
||||||
|
|
||||||
PHP_SAFE_FD_SET(this_fd, fds);
|
PHP_SAFE_FD_SET(this_fd, fds);
|
||||||
|
|
||||||
|
@ -1336,7 +1336,7 @@ static int mysqlnd_stream_array_from_fd_set(MYSQLND ** conn_array, fd_set * fds
|
||||||
stream = (*fwd)->data->net->data->m.get_stream((*fwd)->data->net TSRMLS_CC);
|
stream = (*fwd)->data->net->data->m.get_stream((*fwd)->data->net TSRMLS_CC);
|
||||||
DBG_INF_FMT("conn=%llu stream=%p", (*fwd)->data->thread_id, stream);
|
DBG_INF_FMT("conn=%llu stream=%p", (*fwd)->data->thread_id, stream);
|
||||||
if (stream != NULL && SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL,
|
if (stream != NULL && SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL,
|
||||||
(void*)&this_fd, 1) && this_fd >= 0) {
|
(void*)&this_fd, 1) && ZEND_VALID_SOCKET(this_fd)) {
|
||||||
if (PHP_SAFE_FD_ISSET(this_fd, fds)) {
|
if (PHP_SAFE_FD_ISSET(this_fd, fds)) {
|
||||||
if (disproportion) {
|
if (disproportion) {
|
||||||
*bckwd = *fwd;
|
*bckwd = *fwd;
|
||||||
|
|
|
@ -143,8 +143,6 @@ void optimize_func_calls(zend_op_array *op_array, zend_optimizer_ctx *ctx TSRMLS
|
||||||
if (!(opline->extended_value & ZEND_ARG_COMPILE_TIME_BOUND) && call_stack[call - 1].func) {
|
if (!(opline->extended_value & ZEND_ARG_COMPILE_TIME_BOUND) && call_stack[call - 1].func) {
|
||||||
if (ARG_SHOULD_BE_SENT_BY_REF(call_stack[call - 1].func, opline->op2.num)) {
|
if (ARG_SHOULD_BE_SENT_BY_REF(call_stack[call - 1].func, opline->op2.num)) {
|
||||||
opline->extended_value |= ZEND_ARG_COMPILE_TIME_BOUND | ZEND_ARG_SEND_BY_REF;
|
opline->extended_value |= ZEND_ARG_COMPILE_TIME_BOUND | ZEND_ARG_SEND_BY_REF;
|
||||||
} else if (opline->extended_value) {
|
|
||||||
opline->extended_value |= ZEND_ARG_COMPILE_TIME_BOUND;
|
|
||||||
} else {
|
} else {
|
||||||
opline->opcode = ZEND_SEND_VAR;
|
opline->opcode = ZEND_SEND_VAR;
|
||||||
opline->extended_value = 0;
|
opline->extended_value = 0;
|
||||||
|
|
|
@ -341,28 +341,75 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx TSRML
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ZEND_INIT_FCALL:
|
case ZEND_DO_FCALL: {
|
||||||
/* define("name", scalar); */
|
zend_op *send1_opline = opline - 1;
|
||||||
if (collect_constants &&
|
zend_op *send2_opline = NULL;
|
||||||
ZEND_OP2_TYPE(opline) == IS_CONST &&
|
zend_op *init_opline = NULL;
|
||||||
Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_STRING &&
|
|
||||||
Z_STRLEN(ZEND_OP2_LITERAL(opline)) == sizeof("define")-1 &&
|
|
||||||
zend_binary_strcasecmp(Z_STRVAL(ZEND_OP2_LITERAL(opline)), Z_STRLEN(ZEND_OP2_LITERAL(opline)), "define", sizeof("define")-1) == 0) {
|
|
||||||
|
|
||||||
if ((opline+1)->opcode == ZEND_SEND_VAL &&
|
while (send1_opline->opcode == ZEND_NOP) {
|
||||||
ZEND_OP1_TYPE(opline+1) == IS_CONST &&
|
send1_opline--;
|
||||||
Z_TYPE(ZEND_OP1_LITERAL(opline+1)) == IS_STRING &&
|
}
|
||||||
(opline+2)->opcode == ZEND_SEND_VAL &&
|
if (send1_opline->opcode != ZEND_SEND_VAL ||
|
||||||
ZEND_OP1_TYPE(opline+2) == IS_CONST &&
|
ZEND_OP1_TYPE(send1_opline) != IS_CONST) {
|
||||||
Z_TYPE(ZEND_OP1_LITERAL(opline+2)) <= IS_STRING &&
|
/* don't colllect constants after unknown function call */
|
||||||
(opline+3)->opcode == ZEND_DO_FCALL) {
|
collect_constants = 0;
|
||||||
|
|
||||||
zend_optimizer_collect_constant(ctx, &ZEND_OP1_LITERAL(opline+1), &ZEND_OP1_LITERAL(opline+2));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
if (send1_opline->op2.num == 2) {
|
||||||
/* don't colllect constants after any other function call */
|
send2_opline = send1_opline;
|
||||||
|
send1_opline--;
|
||||||
|
while (send1_opline->opcode == ZEND_NOP) {
|
||||||
|
send1_opline--;
|
||||||
|
}
|
||||||
|
if (send1_opline->opcode != ZEND_SEND_VAL ||
|
||||||
|
ZEND_OP1_TYPE(send1_opline) != IS_CONST) {
|
||||||
|
/* don't colllect constants after unknown function call */
|
||||||
collect_constants = 0;
|
collect_constants = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
init_opline = send1_opline - 1;
|
||||||
|
while (init_opline->opcode == ZEND_NOP) {
|
||||||
|
init_opline--;
|
||||||
|
}
|
||||||
|
if (init_opline->opcode != ZEND_INIT_FCALL ||
|
||||||
|
ZEND_OP2_TYPE(init_opline) != IS_CONST ||
|
||||||
|
Z_TYPE(ZEND_OP2_LITERAL(init_opline)) != IS_STRING) {
|
||||||
|
/* don't colllect constants after unknown function call */
|
||||||
|
collect_constants = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* define("name", scalar); */
|
||||||
|
if (Z_STRLEN(ZEND_OP2_LITERAL(init_opline)) == sizeof("define")-1 &&
|
||||||
|
zend_binary_strcasecmp(Z_STRVAL(ZEND_OP2_LITERAL(init_opline)), Z_STRLEN(ZEND_OP2_LITERAL(init_opline)), "define", sizeof("define")-1) == 0) {
|
||||||
|
|
||||||
|
if (Z_TYPE(ZEND_OP1_LITERAL(send1_opline)) == IS_STRING &&
|
||||||
|
send2_opline &&
|
||||||
|
Z_TYPE(ZEND_OP1_LITERAL(send2_opline)) <= IS_STRING) {
|
||||||
|
|
||||||
|
if (collect_constants) {
|
||||||
|
zend_optimizer_collect_constant(ctx, &ZEND_OP1_LITERAL(send1_opline), &ZEND_OP1_LITERAL(send2_opline));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (RESULT_UNUSED(opline) &&
|
||||||
|
!zend_memnstr(Z_STRVAL(ZEND_OP1_LITERAL(send1_opline)), "::", sizeof("::") - 1, Z_STRVAL(ZEND_OP1_LITERAL(send1_opline)) + Z_STRLEN(ZEND_OP1_LITERAL(send1_opline)))) {
|
||||||
|
|
||||||
|
opline->opcode = ZEND_DECLARE_CONST;
|
||||||
|
opline->op1_type = IS_CONST;
|
||||||
|
opline->op2_type = IS_CONST;
|
||||||
|
opline->result_type = IS_UNUSED;
|
||||||
|
opline->op1.constant = send1_opline->op1.constant;
|
||||||
|
opline->op2.constant = send2_opline->op1.constant;
|
||||||
|
opline->result.zv = NULL;
|
||||||
|
|
||||||
|
literal_dtor(&ZEND_OP2_LITERAL(init_opline));
|
||||||
|
MAKE_NOP(init_opline);
|
||||||
|
MAKE_NOP(send1_opline);
|
||||||
|
MAKE_NOP(send2_opline);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* pre-evaluate constant functions:
|
/* pre-evaluate constant functions:
|
||||||
|
@ -372,42 +419,42 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx TSRML
|
||||||
is_callable(x)
|
is_callable(x)
|
||||||
extension_loaded(x)
|
extension_loaded(x)
|
||||||
*/
|
*/
|
||||||
if ((opline + 1)->opcode == ZEND_SEND_VAL &&
|
if (!send2_opline &&
|
||||||
(opline + 2)->opcode == ZEND_DO_FCALL &&
|
Z_TYPE(ZEND_OP1_LITERAL(send1_opline)) == IS_STRING) {
|
||||||
ZEND_OP1_TYPE(opline + 1) == IS_CONST && Z_TYPE(ZEND_OP1_LITERAL(opline + 1)) == IS_STRING &&
|
if ((Z_STRLEN(ZEND_OP2_LITERAL(init_opline)) == sizeof("function_exists")-1 &&
|
||||||
ZEND_OP2_TYPE(opline) == IS_CONST && Z_TYPE(ZEND_OP2_LITERAL(opline)) == IS_STRING) {
|
!memcmp(Z_STRVAL(ZEND_OP2_LITERAL(init_opline)),
|
||||||
if ((Z_STRLEN(ZEND_OP2_LITERAL(opline)) == sizeof("function_exists")-1 &&
|
|
||||||
!memcmp(Z_STRVAL(ZEND_OP2_LITERAL(opline)),
|
|
||||||
"function_exists", sizeof("function_exists")-1)) ||
|
"function_exists", sizeof("function_exists")-1)) ||
|
||||||
(Z_STRLEN(ZEND_OP2_LITERAL(opline)) == sizeof("is_callable")-1 &&
|
(Z_STRLEN(ZEND_OP2_LITERAL(init_opline)) == sizeof("is_callable")-1 &&
|
||||||
!memcmp(Z_STRVAL(ZEND_OP2_LITERAL(opline)),
|
!memcmp(Z_STRVAL(ZEND_OP2_LITERAL(init_opline)),
|
||||||
"is_callable", sizeof("is_callable")))) {
|
"is_callable", sizeof("is_callable")))) {
|
||||||
zend_internal_function *func;
|
zend_internal_function *func;
|
||||||
char *lc_name = zend_str_tolower_dup(
|
char *lc_name = zend_str_tolower_dup(
|
||||||
Z_STRVAL(ZEND_OP1_LITERAL(opline + 1)), Z_STRLEN(ZEND_OP1_LITERAL(opline + 1)));
|
Z_STRVAL(ZEND_OP1_LITERAL(send1_opline)), Z_STRLEN(ZEND_OP1_LITERAL(send1_opline)));
|
||||||
|
|
||||||
if ((func = zend_hash_str_find_ptr(EG(function_table), lc_name, Z_STRLEN(ZEND_OP1_LITERAL(opline + 1)))) != NULL &&
|
if ((func = zend_hash_str_find_ptr(EG(function_table), lc_name, Z_STRLEN(ZEND_OP1_LITERAL(send1_opline)))) != NULL &&
|
||||||
func->type == ZEND_INTERNAL_FUNCTION &&
|
func->type == ZEND_INTERNAL_FUNCTION &&
|
||||||
func->module->type == MODULE_PERSISTENT) {
|
func->module->type == MODULE_PERSISTENT) {
|
||||||
zval t;
|
zval t;
|
||||||
ZVAL_BOOL(&t, 1);
|
ZVAL_BOOL(&t, 1);
|
||||||
if (zend_optimizer_replace_by_const(op_array, opline + 3, IS_VAR, ZEND_RESULT(opline + 2).var, &t TSRMLS_CC)) {
|
if (zend_optimizer_replace_by_const(op_array, opline + 1, IS_VAR, ZEND_RESULT(opline).var, &t TSRMLS_CC)) {
|
||||||
literal_dtor(&ZEND_OP2_LITERAL(opline));
|
literal_dtor(&ZEND_OP2_LITERAL(init_opline));
|
||||||
|
MAKE_NOP(init_opline);
|
||||||
|
literal_dtor(&ZEND_OP1_LITERAL(send1_opline));
|
||||||
|
MAKE_NOP(send1_opline);
|
||||||
MAKE_NOP(opline);
|
MAKE_NOP(opline);
|
||||||
literal_dtor(&ZEND_OP1_LITERAL(opline + 1));
|
efree(lc_name);
|
||||||
MAKE_NOP(opline + 1);
|
break;
|
||||||
MAKE_NOP(opline + 2);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
efree(lc_name);
|
efree(lc_name);
|
||||||
} else if (Z_STRLEN(ZEND_OP2_LITERAL(opline)) == sizeof("extension_loaded")-1 &&
|
} else if (Z_STRLEN(ZEND_OP2_LITERAL(init_opline)) == sizeof("extension_loaded")-1 &&
|
||||||
!memcmp(Z_STRVAL(ZEND_OP2_LITERAL(opline)),
|
!memcmp(Z_STRVAL(ZEND_OP2_LITERAL(init_opline)),
|
||||||
"extension_loaded", sizeof("extension_loaded")-1)) {
|
"extension_loaded", sizeof("extension_loaded")-1)) {
|
||||||
zval t;
|
zval t;
|
||||||
char *lc_name = zend_str_tolower_dup(
|
char *lc_name = zend_str_tolower_dup(
|
||||||
Z_STRVAL(ZEND_OP1_LITERAL(opline + 1)), Z_STRLEN(ZEND_OP1_LITERAL(opline + 1)));
|
Z_STRVAL(ZEND_OP1_LITERAL(send1_opline)), Z_STRLEN(ZEND_OP1_LITERAL(send1_opline)));
|
||||||
zend_module_entry *m = zend_hash_str_find_ptr(&module_registry,
|
zend_module_entry *m = zend_hash_str_find_ptr(&module_registry,
|
||||||
lc_name, Z_STRLEN(ZEND_OP1_LITERAL(opline + 1)));
|
lc_name, Z_STRLEN(ZEND_OP1_LITERAL(send1_opline)));
|
||||||
|
|
||||||
efree(lc_name);
|
efree(lc_name);
|
||||||
if (!m) {
|
if (!m) {
|
||||||
|
@ -424,60 +471,89 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx TSRML
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (zend_optimizer_replace_by_const(op_array, opline + 3, IS_VAR, ZEND_RESULT(opline + 2).var, &t TSRMLS_CC)) {
|
if (zend_optimizer_replace_by_const(op_array, opline + 1, IS_VAR, ZEND_RESULT(opline).var, &t TSRMLS_CC)) {
|
||||||
literal_dtor(&ZEND_OP2_LITERAL(opline));
|
literal_dtor(&ZEND_OP2_LITERAL(init_opline));
|
||||||
|
MAKE_NOP(init_opline);
|
||||||
|
literal_dtor(&ZEND_OP1_LITERAL(send1_opline));
|
||||||
|
MAKE_NOP(send1_opline);
|
||||||
MAKE_NOP(opline);
|
MAKE_NOP(opline);
|
||||||
literal_dtor(&ZEND_OP1_LITERAL(opline + 1));
|
break;
|
||||||
MAKE_NOP(opline + 1);
|
|
||||||
MAKE_NOP(opline + 2);
|
|
||||||
}
|
}
|
||||||
} else if (Z_STRLEN(ZEND_OP2_LITERAL(opline)) == sizeof("defined")-1 &&
|
} else if (Z_STRLEN(ZEND_OP2_LITERAL(init_opline)) == sizeof("defined")-1 &&
|
||||||
!memcmp(Z_STRVAL(ZEND_OP2_LITERAL(opline)),
|
!memcmp(Z_STRVAL(ZEND_OP2_LITERAL(init_opline)),
|
||||||
"defined", sizeof("defined")-1)) {
|
"defined", sizeof("defined")-1)) {
|
||||||
zval t;
|
zval t;
|
||||||
|
|
||||||
if (zend_optimizer_get_persistent_constant(Z_STR(ZEND_OP1_LITERAL(opline + 1)), &t, 0 TSRMLS_CC)) {
|
if (zend_optimizer_get_persistent_constant(Z_STR(ZEND_OP1_LITERAL(send1_opline)), &t, 0 TSRMLS_CC)) {
|
||||||
|
|
||||||
ZVAL_BOOL(&t, 1);
|
ZVAL_BOOL(&t, 1);
|
||||||
if (zend_optimizer_replace_by_const(op_array, opline + 3, IS_VAR, ZEND_RESULT(opline + 2).var, &t TSRMLS_CC)) {
|
if (zend_optimizer_replace_by_const(op_array, opline + 1, IS_VAR, ZEND_RESULT(opline).var, &t TSRMLS_CC)) {
|
||||||
literal_dtor(&ZEND_OP2_LITERAL(opline));
|
literal_dtor(&ZEND_OP2_LITERAL(init_opline));
|
||||||
|
MAKE_NOP(init_opline);
|
||||||
|
literal_dtor(&ZEND_OP1_LITERAL(send1_opline));
|
||||||
|
MAKE_NOP(send1_opline);
|
||||||
MAKE_NOP(opline);
|
MAKE_NOP(opline);
|
||||||
literal_dtor(&ZEND_OP1_LITERAL(opline + 1));
|
break;
|
||||||
MAKE_NOP(opline + 1);
|
|
||||||
MAKE_NOP(opline + 2);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (Z_STRLEN(ZEND_OP2_LITERAL(opline)) == sizeof("constant")-1 &&
|
} else if (Z_STRLEN(ZEND_OP2_LITERAL(init_opline)) == sizeof("constant")-1 &&
|
||||||
!memcmp(Z_STRVAL(ZEND_OP2_LITERAL(opline)),
|
!memcmp(Z_STRVAL(ZEND_OP2_LITERAL(init_opline)),
|
||||||
"constant", sizeof("constant")-1)) {
|
"constant", sizeof("constant")-1)) {
|
||||||
zval t;
|
zval t;
|
||||||
|
|
||||||
if (zend_optimizer_get_persistent_constant(Z_STR(ZEND_OP1_LITERAL(opline + 1)), &t, 1 TSRMLS_CC)) {
|
if (zend_optimizer_get_persistent_constant(Z_STR(ZEND_OP1_LITERAL(send1_opline)), &t, 1 TSRMLS_CC)) {
|
||||||
if (zend_optimizer_replace_by_const(op_array, opline + 3, IS_VAR, ZEND_RESULT(opline + 2).var, &t TSRMLS_CC)) {
|
if (zend_optimizer_replace_by_const(op_array, opline + 1, IS_VAR, ZEND_RESULT(opline).var, &t TSRMLS_CC)) {
|
||||||
literal_dtor(&ZEND_OP2_LITERAL(opline));
|
literal_dtor(&ZEND_OP2_LITERAL(init_opline));
|
||||||
|
MAKE_NOP(init_opline);
|
||||||
|
literal_dtor(&ZEND_OP1_LITERAL(send1_opline));
|
||||||
|
MAKE_NOP(send1_opline);
|
||||||
MAKE_NOP(opline);
|
MAKE_NOP(opline);
|
||||||
literal_dtor(&ZEND_OP1_LITERAL(opline + 1));
|
break;
|
||||||
MAKE_NOP(opline + 1);
|
|
||||||
MAKE_NOP(opline + 2);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if ((CG(compiler_options) & ZEND_COMPILE_NO_BUILTIN_STRLEN) == 0 &&
|
} else if ((CG(compiler_options) & ZEND_COMPILE_NO_BUILTIN_STRLEN) == 0 &&
|
||||||
Z_STRLEN(ZEND_OP2_LITERAL(opline)) == sizeof("strlen")-1 &&
|
Z_STRLEN(ZEND_OP2_LITERAL(init_opline)) == sizeof("strlen")-1 &&
|
||||||
!memcmp(Z_STRVAL(ZEND_OP2_LITERAL(opline)),
|
!memcmp(Z_STRVAL(ZEND_OP2_LITERAL(init_opline)),
|
||||||
"strlen", sizeof("strlen")-1)) {
|
"strlen", sizeof("strlen")-1)) {
|
||||||
zval t;
|
zval t;
|
||||||
|
|
||||||
ZVAL_LONG(&t, Z_STRLEN(ZEND_OP1_LITERAL(opline + 1)));
|
ZVAL_LONG(&t, Z_STRLEN(ZEND_OP1_LITERAL(send1_opline)));
|
||||||
if (zend_optimizer_replace_by_const(op_array, opline + 3, IS_VAR, ZEND_RESULT(opline + 2).var, &t TSRMLS_CC)) {
|
if (zend_optimizer_replace_by_const(op_array, opline + 1, IS_VAR, ZEND_RESULT(opline).var, &t TSRMLS_CC)) {
|
||||||
literal_dtor(&ZEND_OP2_LITERAL(opline));
|
literal_dtor(&ZEND_OP2_LITERAL(init_opline));
|
||||||
|
MAKE_NOP(init_opline);
|
||||||
|
literal_dtor(&ZEND_OP1_LITERAL(send1_opline));
|
||||||
|
MAKE_NOP(send1_opline);
|
||||||
MAKE_NOP(opline);
|
MAKE_NOP(opline);
|
||||||
literal_dtor(&ZEND_OP1_LITERAL(opline + 1));
|
|
||||||
MAKE_NOP(opline + 1);
|
|
||||||
MAKE_NOP(opline + 2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
/* dirname(IS_CONST/IS_STRING) -> IS_CONST/IS_STRING */
|
||||||
|
} else if (Z_STRLEN(ZEND_OP2_LITERAL(init_opline)) == sizeof("dirname")-1 &&
|
||||||
|
!memcmp(Z_STRVAL(ZEND_OP2_LITERAL(init_opline)),
|
||||||
|
"dirname", sizeof("dirname")-1) &&
|
||||||
|
IS_ABSOLUTE_PATH(Z_STRVAL(ZEND_OP1_LITERAL(send1_opline)), Z_STRLEN(ZEND_OP1_LITERAL(send1_opline)))) {
|
||||||
|
zend_string *dirname = zend_string_init(Z_STRVAL(ZEND_OP1_LITERAL(send1_opline)), Z_STRLEN(ZEND_OP1_LITERAL(send1_opline)), 0);
|
||||||
|
dirname->len = zend_dirname(dirname->val, dirname->len);
|
||||||
|
if (IS_ABSOLUTE_PATH(dirname->val, dirname->len)) {
|
||||||
|
zval t;
|
||||||
|
|
||||||
|
ZVAL_STR(&t, dirname);
|
||||||
|
if (zend_optimizer_replace_by_const(op_array, opline + 1, IS_VAR, ZEND_RESULT(opline).var, &t TSRMLS_CC)) {
|
||||||
|
literal_dtor(&ZEND_OP2_LITERAL(init_opline));
|
||||||
|
MAKE_NOP(init_opline);
|
||||||
|
literal_dtor(&ZEND_OP1_LITERAL(send1_opline));
|
||||||
|
MAKE_NOP(send1_opline);
|
||||||
|
MAKE_NOP(opline);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
zend_string_release(dirname);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* don't colllect constants after any other function call */
|
||||||
|
collect_constants = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
case ZEND_STRLEN:
|
case ZEND_STRLEN:
|
||||||
if (ZEND_OP1_TYPE(opline) == IS_CONST &&
|
if (ZEND_OP1_TYPE(opline) == IS_CONST &&
|
||||||
Z_TYPE(ZEND_OP1_LITERAL(opline)) == IS_STRING) {
|
Z_TYPE(ZEND_OP1_LITERAL(opline)) == IS_STRING) {
|
||||||
|
@ -530,7 +606,6 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx TSRML
|
||||||
case ZEND_FE_RESET:
|
case ZEND_FE_RESET:
|
||||||
case ZEND_FE_FETCH:
|
case ZEND_FE_FETCH:
|
||||||
case ZEND_NEW:
|
case ZEND_NEW:
|
||||||
case ZEND_DO_FCALL:
|
|
||||||
case ZEND_JMP_SET:
|
case ZEND_JMP_SET:
|
||||||
case ZEND_COALESCE:
|
case ZEND_COALESCE:
|
||||||
collect_constants = 0;
|
collect_constants = 0;
|
||||||
|
|
|
@ -283,6 +283,14 @@ int zend_optimizer_replace_by_const(zend_op_array *op_array,
|
||||||
case ZEND_ASSIGN_DIM:
|
case ZEND_ASSIGN_DIM:
|
||||||
case ZEND_SEPARATE:
|
case ZEND_SEPARATE:
|
||||||
return 0;
|
return 0;
|
||||||
|
case ZEND_SEND_VAR:
|
||||||
|
opline->extended_value = 0;
|
||||||
|
opline->opcode = ZEND_SEND_VAL;
|
||||||
|
break;
|
||||||
|
case ZEND_SEND_VAR_EX:
|
||||||
|
opline->extended_value = 0;
|
||||||
|
opline->opcode = ZEND_SEND_VAL_EX;
|
||||||
|
break;
|
||||||
case ZEND_SEND_VAR_NO_REF:
|
case ZEND_SEND_VAR_NO_REF:
|
||||||
if (opline->extended_value & ZEND_ARG_COMPILE_TIME_BOUND) {
|
if (opline->extended_value & ZEND_ARG_COMPILE_TIME_BOUND) {
|
||||||
if (opline->extended_value & ZEND_ARG_SEND_BY_REF) {
|
if (opline->extended_value & ZEND_ARG_SEND_BY_REF) {
|
||||||
|
|
|
@ -878,12 +878,12 @@ static inline int do_validate_timestamps(zend_persistent_script *persistent_scri
|
||||||
int validate_timestamp_and_record(zend_persistent_script *persistent_script, zend_file_handle *file_handle TSRMLS_DC)
|
int validate_timestamp_and_record(zend_persistent_script *persistent_script, zend_file_handle *file_handle TSRMLS_DC)
|
||||||
{
|
{
|
||||||
if (ZCG(accel_directives).revalidate_freq &&
|
if (ZCG(accel_directives).revalidate_freq &&
|
||||||
(persistent_script->dynamic_members.revalidate >= ZCSG(revalidate_at))) {
|
persistent_script->dynamic_members.revalidate >= ZCG(request_time)) {
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
} else if (do_validate_timestamps(persistent_script, file_handle TSRMLS_CC) == FAILURE) {
|
} else if (do_validate_timestamps(persistent_script, file_handle TSRMLS_CC) == FAILURE) {
|
||||||
return FAILURE;
|
return FAILURE;
|
||||||
} else {
|
} else {
|
||||||
persistent_script->dynamic_members.revalidate = ZCSG(revalidate_at);
|
persistent_script->dynamic_members.revalidate = ZCG(request_time) + ZCG(accel_directives).revalidate_freq;
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1424,7 +1424,7 @@ static zend_persistent_script *compile_and_cache_file(zend_file_handle *file_han
|
||||||
* otherwise we have a race-condition.
|
* otherwise we have a race-condition.
|
||||||
*/
|
*/
|
||||||
new_persistent_script->timestamp = timestamp;
|
new_persistent_script->timestamp = timestamp;
|
||||||
new_persistent_script->dynamic_members.revalidate = ZCSG(revalidate_at);
|
new_persistent_script->dynamic_members.revalidate = ZCG(request_time) + ZCG(accel_directives).revalidate_freq;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file_handle->opened_path) {
|
if (file_handle->opened_path) {
|
||||||
|
@ -1894,13 +1894,6 @@ static void accel_activate(void)
|
||||||
zend_accel_error(ACCEL_LOG_WARNING, "Internal functions count changed - was %d, now %d", ZCG(internal_functions_count), zend_hash_num_elements(&ZCG(function_table)));
|
zend_accel_error(ACCEL_LOG_WARNING, "Internal functions count changed - was %d, now %d", ZCG(internal_functions_count), zend_hash_num_elements(&ZCG(function_table)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ZCG(accel_directives).validate_timestamps) {
|
|
||||||
time_t now = ZCG(request_time);
|
|
||||||
if (now > ZCSG(revalidate_at) + (time_t)ZCG(accel_directives).revalidate_freq) {
|
|
||||||
ZCSG(revalidate_at) = now;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ZCG(cwd) = NULL;
|
ZCG(cwd) = NULL;
|
||||||
|
|
||||||
SHM_PROTECT();
|
SHM_PROTECT();
|
||||||
|
@ -2353,10 +2346,6 @@ static int accel_startup(zend_extension *extension)
|
||||||
accelerator_orig_zend_resolve_path = zend_resolve_path;
|
accelerator_orig_zend_resolve_path = zend_resolve_path;
|
||||||
zend_resolve_path = persistent_zend_resolve_path;
|
zend_resolve_path = persistent_zend_resolve_path;
|
||||||
|
|
||||||
if (ZCG(accel_directives).validate_timestamps) {
|
|
||||||
ZCSG(revalidate_at) = zend_accel_get_time() + ZCG(accel_directives).revalidate_freq;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Override chdir() function */
|
/* Override chdir() function */
|
||||||
if ((func = zend_hash_str_find_ptr(CG(function_table), "chdir", sizeof("chdir")-1)) != NULL &&
|
if ((func = zend_hash_str_find_ptr(CG(function_table), "chdir", sizeof("chdir")-1)) != NULL &&
|
||||||
func->type == ZEND_INTERNAL_FUNCTION) {
|
func->type == ZEND_INTERNAL_FUNCTION) {
|
||||||
|
|
|
@ -270,7 +270,6 @@ typedef struct _zend_accel_shared_globals {
|
||||||
LONGLONG restart_in;
|
LONGLONG restart_in;
|
||||||
#endif
|
#endif
|
||||||
zend_bool restart_in_progress;
|
zend_bool restart_in_progress;
|
||||||
time_t revalidate_at;
|
|
||||||
/* Interned Strings Support */
|
/* Interned Strings Support */
|
||||||
char *interned_strings_start;
|
char *interned_strings_start;
|
||||||
char *interned_strings_top;
|
char *interned_strings_top;
|
||||||
|
|
19
ext/opcache/tests/bug68104.phpt
Normal file
19
ext/opcache/tests/bug68104.phpt
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
--TEST--
|
||||||
|
Bug #68104 (Segfault while pre-evaluating a disabled function)
|
||||||
|
--CREDITS--
|
||||||
|
manuel <manuel@mausz.at>
|
||||||
|
--INI--
|
||||||
|
opcache.enable=1
|
||||||
|
opcache.enable_cli=1
|
||||||
|
disable_functions=dl
|
||||||
|
--SKIPIF--
|
||||||
|
<?php require_once('skipif.inc'); ?>
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
var_dump(is_callable("dl"));
|
||||||
|
dl("a.so");
|
||||||
|
?>
|
||||||
|
--EXPECTF--
|
||||||
|
bool(true)
|
||||||
|
|
||||||
|
Warning: dl() has been disabled for security reasons in %sbug68104.php on line %d
|
20
ext/opcache/tests/bug68252.phpt
Normal file
20
ext/opcache/tests/bug68252.phpt
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
--TEST--
|
||||||
|
Bug #68252 (segfault in Zend/zend_hash.c in function _zend_hash_del_el)
|
||||||
|
--INI--
|
||||||
|
opcache.enable=1
|
||||||
|
opcache.enable_cli=1
|
||||||
|
opcache.fast_shutdown=1
|
||||||
|
--SKIPIF--
|
||||||
|
<?php require_once('skipif.inc'); ?>
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
/* run this test script with valgrind */
|
||||||
|
function a() {
|
||||||
|
echo "okey";
|
||||||
|
}
|
||||||
|
|
||||||
|
create_function('', 'var_dump("22");');
|
||||||
|
|
||||||
|
a();
|
||||||
|
--EXPECT--
|
||||||
|
okey
|
|
@ -499,7 +499,7 @@ static int accelerator_get_scripts(zval *return_value TSRMLS_DC)
|
||||||
timerclear(&exec_time);
|
timerclear(&exec_time);
|
||||||
timerclear(&fetch_time);
|
timerclear(&fetch_time);
|
||||||
|
|
||||||
zend_hash_str_update(Z_ARRVAL_P(return_value), cache_entry->key, cache_entry->key_length-1, &persistent_script_report);
|
zend_hash_str_update(Z_ARRVAL_P(return_value), cache_entry->key, cache_entry->key_length, &persistent_script_report);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
accelerator_shm_read_unlock(TSRMLS_C);
|
accelerator_shm_read_unlock(TSRMLS_C);
|
||||||
|
|
|
@ -423,8 +423,8 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex TSRMLS
|
||||||
extra = pcre_study(re, soptions, &error);
|
extra = pcre_study(re, soptions, &error);
|
||||||
if (extra) {
|
if (extra) {
|
||||||
extra->flags |= PCRE_EXTRA_MATCH_LIMIT | PCRE_EXTRA_MATCH_LIMIT_RECURSION;
|
extra->flags |= PCRE_EXTRA_MATCH_LIMIT | PCRE_EXTRA_MATCH_LIMIT_RECURSION;
|
||||||
extra->match_limit = PCRE_G(backtrack_limit);
|
extra->match_limit = (unsigned long)PCRE_G(backtrack_limit);
|
||||||
extra->match_limit_recursion = PCRE_G(recursion_limit);
|
extra->match_limit_recursion = (unsigned long)PCRE_G(recursion_limit);
|
||||||
}
|
}
|
||||||
if (error != NULL) {
|
if (error != NULL) {
|
||||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error while studying pattern");
|
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error while studying pattern");
|
||||||
|
@ -568,14 +568,14 @@ static void php_do_pcre_match(INTERNAL_FUNCTION_PARAMETERS, int global) /* {{{ *
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
php_pcre_match_impl(pce, subject->val, subject->len, return_value, subpats,
|
php_pcre_match_impl(pce, subject->val, (int)subject->len, return_value, subpats,
|
||||||
global, ZEND_NUM_ARGS() >= 4, flags, start_offset TSRMLS_CC);
|
global, ZEND_NUM_ARGS() >= 4, flags, start_offset TSRMLS_CC);
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
/* {{{ php_pcre_match_impl() */
|
/* {{{ php_pcre_match_impl() */
|
||||||
PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, int subject_len, zval *return_value,
|
PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, int subject_len, zval *return_value,
|
||||||
zval *subpats, int global, int use_flags, long flags, long start_offset TSRMLS_DC)
|
zval *subpats, int global, int use_flags, zend_long flags, zend_long start_offset TSRMLS_DC)
|
||||||
{
|
{
|
||||||
zval result_set, /* Holds a set of subpatterns after
|
zval result_set, /* Holds a set of subpatterns after
|
||||||
a global match */
|
a global match */
|
||||||
|
@ -640,8 +640,8 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, int subjec
|
||||||
extra_data.flags = PCRE_EXTRA_MATCH_LIMIT | PCRE_EXTRA_MATCH_LIMIT_RECURSION;
|
extra_data.flags = PCRE_EXTRA_MATCH_LIMIT | PCRE_EXTRA_MATCH_LIMIT_RECURSION;
|
||||||
extra = &extra_data;
|
extra = &extra_data;
|
||||||
}
|
}
|
||||||
extra->match_limit = PCRE_G(backtrack_limit);
|
extra->match_limit = (unsigned long)PCRE_G(backtrack_limit);
|
||||||
extra->match_limit_recursion = PCRE_G(recursion_limit);
|
extra->match_limit_recursion = (unsigned long)PCRE_G(recursion_limit);
|
||||||
#ifdef PCRE_EXTRA_MARK
|
#ifdef PCRE_EXTRA_MARK
|
||||||
extra->mark = &mark;
|
extra->mark = &mark;
|
||||||
extra->flags |= PCRE_EXTRA_MARK;
|
extra->flags |= PCRE_EXTRA_MARK;
|
||||||
|
@ -668,7 +668,7 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, int subjec
|
||||||
} else {
|
} else {
|
||||||
offsets = (int *)safe_emalloc(size_offsets, sizeof(int), 0);
|
offsets = (int *)safe_emalloc(size_offsets, sizeof(int), 0);
|
||||||
}
|
}
|
||||||
|
memset(offsets, 0, size_offsets*sizeof(int));
|
||||||
/* Allocate match sets array and initialize the values. */
|
/* Allocate match sets array and initialize the values. */
|
||||||
if (global && subpats && subpats_order == PREG_PATTERN_ORDER) {
|
if (global && subpats && subpats_order == PREG_PATTERN_ORDER) {
|
||||||
match_sets = (zval *)safe_emalloc(num_subpats, sizeof(zval), 0);
|
match_sets = (zval *)safe_emalloc(num_subpats, sizeof(zval), 0);
|
||||||
|
@ -682,7 +682,7 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, int subjec
|
||||||
|
|
||||||
do {
|
do {
|
||||||
/* Execute the regular expression. */
|
/* Execute the regular expression. */
|
||||||
count = pcre_exec(pce->re, extra, subject, subject_len, start_offset,
|
count = pcre_exec(pce->re, extra, subject, (int)subject_len, (int)start_offset,
|
||||||
exoptions|g_notempty, offsets, size_offsets);
|
exoptions|g_notempty, offsets, size_offsets);
|
||||||
|
|
||||||
/* the string was already proved to be valid UTF-8 */
|
/* the string was already proved to be valid UTF-8 */
|
||||||
|
@ -834,8 +834,8 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, int subjec
|
||||||
the start offset, and continue. Fudge the offset values
|
the start offset, and continue. Fudge the offset values
|
||||||
to achieve this, unless we're already at the end of the string. */
|
to achieve this, unless we're already at the end of the string. */
|
||||||
if (g_notempty != 0 && start_offset < subject_len) {
|
if (g_notempty != 0 && start_offset < subject_len) {
|
||||||
offsets[0] = start_offset;
|
offsets[0] = (int)start_offset;
|
||||||
offsets[1] = start_offset + 1;
|
offsets[1] = (int)(start_offset + 1);
|
||||||
} else
|
} else
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1130,8 +1130,8 @@ PHPAPI zend_string *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject,
|
||||||
extra_data.flags = PCRE_EXTRA_MATCH_LIMIT | PCRE_EXTRA_MATCH_LIMIT_RECURSION;
|
extra_data.flags = PCRE_EXTRA_MATCH_LIMIT | PCRE_EXTRA_MATCH_LIMIT_RECURSION;
|
||||||
extra = &extra_data;
|
extra = &extra_data;
|
||||||
}
|
}
|
||||||
extra->match_limit = PCRE_G(backtrack_limit);
|
extra->match_limit = (unsigned long)PCRE_G(backtrack_limit);
|
||||||
extra->match_limit_recursion = PCRE_G(recursion_limit);
|
extra->match_limit_recursion = (unsigned long)PCRE_G(recursion_limit);
|
||||||
|
|
||||||
eval = pce->preg_options & PREG_REPLACE_EVAL;
|
eval = pce->preg_options & PREG_REPLACE_EVAL;
|
||||||
if (is_callable_replace) {
|
if (is_callable_replace) {
|
||||||
|
@ -1141,7 +1141,7 @@ PHPAPI zend_string *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
replace = Z_STRVAL_P(replace_val);
|
replace = Z_STRVAL_P(replace_val);
|
||||||
replace_len = Z_STRLEN_P(replace_val);
|
replace_len = (int)Z_STRLEN_P(replace_val);
|
||||||
replace_end = replace + replace_len;
|
replace_end = replace + replace_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1212,11 +1212,11 @@ PHPAPI zend_string *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject,
|
||||||
if (eval) {
|
if (eval) {
|
||||||
eval_result = preg_do_eval(replace, replace_len, subject,
|
eval_result = preg_do_eval(replace, replace_len, subject,
|
||||||
offsets, count TSRMLS_CC);
|
offsets, count TSRMLS_CC);
|
||||||
new_len += eval_result->len;
|
new_len += (int)eval_result->len;
|
||||||
} else if (is_callable_replace) {
|
} else if (is_callable_replace) {
|
||||||
/* Use custom function to get replacement string and its length. */
|
/* Use custom function to get replacement string and its length. */
|
||||||
eval_result = preg_do_repl_func(replace_val, subject, offsets, subpat_names, count, mark TSRMLS_CC);
|
eval_result = preg_do_repl_func(replace_val, subject, offsets, subpat_names, count, mark TSRMLS_CC);
|
||||||
new_len += eval_result->len;
|
new_len += (int)eval_result->len;
|
||||||
} else { /* do regular substitution */
|
} else { /* do regular substitution */
|
||||||
walk = replace;
|
walk = replace;
|
||||||
walk_last = 0;
|
walk_last = 0;
|
||||||
|
@ -1245,7 +1245,7 @@ PHPAPI zend_string *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject,
|
||||||
}
|
}
|
||||||
/* copy the part of the string before the match */
|
/* copy the part of the string before the match */
|
||||||
memcpy(&result->val[result_len], piece, match-piece);
|
memcpy(&result->val[result_len], piece, match-piece);
|
||||||
result_len += match-piece;
|
result_len += (int)(match-piece);
|
||||||
|
|
||||||
/* copy replacement and backrefs */
|
/* copy replacement and backrefs */
|
||||||
walkbuf = result->val + result_len;
|
walkbuf = result->val + result_len;
|
||||||
|
@ -1254,7 +1254,7 @@ PHPAPI zend_string *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject,
|
||||||
* and clean up. */
|
* and clean up. */
|
||||||
if (eval || is_callable_replace) {
|
if (eval || is_callable_replace) {
|
||||||
memcpy(walkbuf, eval_result->val, eval_result->len);
|
memcpy(walkbuf, eval_result->val, eval_result->len);
|
||||||
result_len += eval_result->len;
|
result_len += (int)eval_result->len;
|
||||||
if (eval_result) zend_string_release(eval_result);
|
if (eval_result) zend_string_release(eval_result);
|
||||||
} else { /* do regular backreference copying */
|
} else { /* do regular backreference copying */
|
||||||
walk = replace;
|
walk = replace;
|
||||||
|
@ -1280,7 +1280,7 @@ PHPAPI zend_string *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject,
|
||||||
}
|
}
|
||||||
*walkbuf = '\0';
|
*walkbuf = '\0';
|
||||||
/* increment the result length by how much we've added to the string */
|
/* increment the result length by how much we've added to the string */
|
||||||
result_len += walkbuf - (result->val + result_len);
|
result_len += (int)(walkbuf - (result->val + result_len));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (limit != -1)
|
if (limit != -1)
|
||||||
|
@ -1393,7 +1393,7 @@ static zend_string *php_replace_in_subject(zval *regex, zval *replace, zval *sub
|
||||||
for further replacements. */
|
for further replacements. */
|
||||||
if ((result = php_pcre_replace(regex_str,
|
if ((result = php_pcre_replace(regex_str,
|
||||||
subject_str->val,
|
subject_str->val,
|
||||||
subject_str->len,
|
(int)subject_str->len,
|
||||||
replace_value,
|
replace_value,
|
||||||
is_callable_replace,
|
is_callable_replace,
|
||||||
limit,
|
limit,
|
||||||
|
@ -1413,7 +1413,7 @@ static zend_string *php_replace_in_subject(zval *regex, zval *replace, zval *sub
|
||||||
} else {
|
} else {
|
||||||
result = php_pcre_replace(Z_STR_P(regex),
|
result = php_pcre_replace(Z_STR_P(regex),
|
||||||
subject_str->val,
|
subject_str->val,
|
||||||
subject_str->len,
|
(int)subject_str->len,
|
||||||
replace,
|
replace,
|
||||||
is_callable_replace,
|
is_callable_replace,
|
||||||
limit,
|
limit,
|
||||||
|
@ -1477,7 +1477,7 @@ static void preg_replace_impl(INTERNAL_FUNCTION_PARAMETERS, int is_callable_repl
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ZEND_NUM_ARGS() > 3) {
|
if (ZEND_NUM_ARGS() > 3) {
|
||||||
limit_val = limit;
|
limit_val = (int)limit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Z_TYPE_P(regex) != IS_ARRAY) {
|
if (Z_TYPE_P(regex) != IS_ARRAY) {
|
||||||
|
@ -1579,14 +1579,14 @@ static PHP_FUNCTION(preg_split)
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
php_pcre_split_impl(pce, subject->val, subject->len, return_value, limit_val, flags TSRMLS_CC);
|
php_pcre_split_impl(pce, subject->val, (int)subject->len, return_value, (int)limit_val, flags TSRMLS_CC);
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
/* {{{ php_pcre_split
|
/* {{{ php_pcre_split
|
||||||
*/
|
*/
|
||||||
PHPAPI void php_pcre_split_impl(pcre_cache_entry *pce, char *subject, int subject_len, zval *return_value,
|
PHPAPI void php_pcre_split_impl(pcre_cache_entry *pce, char *subject, int subject_len, zval *return_value,
|
||||||
long limit_val, long flags TSRMLS_DC)
|
zend_long limit_val, zend_long flags TSRMLS_DC)
|
||||||
{
|
{
|
||||||
pcre_extra *extra = NULL; /* Holds results of studying */
|
pcre_extra *extra = NULL; /* Holds results of studying */
|
||||||
pcre *re_bump = NULL; /* Regex instance for empty matches */
|
pcre *re_bump = NULL; /* Regex instance for empty matches */
|
||||||
|
@ -1617,8 +1617,8 @@ PHPAPI void php_pcre_split_impl(pcre_cache_entry *pce, char *subject, int subjec
|
||||||
extra_data.flags = PCRE_EXTRA_MATCH_LIMIT | PCRE_EXTRA_MATCH_LIMIT_RECURSION;
|
extra_data.flags = PCRE_EXTRA_MATCH_LIMIT | PCRE_EXTRA_MATCH_LIMIT_RECURSION;
|
||||||
extra = &extra_data;
|
extra = &extra_data;
|
||||||
}
|
}
|
||||||
extra->match_limit = PCRE_G(backtrack_limit);
|
extra->match_limit = (unsigned long)PCRE_G(backtrack_limit);
|
||||||
extra->match_limit_recursion = PCRE_G(recursion_limit);
|
extra->match_limit_recursion = (unsigned long)PCRE_G(recursion_limit);
|
||||||
#ifdef PCRE_EXTRA_MARK
|
#ifdef PCRE_EXTRA_MARK
|
||||||
extra->flags &= ~PCRE_EXTRA_MARK;
|
extra->flags &= ~PCRE_EXTRA_MARK;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1661,7 +1661,7 @@ PHPAPI void php_pcre_split_impl(pcre_cache_entry *pce, char *subject, int subjec
|
||||||
|
|
||||||
if (offset_capture) {
|
if (offset_capture) {
|
||||||
/* Add (match, offset) pair to the return value */
|
/* Add (match, offset) pair to the return value */
|
||||||
add_offset_pair(return_value, last_match, &subject[offsets[0]]-last_match, next_offset, NULL);
|
add_offset_pair(return_value, last_match, (int)(&subject[offsets[0]]-last_match), next_offset, NULL);
|
||||||
} else {
|
} else {
|
||||||
/* Add the piece to the return value */
|
/* Add the piece to the return value */
|
||||||
add_next_index_stringl(return_value, last_match,
|
add_next_index_stringl(return_value, last_match,
|
||||||
|
@ -1737,7 +1737,7 @@ PHPAPI void php_pcre_split_impl(pcre_cache_entry *pce, char *subject, int subjec
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
start_offset = last_match - subject; /* the offset might have been incremented, but without further successful matches */
|
start_offset = (int)(last_match - subject); /* the offset might have been incremented, but without further successful matches */
|
||||||
|
|
||||||
if (!no_empty || start_offset < subject_len)
|
if (!no_empty || start_offset < subject_len)
|
||||||
{
|
{
|
||||||
|
@ -1889,7 +1889,7 @@ static PHP_FUNCTION(preg_grep)
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
PHPAPI void php_pcre_grep_impl(pcre_cache_entry *pce, zval *input, zval *return_value, long flags TSRMLS_DC) /* {{{ */
|
PHPAPI void php_pcre_grep_impl(pcre_cache_entry *pce, zval *input, zval *return_value, zend_long flags TSRMLS_DC) /* {{{ */
|
||||||
{
|
{
|
||||||
zval *entry; /* An entry in the input array */
|
zval *entry; /* An entry in the input array */
|
||||||
pcre_extra *extra = pce->extra;/* Holds results of studying */
|
pcre_extra *extra = pce->extra;/* Holds results of studying */
|
||||||
|
@ -1909,8 +1909,8 @@ PHPAPI void php_pcre_grep_impl(pcre_cache_entry *pce, zval *input, zval *return
|
||||||
extra_data.flags = PCRE_EXTRA_MATCH_LIMIT | PCRE_EXTRA_MATCH_LIMIT_RECURSION;
|
extra_data.flags = PCRE_EXTRA_MATCH_LIMIT | PCRE_EXTRA_MATCH_LIMIT_RECURSION;
|
||||||
extra = &extra_data;
|
extra = &extra_data;
|
||||||
}
|
}
|
||||||
extra->match_limit = PCRE_G(backtrack_limit);
|
extra->match_limit = (unsigned long)PCRE_G(backtrack_limit);
|
||||||
extra->match_limit_recursion = PCRE_G(recursion_limit);
|
extra->match_limit_recursion = (unsigned long)PCRE_G(recursion_limit);
|
||||||
#ifdef PCRE_EXTRA_MARK
|
#ifdef PCRE_EXTRA_MARK
|
||||||
extra->flags &= ~PCRE_EXTRA_MARK;
|
extra->flags &= ~PCRE_EXTRA_MARK;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1934,7 +1934,7 @@ PHPAPI void php_pcre_grep_impl(pcre_cache_entry *pce, zval *input, zval *return
|
||||||
|
|
||||||
/* Perform the match */
|
/* Perform the match */
|
||||||
count = pcre_exec(pce->re, extra, subject_str->val,
|
count = pcre_exec(pce->re, extra, subject_str->val,
|
||||||
subject_str->len, 0,
|
(int)subject_str->len, 0,
|
||||||
0, offsets, size_offsets);
|
0, offsets, size_offsets);
|
||||||
|
|
||||||
/* Check for too many substrings condition. */
|
/* Check for too many substrings condition. */
|
||||||
|
|
|
@ -57,21 +57,21 @@ typedef struct {
|
||||||
PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex TSRMLS_DC);
|
PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex TSRMLS_DC);
|
||||||
|
|
||||||
PHPAPI void php_pcre_match_impl( pcre_cache_entry *pce, char *subject, int subject_len, zval *return_value,
|
PHPAPI void php_pcre_match_impl( pcre_cache_entry *pce, char *subject, int subject_len, zval *return_value,
|
||||||
zval *subpats, int global, int use_flags, long flags, long start_offset TSRMLS_DC);
|
zval *subpats, int global, int use_flags, zend_long flags, zend_long start_offset TSRMLS_DC);
|
||||||
|
|
||||||
PHPAPI zend_string *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, int subject_len, zval *return_value,
|
PHPAPI zend_string *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject, int subject_len, zval *return_value,
|
||||||
int is_callable_replace, int limit, int *replace_count TSRMLS_DC);
|
int is_callable_replace, int limit, int *replace_count TSRMLS_DC);
|
||||||
|
|
||||||
PHPAPI void php_pcre_split_impl( pcre_cache_entry *pce, char *subject, int subject_len, zval *return_value,
|
PHPAPI void php_pcre_split_impl( pcre_cache_entry *pce, char *subject, int subject_len, zval *return_value,
|
||||||
long limit_val, long flags TSRMLS_DC);
|
zend_long limit_val, zend_long flags TSRMLS_DC);
|
||||||
|
|
||||||
PHPAPI void php_pcre_grep_impl( pcre_cache_entry *pce, zval *input, zval *return_value,
|
PHPAPI void php_pcre_grep_impl( pcre_cache_entry *pce, zval *input, zval *return_value,
|
||||||
long flags TSRMLS_DC);
|
zend_long flags TSRMLS_DC);
|
||||||
|
|
||||||
ZEND_BEGIN_MODULE_GLOBALS(pcre)
|
ZEND_BEGIN_MODULE_GLOBALS(pcre)
|
||||||
HashTable pcre_cache;
|
HashTable pcre_cache;
|
||||||
long backtrack_limit;
|
zend_long backtrack_limit;
|
||||||
long recursion_limit;
|
zend_long recursion_limit;
|
||||||
#ifdef PCRE_STUDY_JIT_COMPILE
|
#ifdef PCRE_STUDY_JIT_COMPILE
|
||||||
zend_bool jit;
|
zend_bool jit;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2486,6 +2486,7 @@ static zval *row_prop_read(zval *object, zval *member, int type, void **cache_sl
|
||||||
pdo_stmt_t *stmt = row->stmt;
|
pdo_stmt_t *stmt = row->stmt;
|
||||||
int colno = -1;
|
int colno = -1;
|
||||||
zval zobj;
|
zval zobj;
|
||||||
|
zend_long lval;
|
||||||
|
|
||||||
ZVAL_NULL(rv);
|
ZVAL_NULL(rv);
|
||||||
if (stmt) {
|
if (stmt) {
|
||||||
|
@ -2493,6 +2494,11 @@ static zval *row_prop_read(zval *object, zval *member, int type, void **cache_sl
|
||||||
if (Z_LVAL_P(member) >= 0 && Z_LVAL_P(member) < stmt->column_count) {
|
if (Z_LVAL_P(member) >= 0 && Z_LVAL_P(member) < stmt->column_count) {
|
||||||
fetch_value(stmt, rv, Z_LVAL_P(member), NULL TSRMLS_CC);
|
fetch_value(stmt, rv, Z_LVAL_P(member), NULL TSRMLS_CC);
|
||||||
}
|
}
|
||||||
|
} else if (Z_TYPE_P(member) == IS_STRING
|
||||||
|
&& is_numeric_string_ex(Z_STRVAL_P(member), Z_STRLEN_P(member), &lval, NULL, 0, NULL) == IS_LONG) {
|
||||||
|
if (lval >= 0 && lval < stmt->column_count) {
|
||||||
|
fetch_value(stmt, rv, lval, NULL TSRMLS_CC);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
convert_to_string(member);
|
convert_to_string(member);
|
||||||
/* TODO: replace this with a hash of available column names to column
|
/* TODO: replace this with a hash of available column names to column
|
||||||
|
@ -2541,12 +2547,18 @@ static int row_prop_exists(zval *object, zval *member, int check_empty, void **c
|
||||||
pdo_row_t *row = (pdo_row_t *)Z_OBJ_P(object);
|
pdo_row_t *row = (pdo_row_t *)Z_OBJ_P(object);
|
||||||
pdo_stmt_t *stmt = row->stmt;
|
pdo_stmt_t *stmt = row->stmt;
|
||||||
int colno = -1;
|
int colno = -1;
|
||||||
|
zend_long lval;
|
||||||
|
|
||||||
if (stmt) {
|
if (stmt) {
|
||||||
if (Z_TYPE_P(member) == IS_LONG) {
|
if (Z_TYPE_P(member) == IS_LONG) {
|
||||||
return Z_LVAL_P(member) >= 0 && Z_LVAL_P(member) < stmt->column_count;
|
return Z_LVAL_P(member) >= 0 && Z_LVAL_P(member) < stmt->column_count;
|
||||||
|
} else if (Z_TYPE_P(member) == IS_STRING) {
|
||||||
|
if (is_numeric_string_ex(Z_STRVAL_P(member), Z_STRLEN_P(member), &lval, NULL, 0, NULL) == IS_LONG) {
|
||||||
|
return lval >=0 && lval < stmt->column_count;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
convert_to_string(member);
|
convert_to_string(member);
|
||||||
|
}
|
||||||
|
|
||||||
/* TODO: replace this with a hash of available column names to column
|
/* TODO: replace this with a hash of available column names to column
|
||||||
* numbers */
|
* numbers */
|
||||||
|
@ -2556,7 +2568,6 @@ static int row_prop_exists(zval *object, zval *member, int check_empty, void **c
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,25 +1,12 @@
|
||||||
This is the unified Sybase-DB style driver for PDO.
|
This is the unified Sybase-DB style driver for PDO.
|
||||||
There are three implementations of this library that are known to me:
|
|
||||||
|
|
||||||
- The Sybase DB lib itself
|
This extension register itself as:
|
||||||
- MSSQL DB lib
|
- 'mssql' when built against the Microsoft DBLIB library
|
||||||
- FreeTDS DB lib
|
- 'sybase' when built against Sybase ct-lib
|
||||||
|
- 'dblib' when built against FreeTDS
|
||||||
This extension will compile and register itself as 'mssql' when built against
|
|
||||||
the mssql libraries (and be named php_pdo_mssql.dll), or 'sybase' otherwise
|
|
||||||
(php_pdo_sybase.dll)
|
|
||||||
|
|
||||||
If you want to try out the free "desktop" version of SQL Server, known as the MSDE, google to obtain the appropriate download link. Here are some short tips on getting it running:
|
|
||||||
|
|
||||||
- Download it and run it to extract it
|
|
||||||
- Open up a command prompt
|
|
||||||
- cd \MSDERelA
|
|
||||||
- setup.exe SQLSECURITY=1 SAPWD=yoursecretpassword
|
|
||||||
- cd \Program Files\Microsoft SQL Server\80\Tools\Binn
|
|
||||||
- SVRNETCN.exe
|
|
||||||
- enable TCP (you MUST do this if you want to access it via FreeTDS/Sybase libs)
|
|
||||||
- net start mssqlserver
|
|
||||||
|
|
||||||
Consult the MS docs for more information about all this stuff.
|
|
||||||
|
|
||||||
|
The following database products are free for testing:
|
||||||
|
- Microsoft SQL Server Express (Windows Only)
|
||||||
|
- Sybase Adaptive Server (Windows, Linux, *NIX)
|
||||||
|
- Microsoft SQL Server Azure (One Month Trial Cloud Service)
|
||||||
|
|
||||||
|
|
|
@ -145,29 +145,57 @@ static zend_long dblib_handle_doer(pdo_dbh_t *dbh, const char *sql, zend_long sq
|
||||||
static int dblib_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, int unquotedlen, char **quoted, int *quotedlen, enum pdo_param_type paramtype TSRMLS_DC)
|
static int dblib_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, int unquotedlen, char **quoted, int *quotedlen, enum pdo_param_type paramtype TSRMLS_DC)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* pdo_dblib_db_handle *H = (pdo_dblib_db_handle *)dbh->driver_data; */
|
int useBinaryEncoding = 0;
|
||||||
|
const char * hex = "0123456789abcdef";
|
||||||
|
int i;
|
||||||
|
char * q;
|
||||||
|
*quotedlen = 0;
|
||||||
|
|
||||||
char *q;
|
/*
|
||||||
int l = 1;
|
* Detect quoted length and if we should use binary encoding
|
||||||
|
*/
|
||||||
|
for(i=0;i<unquotedlen;i++) {
|
||||||
|
if( 32 > unquoted[i] || 127 < unquoted[i] ) {
|
||||||
|
useBinaryEncoding = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(unquoted[i] == '\'') ++*quotedlen;
|
||||||
|
++*quotedlen;
|
||||||
|
}
|
||||||
|
|
||||||
*quoted = q = safe_emalloc(2, unquotedlen, 3);
|
if(useBinaryEncoding) {
|
||||||
*q++ = '\'';
|
/*
|
||||||
|
* Binary safe quoting
|
||||||
|
* Will implicitly convert for all data types except Text, DateTime & SmallDateTime
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
*quotedlen = (unquotedlen * 2) + 2; /* 2 chars per byte +2 for "0x" prefix */
|
||||||
|
q = *quoted = emalloc(*quotedlen);
|
||||||
|
|
||||||
while (unquotedlen--) {
|
*q++ = '0';
|
||||||
if (*unquoted == '\'') {
|
*q++ = 'x';
|
||||||
*q++ = '\'';
|
for (i=0;i<unquotedlen;i++) {
|
||||||
*q++ = '\'';
|
*q++ = hex[ (*unquoted>>4)&0xF];
|
||||||
l += 2;
|
*q++ = hex[ (*unquoted++)&0xF];
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
*q++ = *unquoted;
|
/* Alpha/Numeric Quoting */
|
||||||
++l;
|
*quotedlen += 2; /* +2 for opening, closing quotes */
|
||||||
|
q = *quoted = emalloc(*quotedlen);
|
||||||
|
*q++ = '\'';
|
||||||
|
|
||||||
|
for (i=0;i<unquotedlen;i++) {
|
||||||
|
if (unquoted[i] == '\'') {
|
||||||
|
*q++ = '\'';
|
||||||
|
*q++ = '\'';
|
||||||
|
} else {
|
||||||
|
*q++ = unquoted[i];
|
||||||
}
|
}
|
||||||
unquoted++;
|
}
|
||||||
|
*q++ = '\'';
|
||||||
}
|
}
|
||||||
|
|
||||||
*q++ = '\'';
|
*q = 0;
|
||||||
*q++ = '\0';
|
|
||||||
*quotedlen = l+1;
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -240,7 +268,7 @@ char *dblib_handle_last_id(pdo_dbh_t *dbh, const char *name, unsigned int *len T
|
||||||
}
|
}
|
||||||
|
|
||||||
id = emalloc(32);
|
id = emalloc(32);
|
||||||
*len = dbconvert(NULL, (dbcoltype(H->link, 1)) , (dbdata(H->link, 1)) , (dbdatlen(H->link, 1)), SQLCHAR, id, (DBINT)-1);
|
*len = dbconvert(NULL, (dbcoltype(H->link, 1)) , (dbdata(H->link, 1)) , (dbdatlen(H->link, 1)), SQLCHAR, (BYTE *)id, (DBINT)-1);
|
||||||
|
|
||||||
dbcancel(H->link);
|
dbcancel(H->link);
|
||||||
return id;
|
return id;
|
||||||
|
@ -285,7 +313,6 @@ static int pdo_dblib_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_
|
||||||
{
|
{
|
||||||
pdo_dblib_db_handle *H;
|
pdo_dblib_db_handle *H;
|
||||||
int i, nvars, nvers, ret = 0;
|
int i, nvars, nvers, ret = 0;
|
||||||
int *val;
|
|
||||||
|
|
||||||
const pdo_dblib_keyval tdsver[] = {
|
const pdo_dblib_keyval tdsver[] = {
|
||||||
{"4.2",DBVERSION_42}
|
{"4.2",DBVERSION_42}
|
||||||
|
|
|
@ -471,6 +471,15 @@ static int pdo_pgsql_check_liveness(pdo_dbh_t *dbh TSRMLS_DC)
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
|
static int pgsql_handle_in_transaction(pdo_dbh_t *dbh TSRMLS_DC)
|
||||||
|
{
|
||||||
|
pdo_pgsql_db_handle *H;
|
||||||
|
|
||||||
|
H = (pdo_pgsql_db_handle *)dbh->driver_data;
|
||||||
|
|
||||||
|
return PQtransactionStatus(H->server) > PQTRANS_IDLE;
|
||||||
|
}
|
||||||
|
|
||||||
static int pdo_pgsql_transaction_cmd(const char *cmd, pdo_dbh_t *dbh TSRMLS_DC)
|
static int pdo_pgsql_transaction_cmd(const char *cmd, pdo_dbh_t *dbh TSRMLS_DC)
|
||||||
{
|
{
|
||||||
pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data;
|
pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data;
|
||||||
|
@ -495,7 +504,15 @@ static int pgsql_handle_begin(pdo_dbh_t *dbh TSRMLS_DC)
|
||||||
|
|
||||||
static int pgsql_handle_commit(pdo_dbh_t *dbh TSRMLS_DC)
|
static int pgsql_handle_commit(pdo_dbh_t *dbh TSRMLS_DC)
|
||||||
{
|
{
|
||||||
return pdo_pgsql_transaction_cmd("COMMIT", dbh TSRMLS_CC);
|
int ret = pdo_pgsql_transaction_cmd("COMMIT", dbh TSRMLS_CC);
|
||||||
|
|
||||||
|
/* When deferred constraints are used the commit could
|
||||||
|
fail, and a ROLLBACK implicitly ran. See bug #67462 */
|
||||||
|
if (!ret) {
|
||||||
|
dbh->in_txn = pgsql_handle_in_transaction(dbh TSRMLS_CC);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pgsql_handle_rollback(pdo_dbh_t *dbh TSRMLS_DC)
|
static int pgsql_handle_rollback(pdo_dbh_t *dbh TSRMLS_DC)
|
||||||
|
@ -503,15 +520,6 @@ static int pgsql_handle_rollback(pdo_dbh_t *dbh TSRMLS_DC)
|
||||||
return pdo_pgsql_transaction_cmd("ROLLBACK", dbh TSRMLS_CC);
|
return pdo_pgsql_transaction_cmd("ROLLBACK", dbh TSRMLS_CC);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pgsql_handle_in_transaction(pdo_dbh_t *dbh TSRMLS_DC)
|
|
||||||
{
|
|
||||||
pdo_pgsql_db_handle *H;
|
|
||||||
|
|
||||||
H = (pdo_pgsql_db_handle *)dbh->driver_data;
|
|
||||||
|
|
||||||
return PQtransactionStatus(H->server);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* {{{ proto string PDO::pgsqlCopyFromArray(string $table_name , array $rows [, string $delimiter [, string $null_as ] [, string $fields])
|
/* {{{ proto string PDO::pgsqlCopyFromArray(string $table_name , array $rows [, string $delimiter [, string $null_as ] [, string $fields])
|
||||||
Returns true if the copy worked fine or false if error */
|
Returns true if the copy worked fine or false if error */
|
||||||
static PHP_METHOD(PDO, pgsqlCopyFromArray)
|
static PHP_METHOD(PDO, pgsqlCopyFromArray)
|
||||||
|
|
|
@ -301,7 +301,7 @@ static int pgsql_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *
|
||||||
if (param->paramno >= 0) {
|
if (param->paramno >= 0) {
|
||||||
zval *parameter;
|
zval *parameter;
|
||||||
|
|
||||||
if (param->paramno > zend_hash_num_elements(stmt->bound_param_map)) {
|
if (param->paramno >= zend_hash_num_elements(stmt->bound_param_map)) {
|
||||||
pdo_pgsql_error_stmt(stmt, PGRES_FATAL_ERROR, "HY105");
|
pdo_pgsql_error_stmt(stmt, PGRES_FATAL_ERROR, "HY105");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -376,15 +376,10 @@ static int pgsql_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *
|
||||||
/* We need to manually convert to a pg native boolean value */
|
/* We need to manually convert to a pg native boolean value */
|
||||||
if (PDO_PARAM_TYPE(param->param_type) == PDO_PARAM_BOOL &&
|
if (PDO_PARAM_TYPE(param->param_type) == PDO_PARAM_BOOL &&
|
||||||
((param->param_type & PDO_PARAM_INPUT_OUTPUT) != PDO_PARAM_INPUT_OUTPUT)) {
|
((param->param_type & PDO_PARAM_INPUT_OUTPUT) != PDO_PARAM_INPUT_OUTPUT)) {
|
||||||
zval *parameter;
|
|
||||||
if (Z_ISREF(param->parameter)) {
|
|
||||||
parameter = Z_REFVAL(param->parameter);
|
|
||||||
} else {
|
|
||||||
parameter = ¶m->parameter;
|
|
||||||
}
|
|
||||||
SEPARATE_ZVAL(¶m->parameter);
|
SEPARATE_ZVAL(¶m->parameter);
|
||||||
param->param_type = PDO_PARAM_STR;
|
param->param_type = PDO_PARAM_STR;
|
||||||
ZVAL_STRINGL(parameter, Z_TYPE_P(parameter) == IS_TRUE ? "t" : "f", 1);
|
convert_to_boolean(¶m->parameter);
|
||||||
|
ZVAL_STRINGL(¶m->parameter, Z_TYPE_P(¶m->parameter) == IS_TRUE ? "t" : "f", 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -34,6 +34,19 @@ $query->execute();
|
||||||
$errors[] = $query->errorInfo();
|
$errors[] = $query->errorInfo();
|
||||||
var_dump($value);
|
var_dump($value);
|
||||||
|
|
||||||
|
// Try with strings - Bug #68351
|
||||||
|
$value = '0';
|
||||||
|
$query->bindParam(':foo', $value, PDO::PARAM_BOOL);
|
||||||
|
$query->execute();
|
||||||
|
$errors[] = $query->errorInfo();
|
||||||
|
var_dump($query->fetchColumn());
|
||||||
|
|
||||||
|
$value = "abc";
|
||||||
|
$query->bindParam(':foo', $value, PDO::PARAM_BOOL);
|
||||||
|
$query->execute();
|
||||||
|
$errors[] = $query->errorInfo();
|
||||||
|
var_dump($query->fetchColumn());
|
||||||
|
|
||||||
$expect = 'No errors found';
|
$expect = 'No errors found';
|
||||||
|
|
||||||
foreach ($errors as $error)
|
foreach ($errors as $error)
|
||||||
|
@ -48,4 +61,6 @@ echo $expect;
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
bool(true)
|
bool(true)
|
||||||
bool(false)
|
bool(false)
|
||||||
|
bool(true)
|
||||||
|
bool(false)
|
||||||
No errors found
|
No errors found
|
||||||
|
|
66
ext/pdo_pgsql/tests/bug66584.phpt
Normal file
66
ext/pdo_pgsql/tests/bug66584.phpt
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
--TEST--
|
||||||
|
PDO PgSQL Bug #66584 (Segmentation fault on statement deallocation)
|
||||||
|
--SKIPIF--
|
||||||
|
<?php
|
||||||
|
if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not loaded');
|
||||||
|
require dirname(__FILE__) . '/config.inc';
|
||||||
|
require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
|
||||||
|
PDOTest::skip();
|
||||||
|
?>
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
|
||||||
|
$pdo = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt');
|
||||||
|
|
||||||
|
$pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
|
||||||
|
|
||||||
|
$pdo->beginTransaction();
|
||||||
|
|
||||||
|
$pdo->query("CREATE TABLE b66584 (a int)");
|
||||||
|
$pdo->query("INSERT INTO b66584 VALUES (165)");
|
||||||
|
|
||||||
|
for ($i = 1; $i >= 0; $i--) {
|
||||||
|
$pdo->setAttribute(\PDO::ATTR_EMULATE_PREPARES, (bool)$i);
|
||||||
|
|
||||||
|
try {
|
||||||
|
run($pdo, [0 => 1, 2 => 165, 5 => 3]);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
var_dump($e->getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
run($pdo, json_decode('{"0":234,"1":165,"2":221,"3":207,"4":188,"5":216,"6":1150,"7":916,"8":967,"9":987,"10":951,"11":990,"12":959,"13":896,"14":947,"15":877,"16":1000,"17":1023,"18":904,"19":856,"20":860,"21":866,"22":930,"23":974,"24":1032,"25":1016,"26":1050,"27":1059,"28":1040,"29":1064,"30":1004,"31":214,"32":189,"33":166,"34":1002,"35":167,"36":191,"37":859,"38":204,"39":181,"40":1001,"42":208,"43":198,"44":177,"45":1003,"46":858,"47":190,"48":162,"49":210,"50":171,"51":197,"52":168,"53":194,"54":209,"55":200,"56":192,"57":180,"58":232,"59":222,"60":163,"61":196,"62":217,"64":176,"65":193,"66":172,"67":195,"68":170,"69":173,"70":233,"71":223,"72":218,"73":186,"74":175,"75":224,"76":205,"77":211,"78":235,"79":1101,"80":225,"81":236,"82":1102,"83":1164,"84":1083,"85":1005,"86":861,"87":1179,"88":960,"89":991,"90":1187,"91":880,"92":1149,"93":1033,"94":931,"95":1006,"96":862,"97":1151,"98":917,"99":881,"100":1148,"101":1065,"102":867,"103":952,"104":1152,"105":918,"106":961,"107":1180,"108":992,"109":1188,"110":932,"111":933,"112":968,"113":868,"114":882,"115":1147,"116":1017,"117":1131,"118":1174,"119":1178,"120":1186,"121":869,"122":1051,"123":934,"124":969,"125":975,"126":1066,"127":237,"128":953,"129":1024,"130":1146,"131":883,"132":1145,"133":884,"134":885,"135":1144,"136":886,"137":1143,"138":1025,"139":897,"140":898,"141":899,"142":1026,"143":1142,"144":887,"145":1141,"146":888,"147":889,"148":1140,"149":1189,"150":993,"151":1139,"152":890,"153":1138,"154":891,"155":900,"156":892,"157":1137,"158":1027,"159":901,"160":1136,"161":893,"162":870,"163":1052,"164":954,"165":1041,"166":1018,"167":1165,"168":1084,"169":962,"170":1181,"171":994,"172":1190,"173":1042,"174":935,"175":226,"176":871,"177":1191,"178":995,"179":977,"180":948,"181":1175,"182":1053,"183":955,"184":1182,"185":963,"186":1067,"187":919,"188":1153,"189":920,"190":1154,"191":1055,"192":1054,"193":1056,"194":863,"195":872,"196":1028,"197":921,"198":1155,"199":936,"200":970,"201":1019,"202":1166,"203":1085,"204":1135,"205":894,"206":1034,"207":905,"208":873,"209":937,"210":902,"211":1029,"212":1007,"213":864,"214":1043,"215":1057,"216":956,"217":957,"218":939,"219":1086,"220":1167,"221":1087,"222":1168,"223":1173,"224":1108,"225":978,"226":1044,"227":1183,"228":964,"229":965,"230":1184,"231":1045,"232":874,"233":940,"234":1046,"235":979,"236":903,"237":980,"238":1156,"239":922,"240":1035,"241":906,"242":971,"243":972,"244":878,"245":1134,"246":879,"247":1133,"248":907,"249":1036,"250":908,"251":1132,"252":895,"253":909,"254":1060,"255":981,"256":1068,"257":996,"258":1192,"259":941,"260":865,"261":1008,"262":910,"263":997,"264":1193,"265":982,"266":942,"267":1020,"268":983,"269":1061,"270":949,"271":1176,"272":875,"273":911,"274":1069,"275":1157,"276":923,"277":1158,"278":924,"279":988,"280":984,"281":925,"282":1159,"283":1062,"284":1047,"285":1194,"286":998,"287":1021,"288":1030,"289":1031,"290":1070,"291":1088,"292":1169,"293":958,"294":1195,"295":999,"296":966,"297":1185,"298":944,"299":945,"300":1022,"301":1103,"302":220,"303":1099,"304":1048,"305":927,"306":1161,"307":989,"308":973,"309":1071,"310":1074,"311":1072,"312":1073,"313":912,"314":1037,"315":913,"316":914,"317":1177,"318":950,"319":1049,"320":876,"321":985,"322":915,"323":1038,"324":946,"325":1089,"326":1170,"327":1090,"328":1171,"329":1091,"330":1172,"331":1063,"332":986,"333":928,"334":1162,"335":929,"336":1163,"337":976,"338":231,"339":201,"340":1098,"341":215}', true));
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
var_dump($e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$pdo->query("DROP TABLE b66584");
|
||||||
|
$pdo->rollback();
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
}
|
||||||
|
|
||||||
|
function run($pdo, $data)
|
||||||
|
{
|
||||||
|
$bind = join(', ', array_fill(0, count($data), '?'));
|
||||||
|
|
||||||
|
$stmt = $pdo->prepare("SELECT COUNT(*) FROM b66584 WHERE a IN ({$bind})");
|
||||||
|
|
||||||
|
var_dump(count($data));
|
||||||
|
|
||||||
|
$stmt->execute($data);
|
||||||
|
|
||||||
|
var_dump($stmt->fetchColumn());
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
--EXPECTF--
|
||||||
|
int(3)
|
||||||
|
string(%d) "SQLSTATE%s"
|
||||||
|
int(340)
|
||||||
|
string(%d) "SQLSTATE%s"
|
||||||
|
int(3)
|
||||||
|
string(%d) "SQLSTATE%s"
|
||||||
|
int(340)
|
||||||
|
string(%d) "SQLSTATE%s"
|
34
ext/pdo_pgsql/tests/bug67462.phpt
Normal file
34
ext/pdo_pgsql/tests/bug67462.phpt
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
--TEST--
|
||||||
|
PDO PgSQL Bug #67462 (PDO_PGSQL::beginTransaction() wrongly throws exception when not in transaction)
|
||||||
|
--SKIPIF--
|
||||||
|
<?php
|
||||||
|
if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not loaded');
|
||||||
|
require dirname(__FILE__) . '/config.inc';
|
||||||
|
require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
|
||||||
|
PDOTest::skip();
|
||||||
|
?>
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
|
||||||
|
$pdo = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt');
|
||||||
|
$pdo->setAttribute (\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
|
||||||
|
|
||||||
|
$pdo->beginTransaction();
|
||||||
|
|
||||||
|
try {
|
||||||
|
$pdo->query("CREATE TABLE b67462 (a int NOT NULL PRIMARY KEY DEFERRABLE INITIALLY DEFERRED)");
|
||||||
|
$pdo->query("INSERT INTO b67462 VALUES (1), (1)");
|
||||||
|
|
||||||
|
var_dump($pdo->inTransaction());
|
||||||
|
$pdo->commit(); // This should fail!
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
var_dump($pdo->inTransaction());
|
||||||
|
var_dump($pdo->beginTransaction());
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
--EXPECT--
|
||||||
|
bool(true)
|
||||||
|
bool(false)
|
||||||
|
bool(true)
|
|
@ -87,6 +87,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define CHECK_DEFAULT_LINK(x) if ((x) == -1) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "No PostgreSQL link opened yet"); }
|
#define CHECK_DEFAULT_LINK(x) if ((x) == -1) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "No PostgreSQL link opened yet"); }
|
||||||
|
#define FETCH_DEFAULT_LINK() PGG(default_link) ? (int)PGG(default_link)->handle : -1
|
||||||
|
|
||||||
#ifndef HAVE_PQFREEMEM
|
#ifndef HAVE_PQFREEMEM
|
||||||
#define PQfreemem free
|
#define PQfreemem free
|
||||||
|
@ -1278,7 +1279,8 @@ static void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
|
||||||
PGconn *pgsql;
|
PGconn *pgsql;
|
||||||
smart_str str = {0};
|
smart_str str = {0};
|
||||||
zval *args;
|
zval *args;
|
||||||
int i, connect_type = 0;
|
uint32_t i;
|
||||||
|
int connect_type = 0;
|
||||||
PGresult *pg_result;
|
PGresult *pg_result;
|
||||||
|
|
||||||
args = (zval *)safe_emalloc(ZEND_NUM_ARGS(), sizeof(zval), 0);
|
args = (zval *)safe_emalloc(ZEND_NUM_ARGS(), sizeof(zval), 0);
|
||||||
|
@ -1313,7 +1315,7 @@ static void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
|
||||||
} else if (ZEND_NUM_ARGS() == 2 ) { /* Safe to add conntype_option, since 2 args was illegal */
|
} else if (ZEND_NUM_ARGS() == 2 ) { /* Safe to add conntype_option, since 2 args was illegal */
|
||||||
connstring = Z_STRVAL(args[0]);
|
connstring = Z_STRVAL(args[0]);
|
||||||
convert_to_long_ex(&args[1]);
|
convert_to_long_ex(&args[1]);
|
||||||
connect_type = Z_LVAL(args[1]);
|
connect_type = (int)Z_LVAL(args[1]);
|
||||||
} else {
|
} else {
|
||||||
host = Z_STRVAL(args[0]);
|
host = Z_STRVAL(args[0]);
|
||||||
port = Z_STRVAL(args[1]);
|
port = Z_STRVAL(args[1]);
|
||||||
|
@ -1566,7 +1568,7 @@ PHP_FUNCTION(pg_close)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argc == 0) {
|
if (argc == 0) {
|
||||||
id = PGG(default_link)? PGG(default_link)->handle : -1;
|
id = FETCH_DEFAULT_LINK();
|
||||||
CHECK_DEFAULT_LINK(id);
|
CHECK_DEFAULT_LINK(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1613,7 +1615,7 @@ static void php_pgsql_get_link_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argc == 0) {
|
if (argc == 0) {
|
||||||
id = PGG(default_link)? PGG(default_link)->handle : -1;
|
id = FETCH_DEFAULT_LINK();
|
||||||
CHECK_DEFAULT_LINK(id);
|
CHECK_DEFAULT_LINK(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1760,7 +1762,7 @@ PHP_FUNCTION(pg_parameter_status)
|
||||||
id = -1;
|
id = -1;
|
||||||
} else if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m, &len) == SUCCESS) {
|
} else if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", ¶m, &len) == SUCCESS) {
|
||||||
pgsql_link = NULL;
|
pgsql_link = NULL;
|
||||||
id = PGG(default_link)? PGG(default_link)->handle : -1;
|
id = FETCH_DEFAULT_LINK();
|
||||||
} else {
|
} else {
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
@ -1793,7 +1795,7 @@ PHP_FUNCTION(pg_ping)
|
||||||
id = -1;
|
id = -1;
|
||||||
} else {
|
} else {
|
||||||
pgsql_link = NULL;
|
pgsql_link = NULL;
|
||||||
id = PGG(default_link)? PGG(default_link)->handle : -1;
|
id = FETCH_DEFAULT_LINK();
|
||||||
}
|
}
|
||||||
if (pgsql_link == NULL && id == -1) {
|
if (pgsql_link == NULL && id == -1) {
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
|
@ -1836,7 +1838,7 @@ PHP_FUNCTION(pg_query)
|
||||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &query, &query_len) == FAILURE) {
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &query, &query_len) == FAILURE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
id = PGG(default_link)? PGG(default_link)->handle : -1;
|
id = FETCH_DEFAULT_LINK();
|
||||||
CHECK_DEFAULT_LINK(id);
|
CHECK_DEFAULT_LINK(id);
|
||||||
} else {
|
} else {
|
||||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &pgsql_link, &query, &query_len) == FAILURE) {
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &pgsql_link, &query, &query_len) == FAILURE) {
|
||||||
|
@ -1939,7 +1941,7 @@ PHP_FUNCTION(pg_query_params)
|
||||||
if (zend_parse_parameters(argc TSRMLS_CC, "sa", &query, &query_len, &pv_param_arr) == FAILURE) {
|
if (zend_parse_parameters(argc TSRMLS_CC, "sa", &query, &query_len, &pv_param_arr) == FAILURE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
id = PGG(default_link)? PGG(default_link)->handle : -1;
|
id = FETCH_DEFAULT_LINK();
|
||||||
CHECK_DEFAULT_LINK(id);
|
CHECK_DEFAULT_LINK(id);
|
||||||
} else {
|
} else {
|
||||||
if (zend_parse_parameters(argc TSRMLS_CC, "rsa", &pgsql_link, &query, &query_len, &pv_param_arr) == FAILURE) {
|
if (zend_parse_parameters(argc TSRMLS_CC, "rsa", &pgsql_link, &query, &query_len, &pv_param_arr) == FAILURE) {
|
||||||
|
@ -2055,7 +2057,7 @@ PHP_FUNCTION(pg_prepare)
|
||||||
if (zend_parse_parameters(argc TSRMLS_CC, "ss", &stmtname, &stmtname_len, &query, &query_len) == FAILURE) {
|
if (zend_parse_parameters(argc TSRMLS_CC, "ss", &stmtname, &stmtname_len, &query, &query_len) == FAILURE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
id = PGG(default_link)? PGG(default_link)->handle : -1;
|
id = FETCH_DEFAULT_LINK();
|
||||||
CHECK_DEFAULT_LINK(id);
|
CHECK_DEFAULT_LINK(id);
|
||||||
} else {
|
} else {
|
||||||
if (zend_parse_parameters(argc TSRMLS_CC, "rss", &pgsql_link, &stmtname, &stmtname_len, &query, &query_len) == FAILURE) {
|
if (zend_parse_parameters(argc TSRMLS_CC, "rss", &pgsql_link, &stmtname, &stmtname_len, &query, &query_len) == FAILURE) {
|
||||||
|
@ -2142,7 +2144,7 @@ PHP_FUNCTION(pg_execute)
|
||||||
if (zend_parse_parameters(argc TSRMLS_CC, "sa/", &stmtname, &stmtname_len, &pv_param_arr)==FAILURE) {
|
if (zend_parse_parameters(argc TSRMLS_CC, "sa/", &stmtname, &stmtname_len, &pv_param_arr)==FAILURE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
id = PGG(default_link)? PGG(default_link)->handle : -1;
|
id = FETCH_DEFAULT_LINK();
|
||||||
CHECK_DEFAULT_LINK(id);
|
CHECK_DEFAULT_LINK(id);
|
||||||
} else {
|
} else {
|
||||||
if (zend_parse_parameters(argc TSRMLS_CC, "rsa/", &pgsql_link, &stmtname, &stmtname_len, &pv_param_arr) == FAILURE) {
|
if (zend_parse_parameters(argc TSRMLS_CC, "rsa/", &pgsql_link, &stmtname, &stmtname_len, &pv_param_arr) == FAILURE) {
|
||||||
|
@ -2420,7 +2422,7 @@ PHP_FUNCTION(pg_field_table)
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
oid = PQftable(pg_result->result, fnum);
|
oid = PQftable(pg_result->result, (int)fnum);
|
||||||
|
|
||||||
if (InvalidOid == oid) {
|
if (InvalidOid == oid) {
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
|
@ -2515,20 +2517,20 @@ static void php_pgsql_get_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_typ
|
||||||
|
|
||||||
switch (entry_type) {
|
switch (entry_type) {
|
||||||
case PHP_PG_FIELD_NAME:
|
case PHP_PG_FIELD_NAME:
|
||||||
RETURN_STRING(PQfname(pgsql_result, field));
|
RETURN_STRING(PQfname(pgsql_result, (int)field));
|
||||||
break;
|
break;
|
||||||
case PHP_PG_FIELD_SIZE:
|
case PHP_PG_FIELD_SIZE:
|
||||||
RETURN_LONG(PQfsize(pgsql_result, field));
|
RETURN_LONG(PQfsize(pgsql_result, (int)field));
|
||||||
break;
|
break;
|
||||||
case PHP_PG_FIELD_TYPE: {
|
case PHP_PG_FIELD_TYPE: {
|
||||||
char *name = get_field_name(pg_result->conn, PQftype(pgsql_result, field), &EG(regular_list) TSRMLS_CC);
|
char *name = get_field_name(pg_result->conn, PQftype(pgsql_result, (int)field), &EG(regular_list) TSRMLS_CC);
|
||||||
RETVAL_STRING(name);
|
RETVAL_STRING(name);
|
||||||
efree(name);
|
efree(name);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PHP_PG_FIELD_TYPE_OID:
|
case PHP_PG_FIELD_TYPE_OID:
|
||||||
|
|
||||||
oid = PQftype(pgsql_result, field);
|
oid = PQftype(pgsql_result, (int)field);
|
||||||
#if UINT_MAX > ZEND_LONG_MAX
|
#if UINT_MAX > ZEND_LONG_MAX
|
||||||
if (oid > ZEND_LONG_MAX) {
|
if (oid > ZEND_LONG_MAX) {
|
||||||
smart_str s = {0};
|
smart_str s = {0};
|
||||||
|
@ -2633,26 +2635,30 @@ PHP_FUNCTION(pg_fetch_result)
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
pgsql_row = row;
|
if (row < 0 || row >= PQntuples(pgsql_result)) {
|
||||||
if (pgsql_row < 0 || pgsql_row >= PQntuples(pgsql_result)) {
|
|
||||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to jump to row %pd on PostgreSQL result index %pd",
|
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to jump to row %pd on PostgreSQL result index %pd",
|
||||||
row, Z_LVAL_P(result));
|
row, Z_LVAL_P(result));
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
pgsql_row = (int)row;
|
||||||
}
|
}
|
||||||
switch (Z_TYPE_P(field)) {
|
switch (Z_TYPE_P(field)) {
|
||||||
case IS_STRING:
|
case IS_STRING:
|
||||||
field_offset = PQfnumber(pgsql_result, Z_STRVAL_P(field));
|
field_offset = PQfnumber(pgsql_result, Z_STRVAL_P(field));
|
||||||
break;
|
|
||||||
default:
|
|
||||||
convert_to_long_ex(field);
|
|
||||||
field_offset = Z_LVAL_P(field);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (field_offset < 0 || field_offset >= PQnfields(pgsql_result)) {
|
if (field_offset < 0 || field_offset >= PQnfields(pgsql_result)) {
|
||||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad column offset specified");
|
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad column offset specified");
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
convert_to_long_ex(field);
|
||||||
|
if (Z_LVAL_P(field) < 0 || Z_LVAL_P(field) >= PQnfields(pgsql_result)) {
|
||||||
|
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad column offset specified");
|
||||||
|
RETURN_FALSE;
|
||||||
|
}
|
||||||
|
field_offset = (int)Z_LVAL_P(field);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (PQgetisnull(pgsql_result, pgsql_row, field_offset)) {
|
if (PQgetisnull(pgsql_result, pgsql_row, field_offset)) {
|
||||||
RETVAL_NULL();
|
RETVAL_NULL();
|
||||||
|
@ -2718,13 +2724,13 @@ static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, zend_long result_
|
||||||
pgsql_result = pg_result->result;
|
pgsql_result = pg_result->result;
|
||||||
|
|
||||||
if (use_row) {
|
if (use_row) {
|
||||||
pgsql_row = row;
|
if (row < 0 || row >= PQntuples(pgsql_result)) {
|
||||||
pg_result->row = pgsql_row;
|
|
||||||
if (pgsql_row < 0 || pgsql_row >= PQntuples(pgsql_result)) {
|
|
||||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to jump to row %pd on PostgreSQL result index %pd",
|
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to jump to row %pd on PostgreSQL result index %pd",
|
||||||
row, Z_LVAL_P(result));
|
row, Z_LVAL_P(result));
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
pgsql_row = (int)row;
|
||||||
|
pg_result->row = pgsql_row;
|
||||||
} else {
|
} else {
|
||||||
/* If 2nd param is NULL, use internal row counter to access next row */
|
/* If 2nd param is NULL, use internal row counter to access next row */
|
||||||
pgsql_row = pg_result->row;
|
pgsql_row = pg_result->row;
|
||||||
|
@ -2904,7 +2910,7 @@ PHP_FUNCTION(pg_fetch_all_columns)
|
||||||
pgsql_result = pg_result->result;
|
pgsql_result = pg_result->result;
|
||||||
|
|
||||||
num_fields = PQnfields(pgsql_result);
|
num_fields = PQnfields(pgsql_result);
|
||||||
if (colno >= num_fields || colno < 0) {
|
if (colno >= (zend_long)num_fields || colno < 0) {
|
||||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid column number '%pd'", colno);
|
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid column number '%pd'", colno);
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
@ -2916,10 +2922,10 @@ PHP_FUNCTION(pg_fetch_all_columns)
|
||||||
}
|
}
|
||||||
|
|
||||||
for (pg_row = 0; pg_row < pg_numrows; pg_row++) {
|
for (pg_row = 0; pg_row < pg_numrows; pg_row++) {
|
||||||
if (PQgetisnull(pgsql_result, pg_row, colno)) {
|
if (PQgetisnull(pgsql_result, pg_row, (int)colno)) {
|
||||||
add_next_index_null(return_value);
|
add_next_index_null(return_value);
|
||||||
} else {
|
} else {
|
||||||
add_next_index_string(return_value, PQgetvalue(pgsql_result, pg_row, colno));
|
add_next_index_string(return_value, PQgetvalue(pgsql_result, pg_row, (int)colno));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2944,7 +2950,7 @@ PHP_FUNCTION(pg_result_seek)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* seek to offset */
|
/* seek to offset */
|
||||||
pg_result->row = row;
|
pg_result->row = (int)row;
|
||||||
RETURN_TRUE;
|
RETURN_TRUE;
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
@ -2984,28 +2990,32 @@ static void php_pgsql_data_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
pgsql_row = row;
|
if (row < 0 || row >= PQntuples(pgsql_result)) {
|
||||||
if (pgsql_row < 0 || pgsql_row >= PQntuples(pgsql_result)) {
|
|
||||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to jump to row %pd on PostgreSQL result index %pd",
|
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to jump to row %pd on PostgreSQL result index %pd",
|
||||||
row, Z_LVAL_P(result));
|
row, Z_LVAL_P(result));
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
pgsql_row = (int)row;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (Z_TYPE_P(field)) {
|
switch (Z_TYPE_P(field)) {
|
||||||
case IS_STRING:
|
case IS_STRING:
|
||||||
convert_to_string_ex(field);
|
convert_to_string_ex(field);
|
||||||
field_offset = PQfnumber(pgsql_result, Z_STRVAL_P(field));
|
field_offset = PQfnumber(pgsql_result, Z_STRVAL_P(field));
|
||||||
break;
|
|
||||||
default:
|
|
||||||
convert_to_long_ex(field);
|
|
||||||
field_offset = Z_LVAL_P(field);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (field_offset < 0 || field_offset >= PQnfields(pgsql_result)) {
|
if (field_offset < 0 || field_offset >= PQnfields(pgsql_result)) {
|
||||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad column offset specified");
|
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad column offset specified");
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
convert_to_long_ex(field);
|
||||||
|
if (Z_LVAL_P(field) < 0 || Z_LVAL_P(field) >= PQnfields(pgsql_result)) {
|
||||||
|
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad column offset specified");
|
||||||
|
RETURN_FALSE;
|
||||||
|
}
|
||||||
|
field_offset = (int)Z_LVAL_P(field);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
switch (entry_type) {
|
switch (entry_type) {
|
||||||
case PHP_PG_DATA_LENGTH:
|
case PHP_PG_DATA_LENGTH:
|
||||||
|
@ -3098,7 +3108,7 @@ PHP_FUNCTION(pg_trace)
|
||||||
PGconn *pgsql;
|
PGconn *pgsql;
|
||||||
FILE *fp = NULL;
|
FILE *fp = NULL;
|
||||||
php_stream *stream;
|
php_stream *stream;
|
||||||
id = PGG(default_link)? PGG(default_link)->handle : -1;
|
id = FETCH_DEFAULT_LINK();
|
||||||
|
|
||||||
if (zend_parse_parameters(argc TSRMLS_CC, "s|sr", &z_filename, &z_filename_len, &mode, &mode_len, &pgsql_link) == FAILURE) {
|
if (zend_parse_parameters(argc TSRMLS_CC, "s|sr", &z_filename, &z_filename_len, &mode, &mode_len, &pgsql_link) == FAILURE) {
|
||||||
return;
|
return;
|
||||||
|
@ -3143,7 +3153,7 @@ PHP_FUNCTION(pg_untrace)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argc == 0) {
|
if (argc == 0) {
|
||||||
id = PGG(default_link)? PGG(default_link)->handle : -1;
|
id = FETCH_DEFAULT_LINK();
|
||||||
CHECK_DEFAULT_LINK(id);
|
CHECK_DEFAULT_LINK(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3176,7 +3186,7 @@ PHP_FUNCTION(pg_lo_create)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pgsql_link == NULL) {
|
if (pgsql_link == NULL) {
|
||||||
id = PGG(default_link)? PGG(default_link)->handle : -1;
|
id = FETCH_DEFAULT_LINK();
|
||||||
CHECK_DEFAULT_LINK(id);
|
CHECK_DEFAULT_LINK(id);
|
||||||
if (id == -1) {
|
if (id == -1) {
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
|
@ -3269,7 +3279,7 @@ PHP_FUNCTION(pg_lo_unlink)
|
||||||
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Wrong OID value passed");
|
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Wrong OID value passed");
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
id = PGG(default_link)? PGG(default_link)->handle : -1;
|
id = FETCH_DEFAULT_LINK();
|
||||||
CHECK_DEFAULT_LINK(id);
|
CHECK_DEFAULT_LINK(id);
|
||||||
}
|
}
|
||||||
else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
|
else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
|
||||||
|
@ -3279,7 +3289,7 @@ PHP_FUNCTION(pg_lo_unlink)
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
oid = (Oid)oid_long;
|
oid = (Oid)oid_long;
|
||||||
id = PGG(default_link)? PGG(default_link)->handle : -1;
|
id = FETCH_DEFAULT_LINK();
|
||||||
CHECK_DEFAULT_LINK(id);
|
CHECK_DEFAULT_LINK(id);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -3341,7 +3351,7 @@ PHP_FUNCTION(pg_lo_open)
|
||||||
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Wrong OID value passed");
|
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Wrong OID value passed");
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
id = PGG(default_link)? PGG(default_link)->handle : -1;
|
id = FETCH_DEFAULT_LINK();
|
||||||
CHECK_DEFAULT_LINK(id);
|
CHECK_DEFAULT_LINK(id);
|
||||||
}
|
}
|
||||||
else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
|
else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
|
||||||
|
@ -3351,7 +3361,7 @@ PHP_FUNCTION(pg_lo_open)
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
oid = (Oid)oid_long;
|
oid = (Oid)oid_long;
|
||||||
id = PGG(default_link)? PGG(default_link)->handle : -1;
|
id = FETCH_DEFAULT_LINK();
|
||||||
CHECK_DEFAULT_LINK(id);
|
CHECK_DEFAULT_LINK(id);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -3453,7 +3463,8 @@ PHP_FUNCTION(pg_lo_read)
|
||||||
{
|
{
|
||||||
zval *pgsql_id;
|
zval *pgsql_id;
|
||||||
zend_long len;
|
zend_long len;
|
||||||
int buf_len = PGSQL_LO_READ_BUF_SIZE, nbytes, argc = ZEND_NUM_ARGS();
|
size_t buf_len = PGSQL_LO_READ_BUF_SIZE;
|
||||||
|
int nbytes, argc = ZEND_NUM_ARGS();
|
||||||
zend_string *buf;
|
zend_string *buf;
|
||||||
pgLofp *pgsql;
|
pgLofp *pgsql;
|
||||||
|
|
||||||
|
@ -3464,7 +3475,7 @@ PHP_FUNCTION(pg_lo_read)
|
||||||
ZEND_FETCH_RESOURCE(pgsql, pgLofp *, pgsql_id, -1, "PostgreSQL large object", le_lofp);
|
ZEND_FETCH_RESOURCE(pgsql, pgLofp *, pgsql_id, -1, "PostgreSQL large object", le_lofp);
|
||||||
|
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
buf_len = len;
|
buf_len = len < 0 ? 0 : len;
|
||||||
}
|
}
|
||||||
|
|
||||||
buf = zend_string_alloc(buf_len, 0);
|
buf = zend_string_alloc(buf_len, 0);
|
||||||
|
@ -3496,7 +3507,7 @@ PHP_FUNCTION(pg_lo_write)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argc > 2) {
|
if (argc > 2) {
|
||||||
if (z_len > str_len) {
|
if (z_len > (zend_long)str_len) {
|
||||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot write more than buffer size %d. Tried to write %pd", str_len, z_len);
|
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot write more than buffer size %d. Tried to write %pd", str_len, z_len);
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
@ -3563,7 +3574,7 @@ PHP_FUNCTION(pg_lo_import)
|
||||||
}
|
}
|
||||||
else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
|
else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
|
||||||
"p|z", &file_in, &name_len, &oid) == SUCCESS) {
|
"p|z", &file_in, &name_len, &oid) == SUCCESS) {
|
||||||
id = PGG(default_link)? PGG(default_link)->handle : -1;
|
id = FETCH_DEFAULT_LINK();
|
||||||
CHECK_DEFAULT_LINK(id);
|
CHECK_DEFAULT_LINK(id);
|
||||||
}
|
}
|
||||||
/* old calling convention, deprecated since PHP 4.2 */
|
/* old calling convention, deprecated since PHP 4.2 */
|
||||||
|
@ -3672,7 +3683,7 @@ PHP_FUNCTION(pg_lo_export)
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
oid = (Oid)oid_long;
|
oid = (Oid)oid_long;
|
||||||
id = PGG(default_link)? PGG(default_link)->handle : -1;
|
id = FETCH_DEFAULT_LINK();
|
||||||
CHECK_DEFAULT_LINK(id);
|
CHECK_DEFAULT_LINK(id);
|
||||||
}
|
}
|
||||||
else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
|
else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
|
||||||
|
@ -3683,7 +3694,7 @@ PHP_FUNCTION(pg_lo_export)
|
||||||
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Wrong OID value passed");
|
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Wrong OID value passed");
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
id = PGG(default_link)? PGG(default_link)->handle : -1;
|
id = FETCH_DEFAULT_LINK();
|
||||||
CHECK_DEFAULT_LINK(id);
|
CHECK_DEFAULT_LINK(id);
|
||||||
}
|
}
|
||||||
else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
|
else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC,
|
||||||
|
@ -3747,9 +3758,9 @@ PHP_FUNCTION(pg_lo_seek)
|
||||||
|
|
||||||
#if HAVE_PG_LO64
|
#if HAVE_PG_LO64
|
||||||
if (PQserverVersion((PGconn *)pgsql->conn) >= 90300) {
|
if (PQserverVersion((PGconn *)pgsql->conn) >= 90300) {
|
||||||
result = lo_lseek64((PGconn *)pgsql->conn, pgsql->lofd, offset, whence);
|
result = lo_lseek64((PGconn *)pgsql->conn, pgsql->lofd, offset, (int)whence);
|
||||||
} else {
|
} else {
|
||||||
result = lo_lseek((PGconn *)pgsql->conn, pgsql->lofd, offset, whence);
|
result = lo_lseek((PGconn *)pgsql->conn, pgsql->lofd, (int)offset, (int)whence);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
result = lo_lseek((PGconn *)pgsql->conn, pgsql->lofd, offset, whence);
|
result = lo_lseek((PGconn *)pgsql->conn, pgsql->lofd, offset, whence);
|
||||||
|
@ -3839,7 +3850,7 @@ PHP_FUNCTION(pg_set_error_verbosity)
|
||||||
if (zend_parse_parameters(argc TSRMLS_CC, "l", &verbosity) == FAILURE) {
|
if (zend_parse_parameters(argc TSRMLS_CC, "l", &verbosity) == FAILURE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
id = PGG(default_link)? PGG(default_link)->handle : -1;
|
id = FETCH_DEFAULT_LINK();
|
||||||
CHECK_DEFAULT_LINK(id);
|
CHECK_DEFAULT_LINK(id);
|
||||||
} else {
|
} else {
|
||||||
if (zend_parse_parameters(argc TSRMLS_CC, "rl", &pgsql_link, &verbosity) == FAILURE) {
|
if (zend_parse_parameters(argc TSRMLS_CC, "rl", &pgsql_link, &verbosity) == FAILURE) {
|
||||||
|
@ -3877,7 +3888,7 @@ PHP_FUNCTION(pg_set_client_encoding)
|
||||||
if (zend_parse_parameters(argc TSRMLS_CC, "s", &encoding, &encoding_len) == FAILURE) {
|
if (zend_parse_parameters(argc TSRMLS_CC, "s", &encoding, &encoding_len) == FAILURE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
id = PGG(default_link)? PGG(default_link)->handle : -1;
|
id = FETCH_DEFAULT_LINK();
|
||||||
CHECK_DEFAULT_LINK(id);
|
CHECK_DEFAULT_LINK(id);
|
||||||
} else {
|
} else {
|
||||||
if (zend_parse_parameters(argc TSRMLS_CC, "rs", &pgsql_link, &encoding, &encoding_len) == FAILURE) {
|
if (zend_parse_parameters(argc TSRMLS_CC, "rs", &pgsql_link, &encoding, &encoding_len) == FAILURE) {
|
||||||
|
@ -3908,7 +3919,7 @@ PHP_FUNCTION(pg_client_encoding)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argc == 0) {
|
if (argc == 0) {
|
||||||
id = PGG(default_link)? PGG(default_link)->handle : -1;
|
id = FETCH_DEFAULT_LINK();
|
||||||
CHECK_DEFAULT_LINK(id);
|
CHECK_DEFAULT_LINK(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3943,7 +3954,7 @@ PHP_FUNCTION(pg_end_copy)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argc == 0) {
|
if (argc == 0) {
|
||||||
id = PGG(default_link)? PGG(default_link)->handle : -1;
|
id = FETCH_DEFAULT_LINK();
|
||||||
CHECK_DEFAULT_LINK(id);
|
CHECK_DEFAULT_LINK(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3978,7 +3989,7 @@ PHP_FUNCTION(pg_put_line)
|
||||||
if (zend_parse_parameters(argc TSRMLS_CC, "s", &query, &query_len) == FAILURE) {
|
if (zend_parse_parameters(argc TSRMLS_CC, "s", &query, &query_len) == FAILURE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
id = PGG(default_link) ? PGG(default_link)->handle : -1;
|
id = FETCH_DEFAULT_LINK();
|
||||||
CHECK_DEFAULT_LINK(id);
|
CHECK_DEFAULT_LINK(id);
|
||||||
} else {
|
} else {
|
||||||
if (zend_parse_parameters(argc TSRMLS_CC, "rs", &pgsql_link, &query, &query_len) == FAILURE) {
|
if (zend_parse_parameters(argc TSRMLS_CC, "rs", &pgsql_link, &query, &query_len) == FAILURE) {
|
||||||
|
@ -4198,7 +4209,7 @@ PHP_FUNCTION(pg_copy_from)
|
||||||
if(Z_STRLEN_P(tmp) > 0 && *(query + Z_STRLEN_P(tmp) - 1) != '\n') {
|
if(Z_STRLEN_P(tmp) > 0 && *(query + Z_STRLEN_P(tmp) - 1) != '\n') {
|
||||||
strlcat(query, "\n", Z_STRLEN_P(tmp) + 2);
|
strlcat(query, "\n", Z_STRLEN_P(tmp) + 2);
|
||||||
}
|
}
|
||||||
if (PQputCopyData(pgsql, query, strlen(query)) != 1) {
|
if (PQputCopyData(pgsql, query, (int)strlen(query)) != 1) {
|
||||||
efree(query);
|
efree(query);
|
||||||
PHP_PQ_ERROR("copy failed: %s", pgsql);
|
PHP_PQ_ERROR("copy failed: %s", pgsql);
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
|
@ -4276,7 +4287,7 @@ PHP_FUNCTION(pg_escape_string)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
pgsql_link = NULL;
|
pgsql_link = NULL;
|
||||||
id = PGG(default_link)? PGG(default_link)->handle : -1;
|
id = FETCH_DEFAULT_LINK();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -4321,7 +4332,7 @@ PHP_FUNCTION(pg_escape_bytea)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
pgsql_link = NULL;
|
pgsql_link = NULL;
|
||||||
id = PGG(default_link)? PGG(default_link)->handle : -1;
|
id = FETCH_DEFAULT_LINK();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -4494,7 +4505,7 @@ static void php_pgsql_escape_internal(INTERNAL_FUNCTION_PARAMETERS, int escape_l
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
pgsql_link = NULL;
|
pgsql_link = NULL;
|
||||||
id = PGG(default_link)? PGG(default_link)->handle : - 1;
|
id = FETCH_DEFAULT_LINK();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -4604,7 +4615,7 @@ PHP_FUNCTION(pg_result_error_field)
|
||||||
#endif
|
#endif
|
||||||
|PG_DIAG_CONTEXT|PG_DIAG_SOURCE_FILE|PG_DIAG_SOURCE_LINE
|
|PG_DIAG_CONTEXT|PG_DIAG_SOURCE_FILE|PG_DIAG_SOURCE_LINE
|
||||||
|PG_DIAG_SOURCE_FUNCTION)) {
|
|PG_DIAG_SOURCE_FUNCTION)) {
|
||||||
field = (char *)PQresultErrorField(pgsql_result, fieldcode);
|
field = (char *)PQresultErrorField(pgsql_result, (int)fieldcode);
|
||||||
if (field == NULL) {
|
if (field == NULL) {
|
||||||
RETURN_NULL();
|
RETURN_NULL();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -42,7 +42,13 @@ var_dump(file_exists($tracefile));
|
||||||
?>
|
?>
|
||||||
===DONE===
|
===DONE===
|
||||||
--CLEAN--
|
--CLEAN--
|
||||||
<?php unlink($tracefile); ?>
|
<?php
|
||||||
|
|
||||||
|
$tracefile = dirname(__FILE__) . '/trace.tmp';
|
||||||
|
|
||||||
|
unlink($tracefile);
|
||||||
|
|
||||||
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
bool(false)
|
bool(false)
|
||||||
resource(%d) of type (pgsql result)
|
resource(%d) of type (pgsql result)
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
<?php
|
<?php
|
||||||
// These vars are used to connect db and create test table.
|
|
||||||
// values can be set to meet your environment
|
|
||||||
|
|
||||||
// "test" database must be existed. i.e. "createdb test" before testing
|
// These vars are used to connect db and create test table.
|
||||||
// PostgreSQL uses login name as username, user must have access to "test" database.
|
// values can be set to meet your environment with the
|
||||||
$conn_str = "user=test password=test host=localhost dbname=test port=5432"; // connection string
|
// environment var PGSQL_TEST_CONNSTR
|
||||||
|
|
||||||
|
// "test" database must exist. i.e. "createdb test" before testing
|
||||||
|
$conn_str = getenv('PGSQL_TEST_CONNSTR') ?: "host=localhost dbname=test port=5432"; // connection string
|
||||||
|
|
||||||
$table_name = "php_pgsql_test"; // test table that will be created
|
$table_name = "php_pgsql_test"; // test table that will be created
|
||||||
$table_name_92 = "php_pgsql_test_92"; // test table that will be created
|
$table_name_92 = "php_pgsql_test_92"; // test table that will be created
|
||||||
$num_test_record = 1000; // Number of records to create
|
$num_test_record = 1000; // Number of records to create
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue