mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-19 23:16:38 +00:00
Compare commits
82
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fc982e5248 | ||
|
|
41b3015125 | ||
|
|
42b7601378 | ||
|
|
86c32174be | ||
|
|
c5bf17f0a5 | ||
|
|
730359dc4d | ||
|
|
4053948470 | ||
|
|
333ce2d050 | ||
|
|
a84618a3de | ||
|
|
eff475de14 | ||
|
|
7114dae40d | ||
|
|
ec9bda9e5c | ||
|
|
74dbaf655b | ||
|
|
137b57c5ba | ||
|
|
6d00133ce2 | ||
|
|
087fd4c609 | ||
|
|
1b740da6d4 | ||
|
|
0d3ce62b63 | ||
|
|
d90cd52b89 | ||
|
|
973dbce2b9 | ||
|
|
f51c000bac | ||
|
|
39812d33f7 | ||
|
|
2e9991865e | ||
|
|
016ac5d400 | ||
|
|
bf344046b3 | ||
|
|
26a5bb3fc7 | ||
|
|
c117b30950 | ||
|
|
b7a1b19734 | ||
|
|
3ba574871c | ||
|
|
6122d87789 | ||
|
|
8dffa18aec | ||
|
|
f51e3d044a | ||
|
|
6cc67717b1 | ||
|
|
30812e3707 | ||
|
|
0550e954e0 | ||
|
|
73941736ca | ||
|
|
80754851bd | ||
|
|
2ae1766c1c | ||
|
|
96462f90a0 | ||
|
|
c4cc49f487 | ||
|
|
07b4a21631 | ||
|
|
9c30514661 | ||
|
|
a9d8aa7e08 | ||
|
|
28caf732a7 | ||
|
|
513874acc7 | ||
|
|
d2363cdd19 | ||
|
|
30cd11ced1 | ||
|
|
8bed40bc2f | ||
|
|
4c6c14ac5e | ||
|
|
a85d4245a3 | ||
|
|
afe0765c0a | ||
|
|
0e57f1324b | ||
|
|
938b31d395 | ||
|
|
f3ffe2d258 | ||
|
|
1563fa9a67 | ||
|
|
a4cf06cecd | ||
|
|
bd5d7bba59 | ||
|
|
b404501183 | ||
|
|
b3655b0e12 | ||
|
|
e8f9edd7a7 | ||
|
|
95061e9ad2 | ||
|
|
0f5dea39ad | ||
|
|
8ca2454ce2 | ||
|
|
e455e7cbca | ||
|
|
b33f9a00d2 | ||
|
|
e017ca8b72 | ||
|
|
6e75cfbd8c | ||
|
|
a1c9bd2bfb | ||
|
|
70a7172018 | ||
|
|
0dcfb7341f | ||
|
|
91bd1d25e1 | ||
|
|
766eaa4078 | ||
|
|
8248d8cf2c | ||
|
|
0fd9dcc4bc | ||
|
|
b381ad0f9d | ||
|
|
e53366609d | ||
|
|
bace148543 | ||
|
|
6549c08dfe | ||
|
|
1910df096c | ||
|
|
dda54f4271 | ||
|
|
37f511a835 | ||
|
|
00bb550264 |
No files matched your search
@@ -1,6 +1,22 @@
|
||||
PHP 4.0 NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
?? ??? 200?, Version 4.0.7-dev
|
||||
- Fixed pg_last_notice() (could cause random crashes in PostgreSQL applications,
|
||||
even if they didn't use pg_last_notice()) (Zeev)
|
||||
- Fixed DOM-XML's error reporting, so E_WARNING errors are given instead of
|
||||
E_ERROR error's, this allows you to trap errors thrown by DOMXML functions.
|
||||
(Sterling)
|
||||
- Fixed a bug in the mcrypt extension, where list destructors were not
|
||||
properly being allocated. (Sterling)
|
||||
- Better Interbase blob, null and error handling (Patch by Jeremy Bettis)
|
||||
- Fixed a crash bug in array_map() if the input arrays had string or
|
||||
non-sequential keys. Also modified it so that if a single array is passed,
|
||||
its keys are preserved in the resulting array. (Andrei)
|
||||
- Fixed a crash in dbase_replace_record (Patch by robin.marlow@dps-int.com)
|
||||
- Fixed a crash in msql_result() (Zeev)
|
||||
- Added support for single dimensional SafeArrays and Enumerations.
|
||||
Added an is_enum() function to check if a component implements an
|
||||
enumeration. (Alan, Harald)
|
||||
- Fixed a bug in dbase_get_record() and dbase_get_record_with_names().
|
||||
boolean fields are now returned correctly.
|
||||
Patch by Lawrence E. Widman <widman@cardiothink.com> (Jani)
|
||||
@@ -30,6 +46,8 @@ PHP 4.0 NEWS
|
||||
- Added vprintf() and vsprintf() functions that allow passing all arguments
|
||||
after format as an array. (Andrei)
|
||||
- Added support for GD2 image type for ImageCreateFromString() (Jani)
|
||||
- Added ImageCreateFromGD(), ImageCreateFromGD2(), ImageCreateFromGD2part(),
|
||||
ImageGD() and ImageGD2() functions (Jani)
|
||||
- addcslashes now warns when charlist is invalid. The returned string
|
||||
remained the same (Jeroen)
|
||||
- Added optional extra argument to gmp_init(). The extra argument
|
||||
|
||||
+1
-1
@@ -20,4 +20,4 @@
|
||||
LTLIBRARY_OBJECTS = $(LTLIBRARY_SOURCES:.c=.lo) $(LTLIBRARY_OBJECTS_X)
|
||||
|
||||
$(LTLIBRARY_NAME): $(LTLIBRARY_OBJECTS) $(LTLIBRARY_DEPENDENCIES)
|
||||
$(LINK_CLEAN) $(LTLIBRARY_LDFLAGS) $(LTLIBRARY_OBJECTS) $(LTLIBRARY_LIBADD)
|
||||
$(LINK) $(LTLIBRARY_LDFLAGS) $(LTLIBRARY_OBJECTS) $(LTLIBRARY_LIBADD)
|
||||
+12
-5
@@ -51,7 +51,7 @@ dnl ## All of these are normally in the extension directories.
|
||||
dnl ## Diversion 5 is the last one. Here we generate files and clean up.
|
||||
|
||||
dnl ## This is where the version number is changed from now on!
|
||||
AM_INIT_AUTOMAKE(php, 4.0.7RC1, nodefine)
|
||||
AM_INIT_AUTOMAKE(php, 4.0.7RC3, nodefine)
|
||||
|
||||
PHP_VERSION=$VERSION
|
||||
echo "/* automatically generated by configure */" > php_version.h.new
|
||||
@@ -508,6 +508,7 @@ PHP_ARG_WITH(pear, [whether to install PEAR, and where],
|
||||
|
||||
if test "$PHP_PEAR" != "no"; then
|
||||
PEAR_DIR=pear
|
||||
PEAR_INSTALLDIR=$PHP_PEAR
|
||||
fi
|
||||
|
||||
if test "$PHP_PEAR" = "DEFAULT" -o "x$PHP_PEAR" = "xyes"; then
|
||||
@@ -608,9 +609,14 @@ PHP_ARG_ENABLE(dmalloc,whether to enable dmalloc,
|
||||
[ --enable-dmalloc Enable dmalloc])
|
||||
|
||||
if test "$PHP_DMALLOC" = "yes"; then
|
||||
AC_DEFINE(HAVE_DMALLOC,1,[Whether you have dmalloc])
|
||||
PHP_ADD_LIBRARY(dmalloc)
|
||||
CPPFLAGS="$CPPFLAGS -DDMALLOC_FUNC_CHECK"
|
||||
|
||||
AC_CHECK_LIB(dmalloc, dmalloc_error, [
|
||||
PHP_ADD_LIBRARY(dmalloc)
|
||||
AC_DEFINE(HAVE_DMALLOC,1,[Whether you have dmalloc])
|
||||
CPPFLAGS="$CPPFLAGS -DDMALLOC_FUNC_CHECK"
|
||||
], [
|
||||
AC_MSG_ERROR(Problem with enabling dmalloc. Please check config.log for details.)
|
||||
])
|
||||
fi
|
||||
|
||||
# temporary until streams are better integrated
|
||||
@@ -623,6 +629,7 @@ if test "$PHP_PHP_STREAMS" = "yes"; then
|
||||
fi
|
||||
|
||||
AC_CHECK_LIB(crypt, crypt, [
|
||||
PHP_ADD_LIBRARY(crypt)
|
||||
PHP_ADD_LIBRARY(crypt, 1)
|
||||
AC_DEFINE(HAVE_CRYPT,1,[ ])
|
||||
])
|
||||
@@ -917,7 +924,7 @@ PHP_GEN_CONFIG_VARS
|
||||
$php_shtool mkdir -p pear/scripts
|
||||
ALL_OUTPUT_FILES="php4.spec Zend/Makefile main/build-defs.h \
|
||||
pear/scripts/pear pear/scripts/phpize pear/scripts/php-config \
|
||||
pear/scripts/pearize TSRM/Makefile $PHP_OUTPUT_FILES"
|
||||
pear/scripts/pearize pear/scripts/phptar TSRM/Makefile $PHP_OUTPUT_FILES"
|
||||
|
||||
AC_OUTPUT($ALL_OUTPUT_FILES, [], [
|
||||
|
||||
|
||||
+21
-9
@@ -437,7 +437,7 @@ PHP_INI_ENTRY("com.typelib_file", "", PHP_INI_SYSTEM, OnTypelibFileChange)
|
||||
PHP_INI_END()
|
||||
|
||||
|
||||
/* {{{ proto int com_load(string module_name [, string remote_host [, int codepage[, string typelib]]])
|
||||
/* {{{ proto int com_load(string module_name [, string remote_host [, int codepage [, string typelib]]])
|
||||
Loads a COM module */
|
||||
PHP_FUNCTION(com_load)
|
||||
{
|
||||
@@ -511,6 +511,12 @@ PHP_FUNCTION(com_load)
|
||||
/* @todo if (server_name) */
|
||||
|
||||
if (!server_name) {
|
||||
/* @todo shouldn't the bind context be fetched on module startup and kept as a global shared instance ?
|
||||
* all calls to BindToObject would deliver the same instance then (as desired)
|
||||
* IBindCtx::RegisterObjectBound() should be called then after mkparsedisplayname()
|
||||
*
|
||||
* @todo use mkparsedisplaynameex() ?
|
||||
*/
|
||||
if (SUCCEEDED(hr = CreateBindCtx(0, &pBindCtx))) {
|
||||
if (SUCCEEDED(hr = MkParseDisplayName(pBindCtx, ProgID, &ulEaten, &pMoniker))) {
|
||||
hr = pMoniker->lpVtbl->BindToObject(pMoniker, pBindCtx, NULL, &IID_IDispatch, (LPVOID *) &C_DISPATCH(obj));
|
||||
@@ -548,7 +554,7 @@ PHP_FUNCTION(com_load)
|
||||
pResults.pIID = &IID_IDispatch;
|
||||
pResults.pItf = NULL;
|
||||
pResults.hr = S_OK;
|
||||
hr=CoCreateInstanceEx(&clsid, NULL, CLSCTX_SERVER, &server_info, 1, &pResults);
|
||||
hr=CoCreateInstanceEx(&clsid, NULL, CLSCTX_REMOTE_SERVER, &server_info, 1, &pResults);
|
||||
if (SUCCEEDED(hr)) {
|
||||
hr = pResults.hr;
|
||||
C_DISPATCH(obj) = (IDispatch *) pResults.pItf;
|
||||
@@ -742,7 +748,11 @@ int do_COM_invoke(comval *obj, pval *function_name, VARIANT *var_result, pval **
|
||||
|
||||
efree(funcname);
|
||||
for (current_arg=0;current_arg<arg_count;current_arg++) {
|
||||
VariantClear(&variant_args[current_arg]);
|
||||
/* don't release IDispatch pointers as they are used afterwards */
|
||||
if (V_VT(&variant_args[current_arg]) != VT_DISPATCH) {
|
||||
/* @todo review this: what happens to an array of IDispatchs or a VARIANT->IDispatch */
|
||||
VariantClear(&variant_args[current_arg]);
|
||||
}
|
||||
}
|
||||
efree(variant_args);
|
||||
|
||||
@@ -804,9 +814,8 @@ PHP_FUNCTION(com_invoke)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
php_variant_to_pval(var_result, return_value, codepage TSRMLS_CC);
|
||||
RETVAL_VARIANT(var_result);
|
||||
|
||||
FREE_VARIANT(var_result);
|
||||
efree(arguments);
|
||||
}
|
||||
/* }}} */
|
||||
@@ -1049,9 +1058,7 @@ PHP_FUNCTION(com_propget)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
php_variant_to_pval(var_result, return_value, codepage TSRMLS_CC);
|
||||
|
||||
FREE_VARIANT(var_result);
|
||||
RETVAL_VARIANT(var_result);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1082,7 +1089,8 @@ PHP_FUNCTION(com_propput)
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ proto bool com_load_typelib(string typelib_name[, int case_insensitiv]) */
|
||||
/* {{{ proto bool com_load_typelib(string typelib_name [, int case_insensitiv])
|
||||
Loads a Typelib */
|
||||
PHP_FUNCTION(com_load_typelib)
|
||||
{
|
||||
pval *arg_typelib, *arg_cis;
|
||||
@@ -1200,6 +1208,10 @@ PHPAPI pval php_COM_get_property_handler(zend_property_reference *property_refer
|
||||
pval_destructor(&overloaded_property->element);
|
||||
}
|
||||
|
||||
if (obj_prop != NULL) {
|
||||
RETVAL_COM(obj);
|
||||
}
|
||||
|
||||
FREE_VARIANT(var_result);
|
||||
|
||||
return return_value;
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
1) Multi-dimenstional array support
|
||||
2) IErrorInfo
|
||||
3) WithEvents
|
||||
4) Documentation (internal and user) and howtos
|
||||
5) IEnumVariant::All() which would be like IEnumVariant::Next(IDispatch::Count)
|
||||
6) Look for memory leaks and AdRef/Release problems - I KNOW there are some...
|
||||
7) Test component (goes with the docs)
|
||||
8) Test suite (Needs test component)
|
||||
9) reduce the need for VARIANT()
|
||||
10) lets try if we are able to call non IDispatch - only Typelib components
|
||||
11) IEnumVariant::Next() without parameter should only return an object, not an array with one element
|
||||
|
||||
|
||||
these seem to be done:
|
||||
|
||||
2) 6) 11)
|
||||
+4
-4
@@ -185,10 +185,10 @@ static pval php_VARIANT_get_property_handler(zend_property_reference *property_r
|
||||
{
|
||||
zend_overloaded_element *overloaded_property;
|
||||
int type;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
pval result, **var_handle, *object = property_reference->object;
|
||||
VARIANT *var_arg;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
|
||||
/* fetch the VARIANT structure */
|
||||
zend_hash_index_find(Z_OBJPROP_P(object), 0, (void **) &var_handle);
|
||||
@@ -230,10 +230,10 @@ static int php_VARIANT_set_property_handler(zend_property_reference *property_re
|
||||
{
|
||||
zend_overloaded_element *overloaded_property;
|
||||
int type;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
pval **var_handle, *object = property_reference->object;
|
||||
VARIANT *var_arg;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
|
||||
/* fetch the VARIANT structure */
|
||||
zend_hash_index_find(Z_OBJPROP_P(object), 0, (void **) &var_handle);
|
||||
|
||||
+22
-17
@@ -86,7 +86,7 @@ PHPAPI void php_pval_to_variant(pval *pval_arg, VARIANT *var_arg, int codepage T
|
||||
}
|
||||
|
||||
if (pval_arg->is_ref) { /* deprecated, implemented for downwards compatiblity */
|
||||
type |= VT_BYREF;
|
||||
// type |= VT_BYREF;
|
||||
}
|
||||
|
||||
pval_to_variant_ex(pval_arg, var_arg, type, codepage TSRMLS_CC);
|
||||
@@ -452,11 +452,11 @@ PHPAPI int php_variant_to_pval(VARIANT *var_arg, pval *pval_arg, int codepage TS
|
||||
ZVAL_NULL(pval_arg);
|
||||
return FAILURE;
|
||||
}
|
||||
SafeArrayLock( array);
|
||||
SafeArrayLock(array);
|
||||
|
||||
/* This call has failed for everything I have tried */
|
||||
/* But best leave it to be on the safe side */
|
||||
if (FAILED(SafeArrayGetVartype(array, &vartype))) {
|
||||
if (FAILED(SafeArrayGetVartype(array, &vartype)) || (vartype == VT_EMPTY)) {
|
||||
/* Fall back to what we do know */
|
||||
/* Mask off the array bit and assume */
|
||||
/* what is left is the type of the array */
|
||||
@@ -519,9 +519,9 @@ PHPAPI int php_variant_to_pval(VARIANT *var_arg, pval *pval_arg, int codepage TS
|
||||
|
||||
case VT_UI1:
|
||||
if (V_ISBYREF(var_arg)) {
|
||||
ZVAL_LONG(pval_arg, (long)*V_UI4REF(var_arg));
|
||||
ZVAL_LONG(pval_arg, (long)*V_UI1REF(var_arg));
|
||||
} else {
|
||||
ZVAL_LONG(pval_arg, (long)V_UI4(var_arg));
|
||||
ZVAL_LONG(pval_arg, (long)V_UI1(var_arg));
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -614,27 +614,32 @@ PHPAPI int php_variant_to_pval(VARIANT *var_arg, pval *pval_arg, int codepage TS
|
||||
break;
|
||||
|
||||
case VT_DATE: {
|
||||
BOOL success;
|
||||
SYSTEMTIME wintime;
|
||||
struct tm phptime;
|
||||
|
||||
if (V_ISBYREF(var_arg)) {
|
||||
VariantTimeToSystemTime(*V_DATEREF(var_arg), &wintime);
|
||||
success = VariantTimeToSystemTime(*V_DATEREF(var_arg), &wintime);
|
||||
} else {
|
||||
VariantTimeToSystemTime(V_DATE(var_arg), &wintime);
|
||||
success = VariantTimeToSystemTime(V_DATE(var_arg), &wintime);
|
||||
}
|
||||
|
||||
memset(&phptime, 0, sizeof(phptime));
|
||||
if (success) {
|
||||
memset(&phptime, 0, sizeof(phptime));
|
||||
|
||||
phptime.tm_year = wintime.wYear - 1900;
|
||||
phptime.tm_mon = wintime.wMonth - 1;
|
||||
phptime.tm_mday = wintime.wDay;
|
||||
phptime.tm_hour = wintime.wHour;
|
||||
phptime.tm_min = wintime.wMinute;
|
||||
phptime.tm_sec = wintime.wSecond;
|
||||
phptime.tm_isdst = -1;
|
||||
phptime.tm_year = wintime.wYear - 1900;
|
||||
phptime.tm_mon = wintime.wMonth - 1;
|
||||
phptime.tm_mday = wintime.wDay;
|
||||
phptime.tm_hour = wintime.wHour;
|
||||
phptime.tm_min = wintime.wMinute;
|
||||
phptime.tm_sec = wintime.wSecond;
|
||||
phptime.tm_isdst = -1;
|
||||
|
||||
tzset();
|
||||
ZVAL_LONG(pval_arg, mktime(&phptime));
|
||||
tzset();
|
||||
ZVAL_LONG(pval_arg, mktime(&phptime));
|
||||
} else {
|
||||
ret = FAILURE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
+17
-2
@@ -3,15 +3,30 @@
|
||||
|
||||
#if PHP_WIN32
|
||||
|
||||
#define ALLOC_VARIANT(v) (v) = (VARIANT *) emalloc(sizeof(VARIANT)); \
|
||||
#define ALLOC_VARIANT(v) (v) = (VARIANT *) emalloc(sizeof(VARIANT)); \
|
||||
VariantInit(v);
|
||||
|
||||
#define FREE_VARIANT(v) VariantClear(v); \
|
||||
#define FREE_VARIANT(v) VariantClear(v); \
|
||||
efree(v);
|
||||
|
||||
|
||||
#define IS_VARIANT php_VARIANT_get_le_variant()
|
||||
|
||||
#define ZVAL_VARIANT(z, v) if (V_VT(v) == VT_DISPATCH) { \
|
||||
comval *obj; \
|
||||
ALLOC_COM(obj); \
|
||||
php_COM_set(obj, &V_DISPATCH(v), TRUE TSRMLS_CC); \
|
||||
ZVAL_LONG((z), zend_list_insert(obj, IS_COM)); \
|
||||
} else { \
|
||||
php_variant_to_pval((v), (z), codepage TSRMLS_CC); \
|
||||
FREE_VARIANT(v); \
|
||||
}
|
||||
|
||||
#define RETVAL_VARIANT(v) ZVAL_VARIANT(return_value, (v));
|
||||
#define RETURN_VARIANT(v) RETVAL_VARIANT(v) \
|
||||
return;
|
||||
|
||||
|
||||
#endif /* PHP_WIN32 */
|
||||
|
||||
#endif /* VARIANT_H */
|
||||
+3
-3
@@ -321,7 +321,7 @@ PHP_FUNCTION(dbase_add_record)
|
||||
Replaces a record to the database */
|
||||
PHP_FUNCTION(dbase_replace_record)
|
||||
{
|
||||
pval *dbh_id, *fields, *field, *recnum;
|
||||
pval *dbh_id, *fields, **field, *recnum;
|
||||
dbhead_t *dbh;
|
||||
int dbh_type;
|
||||
|
||||
@@ -368,8 +368,8 @@ PHP_FUNCTION(dbase_replace_record)
|
||||
efree(cp);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
convert_to_string(field);
|
||||
sprintf(t_cp, cur_f->db_format, field->value.str.val);
|
||||
convert_to_string_ex(field);
|
||||
sprintf(t_cp, cur_f->db_format, Z_STRVAL_PP(field));
|
||||
t_cp += cur_f->db_flen;
|
||||
}
|
||||
|
||||
|
||||
+140
-94
@@ -18,9 +18,15 @@
|
||||
*/
|
||||
|
||||
#include "php.h"
|
||||
#include "ext/standard/info.h"
|
||||
#include "php_ini.h"
|
||||
#include "php_dbplus.h"
|
||||
|
||||
#include <saccess.h>
|
||||
#include <relation.h>
|
||||
#include <dblight.h>
|
||||
|
||||
|
||||
/* If you declare any globals in php_dbplus.h uncomment this:
|
||||
ZEND_DECLARE_MODULE_GLOBALS(dbplus)
|
||||
*/
|
||||
@@ -38,17 +44,17 @@ int le_dbplus_tupel;
|
||||
|
||||
void dbplus_destruct_relation(zend_rsrc_list_entry *rsrc TSRMLS_DC)
|
||||
{
|
||||
relf *conn = (relf *)(rsrc->ptr);
|
||||
relf *conn = (relf *)(rsrc->ptr);
|
||||
|
||||
cdb_close(conn);
|
||||
cdb_close(conn);
|
||||
}
|
||||
|
||||
|
||||
void dbplus_destruct_tupel(zend_rsrc_list_entry *rsrc TSRMLS_DC)
|
||||
{
|
||||
tuple *t = (tuple *)(rsrc->ptr);
|
||||
tuple *t = (tuple *)(rsrc->ptr);
|
||||
|
||||
efree(t);
|
||||
efree(t);
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
@@ -58,54 +64,53 @@ void dbplus_destruct_tupel(zend_rsrc_list_entry *rsrc TSRMLS_DC)
|
||||
/* Every user visible function must have an entry in dbplus_functions[].
|
||||
*/
|
||||
function_entry dbplus_functions[] = {
|
||||
PHP_FE(dbplus_add, NULL)
|
||||
PHP_FE(dbplus_aql, NULL)
|
||||
PHP_FE(dbplus_change, NULL)
|
||||
PHP_FE(dbplus_chdir, NULL)
|
||||
PHP_FE(dbplus_close, NULL)
|
||||
PHP_FE(dbplus_curr, NULL)
|
||||
PHP_FE(dbplus_errno, NULL)
|
||||
PHP_FE(dbplus_errcode, NULL)
|
||||
PHP_FE(dbplus_find, NULL)
|
||||
PHP_FE(dbplus_first, NULL)
|
||||
PHP_FE(dbplus_flush, NULL)
|
||||
PHP_FE(dbplus_freealllocks, NULL)
|
||||
PHP_FE(dbplus_freelock, NULL)
|
||||
PHP_FE(dbplus_freerlocks, NULL)
|
||||
PHP_FE(dbplus_getlock, NULL)
|
||||
PHP_FE(dbplus_getunique, NULL)
|
||||
PHP_FE(dbplus_info, NULL)
|
||||
PHP_FE(dbplus_last, NULL)
|
||||
PHP_FE(dbplus_next, NULL)
|
||||
PHP_FE(dbplus_open, NULL)
|
||||
PHP_FE(dbplus_prev, NULL)
|
||||
PHP_FE(dbplus_rchperm, NULL)
|
||||
PHP_FE(dbplus_rcreate, NULL)
|
||||
PHP_FE(dbplus_rcrtexact, NULL)
|
||||
PHP_FE(dbplus_rcrtlike, NULL)
|
||||
PHP_FE(dbplus_resolve, NULL)
|
||||
PHP_FE(dbplus_restorepos, NULL)
|
||||
PHP_FE(dbplus_rkeys, NULL)
|
||||
PHP_FE(dbplus_ropen, NULL)
|
||||
PHP_FE(dbplus_rquery, NULL)
|
||||
PHP_FE(dbplus_rrename, NULL)
|
||||
PHP_FE(dbplus_rsecindex, NULL)
|
||||
PHP_FE(dbplus_runlink, NULL)
|
||||
PHP_FE(dbplus_rzap, NULL)
|
||||
PHP_FE(dbplus_savepos, NULL)
|
||||
PHP_FE(dbplus_setindex, NULL)
|
||||
PHP_FE(dbplus_setindexbynumber, NULL)
|
||||
PHP_FE(dbplus_sql, NULL)
|
||||
PHP_FE(dbplus_tcl, NULL)
|
||||
PHP_FE(dbplus_tremove, NULL)
|
||||
PHP_FE(dbplus_undo, NULL)
|
||||
PHP_FE(dbplus_undoprepare, NULL)
|
||||
PHP_FE(dbplus_unlockrel, NULL)
|
||||
PHP_FE(dbplus_unselect, NULL)
|
||||
PHP_FE(dbplus_update, NULL)
|
||||
PHP_FE(dbplus_xlockrel, NULL)
|
||||
PHP_FE(dbplus_xunlockrel, NULL)
|
||||
{NULL, NULL, NULL} /* Must be the last line in dbplus_functions[] */
|
||||
PHP_FE(dbplus_add, NULL)
|
||||
PHP_FE(dbplus_aql, NULL)
|
||||
PHP_FE(dbplus_chdir, NULL)
|
||||
PHP_FE(dbplus_close, NULL)
|
||||
PHP_FE(dbplus_curr, NULL)
|
||||
PHP_FE(dbplus_errno, NULL)
|
||||
PHP_FE(dbplus_errcode, NULL)
|
||||
PHP_FE(dbplus_find, NULL)
|
||||
PHP_FE(dbplus_first, NULL)
|
||||
PHP_FE(dbplus_flush, NULL)
|
||||
PHP_FE(dbplus_freealllocks, NULL)
|
||||
PHP_FE(dbplus_freelock, NULL)
|
||||
PHP_FE(dbplus_freerlocks, NULL)
|
||||
PHP_FE(dbplus_getlock, NULL)
|
||||
PHP_FE(dbplus_getunique, NULL)
|
||||
PHP_FE(dbplus_info, NULL)
|
||||
PHP_FE(dbplus_last, NULL)
|
||||
PHP_FE(dbplus_next, NULL)
|
||||
PHP_FE(dbplus_open, NULL)
|
||||
PHP_FE(dbplus_prev, NULL)
|
||||
PHP_FE(dbplus_rchperm, NULL)
|
||||
PHP_FE(dbplus_rcreate, NULL)
|
||||
PHP_FE(dbplus_rcrtexact, NULL)
|
||||
PHP_FE(dbplus_rcrtlike, NULL)
|
||||
PHP_FE(dbplus_resolve, NULL)
|
||||
PHP_FE(dbplus_restorepos, NULL)
|
||||
PHP_FE(dbplus_rkeys, NULL)
|
||||
PHP_FE(dbplus_ropen, NULL)
|
||||
PHP_FE(dbplus_rquery, NULL)
|
||||
PHP_FE(dbplus_rrename, NULL)
|
||||
PHP_FE(dbplus_rsecindex, NULL)
|
||||
PHP_FE(dbplus_runlink, NULL)
|
||||
PHP_FE(dbplus_rzap, NULL)
|
||||
PHP_FE(dbplus_savepos, NULL)
|
||||
PHP_FE(dbplus_setindex, NULL)
|
||||
PHP_FE(dbplus_setindexbynumber, NULL)
|
||||
PHP_FE(dbplus_sql, NULL)
|
||||
PHP_FE(dbplus_tcl, NULL)
|
||||
PHP_FE(dbplus_tremove, NULL)
|
||||
PHP_FE(dbplus_undo, NULL)
|
||||
PHP_FE(dbplus_undoprepare, NULL)
|
||||
PHP_FE(dbplus_unlockrel, NULL)
|
||||
PHP_FE(dbplus_unselect, NULL)
|
||||
PHP_FE(dbplus_update, NULL)
|
||||
PHP_FE(dbplus_xlockrel, NULL)
|
||||
PHP_FE(dbplus_xunlockrel, NULL)
|
||||
{NULL, NULL, NULL} /* Must be the last line in dbplus_functions[] */
|
||||
};
|
||||
|
||||
/* }}} */
|
||||
@@ -113,14 +118,14 @@ function_entry dbplus_functions[] = {
|
||||
/* {{{ module entry */
|
||||
|
||||
zend_module_entry dbplus_module_entry = {
|
||||
"dbplus",
|
||||
dbplus_functions,
|
||||
PHP_MINIT(dbplus),
|
||||
PHP_MSHUTDOWN(dbplus),
|
||||
PHP_RINIT(dbplus), /* Replace with NULL if there's nothing to do at request start */
|
||||
PHP_RSHUTDOWN(dbplus), /* Replace with NULL if there's nothing to do at request end */
|
||||
PHP_MINFO(dbplus),
|
||||
STANDARD_MODULE_PROPERTIES
|
||||
"dbplus",
|
||||
dbplus_functions,
|
||||
PHP_MINIT(dbplus),
|
||||
PHP_MSHUTDOWN(dbplus),
|
||||
PHP_RINIT(dbplus), /* Replace with NULL if there's nothing to do at request start */
|
||||
PHP_RSHUTDOWN(dbplus), /* Replace with NULL if there's nothing to do at request end */
|
||||
PHP_MINFO(dbplus),
|
||||
STANDARD_MODULE_PROPERTIES
|
||||
};
|
||||
|
||||
/* }}} */
|
||||
@@ -138,11 +143,52 @@ PHP_INI_END()
|
||||
|
||||
PHP_MINIT_FUNCTION(dbplus)
|
||||
{
|
||||
/* resource id for cdb connections */
|
||||
le_dbplus_relation = zend_register_list_destructors_ex(dbplus_destruct_relation, NULL, "dbplus_relation", module_number);
|
||||
le_dbplus_tupel = zend_register_list_destructors_ex(dbplus_destruct_tupel , NULL, "dbplus_tuple" , module_number);
|
||||
/* resource id for cdb connections */
|
||||
le_dbplus_relation = zend_register_list_destructors_ex(dbplus_destruct_relation, NULL, "dbplus_relation", module_number);
|
||||
le_dbplus_tupel = zend_register_list_destructors_ex(dbplus_destruct_tupel , NULL, "dbplus_tuple" , module_number);
|
||||
|
||||
return SUCCESS;
|
||||
/* constants for DBPLUS error codes */
|
||||
REGISTER_LONG_CONSTANT("DBPLUS_ERR_NOERR", ERR_NOERR, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("DBPLUS_ERR_DUPLICATE", ERR_DUPLICATE, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("DBPLUS_ERR_EOSCAN", ERR_EOSCAN, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("DBPLUS_ERR_EMPTY", ERR_EMPTY, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("DBPLUS_ERR_CLOSE", ERR_CLOSE, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("DBPLUS_ERR_WLOCKED", ERR_WLOCKED, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("DBPLUS_ERR_LOCKED", ERR_LOCKED, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("DBPLUS_ERR_NOLOCK", ERR_NOLOCK, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("DBPLUS_ERR_READ", ERR_READ, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("DBPLUS_ERR_WRITE", ERR_WRITE, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("DBPLUS_ERR_CREATE", ERR_CREATE, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("DBPLUS_ERR_LSEEK", ERR_LSEEK, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("DBPLUS_ERR_LENGTH", ERR_LENGTH, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("DBPLUS_ERR_OPEN", ERR_OPEN, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("DBPLUS_ERR_WOPEN", ERR_WOPEN, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("DBPLUS_ERR_MAGIC", ERR_MAGIC, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("DBPLUS_ERR_VERSION", ERR_VERSION, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("DBPLUS_ERR_PGSIZE", ERR_PGSIZE, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("DBPLUS_ERR_CRC", ERR_CRC, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("DBPLUS_ERR_PIPE", ERR_PIPE, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("DBPLUS_ERR_NIDX", ERR_NIDX, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("DBPLUS_ERR_MALLOC", ERR_MALLOC, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("DBPLUS_ERR_NUSERS", ERR_NUSERS, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("DBPLUS_ERR_PREEXIT", ERR_PREEXIT, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("DBPLUS_ERR_ONTRAP", ERR_ONTRAP, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("DBPLUS_ERR_PREPROC", ERR_PREPROC, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("DBPLUS_ERR_DBPARSE", ERR_DBPARSE, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("DBPLUS_ERR_DBRUNERR", ERR_DBRUNERR, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("DBPLUS_ERR_DBPREEXIT", ERR_DBPREEXIT, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("DBPLUS_ERR_WAIT", ERR_WAIT, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("DBPLUS_ERR_CORRUPT_TUPLE", ERR_CORRUPT_TUPLE, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("DBPLUS_ERR_WARNING0", ERR_WARNING0, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("DBPLUS_ERR_PANIC", ERR_PANIC, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("DBPLUS_ERR_FIFO", ERR_FIFO, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("DBPLUS_ERR_PERM", ERR_PERM, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("DBPLUS_ERR_TCL", ERR_TCL, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("DBPLUS_ERR_RESTRICTED", ERR_RESTRICTED, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("DBPLUS_ERR_USER", ERR_USER, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("DBPLUS_ERR_UNKNOWN", ERR_UNKNOWN, CONST_CS | CONST_PERSISTENT);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
@@ -151,7 +197,7 @@ PHP_MINIT_FUNCTION(dbplus)
|
||||
|
||||
PHP_MSHUTDOWN_FUNCTION(dbplus)
|
||||
{
|
||||
return SUCCESS;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
@@ -161,7 +207,7 @@ PHP_MSHUTDOWN_FUNCTION(dbplus)
|
||||
/* Remove if there's nothing to do at request start */
|
||||
PHP_RINIT_FUNCTION(dbplus)
|
||||
{
|
||||
return SUCCESS;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
@@ -171,7 +217,7 @@ PHP_RINIT_FUNCTION(dbplus)
|
||||
/* Remove if there's nothing to do at request end */
|
||||
PHP_RSHUTDOWN_FUNCTION(dbplus)
|
||||
{
|
||||
return SUCCESS;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
@@ -180,13 +226,13 @@ PHP_RSHUTDOWN_FUNCTION(dbplus)
|
||||
|
||||
PHP_MINFO_FUNCTION(dbplus)
|
||||
{
|
||||
php_info_print_table_start();
|
||||
php_info_print_table_header(2, "dbplus support", "enabled");
|
||||
php_info_print_table_end();
|
||||
php_info_print_table_start();
|
||||
php_info_print_table_header(2, "dbplus support", "enabled");
|
||||
php_info_print_table_end();
|
||||
|
||||
/* Remove comments if you have entries in php.ini
|
||||
DISPLAY_INI_ENTRIES();
|
||||
*/
|
||||
/* Remove comments if you have entries in php.ini
|
||||
DISPLAY_INI_ENTRIES();
|
||||
*/
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
@@ -197,24 +243,24 @@ PHP_MINFO_FUNCTION(dbplus)
|
||||
*/
|
||||
PHP_FUNCTION(dbplus_open)
|
||||
{
|
||||
relf *conn;
|
||||
relf *conn;
|
||||
|
||||
zval **name, **writing, **searchpath;
|
||||
if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &name, &writing, &searchpath) == FAILURE){
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
zval **name, **writing, **searchpath;
|
||||
if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &name, &writing, &searchpath) == FAILURE){
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
convert_to_string_ex(name);
|
||||
convert_to_long_ex(writing);
|
||||
convert_to_long_ex(searchpath);
|
||||
convert_to_string_ex(name);
|
||||
convert_to_long_ex(writing);
|
||||
convert_to_long_ex(searchpath);
|
||||
|
||||
conn = cdb_open((*name)->value.str.val, (*writing)->value.lval, (*searchpath)->value.lval);
|
||||
if(conn == NULL) {
|
||||
/* TODO error handling */
|
||||
RETURN_FALSE;
|
||||
}
|
||||
conn = cdb_open(Z_STRVAL_PP(name), Z_LVAL_PP(writing), Z_LVAL_PP(searchpath));
|
||||
if(conn == NULL) {
|
||||
/* TODO error handling */
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
ZEND_REGISTER_RESOURCE(return_value, conn, le_dbplus);
|
||||
ZEND_REGISTER_RESOURCE(return_value, conn, le_dbplus);
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
@@ -223,16 +269,16 @@ PHP_FUNCTION(dbplus_open)
|
||||
*/
|
||||
PHP_FUNCTION(dbplus_close)
|
||||
{
|
||||
zval **conn;
|
||||
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &conn) == FAILURE){
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
zval **conn;
|
||||
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &conn) == FAILURE){
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
convert_to_long_ex(conn);
|
||||
convert_to_long_ex(conn);
|
||||
|
||||
/* TODO resource type check */
|
||||
/* TODO resource type check */
|
||||
|
||||
zend_list_delete((*conn)->value.lval);
|
||||
zend_list_delete(Z_LVAL_PP(conn));
|
||||
}
|
||||
/* }}} */
|
||||
#endif
|
||||
|
||||
@@ -1,141 +0,0 @@
|
||||
/*
|
||||
+----------------------------------------------------------------------+
|
||||
| PHP version 4.0 |
|
||||
+----------------------------------------------------------------------+
|
||||
| Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group |
|
||||
+----------------------------------------------------------------------+
|
||||
| This source file is subject to version 2.02 of the PHP license, |
|
||||
| that is bundled with this package in the file LICENSE, and is |
|
||||
| available at through the world-wide-web at |
|
||||
| http://www.php.net/license/2_02.txt. |
|
||||
| If you did not receive a copy of the PHP license and are unable to |
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Hartmut Holzgraefe <hartmut@six.de> |
|
||||
| |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#include "php.h"
|
||||
#include "php_ini.h"
|
||||
#include "php_dbplus.h"
|
||||
|
||||
|
||||
/* {{{ proto int dbplus_change(int handle, string domain)
|
||||
*/
|
||||
PHP_FUNCTION(dbplus_change)
|
||||
{
|
||||
zval **handle, **domain;
|
||||
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &handle, &domain) == FAILURE){
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
convert_to_long_ex(handle);
|
||||
convert_to_string_ex(domain);
|
||||
|
||||
|
||||
php_error(E_WARNING, "dbplus_change: not yet implemented");
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* {{{ proto int dbplus_rcreate(string name, string domlist, int flag)
|
||||
*/
|
||||
PHP_FUNCTION(dbplus_rcreate)
|
||||
{
|
||||
zval **name, **domlist, **flag;
|
||||
if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &name, &domlist, &flag) == FAILURE){
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
convert_to_string_ex(name);
|
||||
convert_to_string_ex(domlist);
|
||||
convert_to_long_ex(flag);
|
||||
|
||||
|
||||
php_error(E_WARNING, "dbplus_rcreate: not yet implemented");
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto int dbplus_rcrtexact(string name, int handle, int flag)
|
||||
*/
|
||||
PHP_FUNCTION(dbplus_rcrtexact)
|
||||
{
|
||||
zval **name, **handle, **flag;
|
||||
if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &name, &handle, &flag) == FAILURE){
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
convert_to_string_ex(name);
|
||||
convert_to_long_ex(handle);
|
||||
convert_to_long_ex(flag);
|
||||
|
||||
|
||||
php_error(E_WARNING, "dbplus_rcrtexact: not yet implemented");
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto int dbplus_rcrtlike(string name, int handle, int flag)
|
||||
*/
|
||||
PHP_FUNCTION(dbplus_rcrtlike)
|
||||
{
|
||||
zval **name, **handle, **flag;
|
||||
if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &name, &handle, &flag) == FAILURE){
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
convert_to_string_ex(name);
|
||||
convert_to_long_ex(handle);
|
||||
convert_to_long_ex(flag);
|
||||
|
||||
|
||||
php_error(E_WARNING, "dbplus_rcrtlike: not yet implemented");
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto int dbplus_resolve(string name, string vname)
|
||||
*/
|
||||
PHP_FUNCTION(dbplus_resolve)
|
||||
{
|
||||
zval **name, **vname;
|
||||
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &name, &vname) == FAILURE){
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
convert_to_string_ex(name);
|
||||
convert_to_string_ex(vname);
|
||||
|
||||
|
||||
php_error(E_WARNING, "dbplus_resolve: not yet implemented");
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto int dbplus_tcl(int sid, string script)
|
||||
*/
|
||||
PHP_FUNCTION(dbplus_tcl)
|
||||
{
|
||||
zval **sid, **script;
|
||||
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &sid, &script) == FAILURE){
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
convert_to_long_ex(sid);
|
||||
convert_to_string_ex(script);
|
||||
|
||||
|
||||
php_error(E_WARNING, "dbplus_tcl: not yet implemented");
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
*/
|
||||
+1093
-809
File diff suppressed because it is too large.
Load diff
@@ -20,9 +20,6 @@
|
||||
#ifndef PHP_DBPLUS_H
|
||||
#define PHP_DBPLUS_H
|
||||
|
||||
#include <saccess.h>
|
||||
#include <relation.h>
|
||||
#include <dblight.h>
|
||||
|
||||
extern zend_module_entry dbplus_module_entry;
|
||||
#define phpext_dbplus_ptr &dbplus_module_entry
|
||||
@@ -41,7 +38,6 @@ PHP_MINFO_FUNCTION(dbplus);
|
||||
|
||||
PHP_FUNCTION(dbplus_add);
|
||||
PHP_FUNCTION(dbplus_aql);
|
||||
PHP_FUNCTION(dbplus_change);
|
||||
PHP_FUNCTION(dbplus_chdir);
|
||||
PHP_FUNCTION(dbplus_close);
|
||||
PHP_FUNCTION(dbplus_curr);
|
||||
@@ -89,11 +85,11 @@ PHP_FUNCTION(dbplus_xunlockrel);
|
||||
|
||||
|
||||
/*
|
||||
Declare any global variables you may need between the BEGIN
|
||||
and END macros here:
|
||||
Declare any global variables you may need between the BEGIN
|
||||
and END macros here:
|
||||
|
||||
ZEND_BEGIN_MODULE_GLOBALS(dbplus)
|
||||
int global_variable;
|
||||
int global_variable;
|
||||
ZEND_END_MODULE_GLOBALS(dbplus)
|
||||
*/
|
||||
|
||||
@@ -118,7 +114,7 @@ void dbplus_destruct_relation(zend_rsrc_list_entry *rsrc TSRMLS_DC);
|
||||
void dbplus_destruct_tupel(zend_rsrc_list_entry *rsrc TSRMLS_DC);
|
||||
|
||||
|
||||
#endif /* PHP_DBPLUS_H */
|
||||
#endif /* PHP_DBPLUS_H */
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@@ -7,19 +7,19 @@ AC_DEFUN(PHP_DOM_CHECK_VERSION,[
|
||||
AC_MSG_CHECKING(for libxml version)
|
||||
AC_EGREP_CPP(yes,[
|
||||
#include <libxml/xmlversion.h>
|
||||
#if LIBXML_VERSION >= 20207
|
||||
#if LIBXML_VERSION >= 20402
|
||||
yes
|
||||
#endif
|
||||
],[
|
||||
AC_MSG_RESULT(>= 2.2.7)
|
||||
AC_MSG_RESULT(>= 2.4.2)
|
||||
],[
|
||||
AC_MSG_ERROR(libxml version 2.2.7 or greater required.)
|
||||
AC_MSG_ERROR(libxml version 2.4.2 or greater required.)
|
||||
])
|
||||
CPPFLAGS=$old_CPPFLAGS
|
||||
])
|
||||
|
||||
PHP_ARG_WITH(dom, for DOM support,
|
||||
[ --with-dom[=DIR] Include DOM support (requires libxml >= 2.2.7).
|
||||
[ --with-dom[=DIR] Include DOM support (requires libxml >= 2.4.2).
|
||||
DIR is the libxml install directory,
|
||||
defaults to /usr.])
|
||||
|
||||
@@ -35,12 +35,12 @@ if test "$PHP_DOM" != "no"; then
|
||||
|
||||
if test -z "$DOMXML_DIR"; then
|
||||
AC_MSG_RESULT(not found)
|
||||
AC_MSG_ERROR(Please reinstall the libxml >= 2.2.7 distribution)
|
||||
AC_MSG_ERROR(Please reinstall the libxml >= 2.4.2 distribution)
|
||||
fi
|
||||
|
||||
PHP_DOM_CHECK_VERSION
|
||||
|
||||
if test -f $DOMXML_DIR/lib/libxml2.a -o -f $DOMXML_DIR/lib/libxml2.s? ; then
|
||||
if test -f $DOMXML_DIR/lib/libxml2.a -o -f $DOMXML_DIR/lib/libxml2.$SHLIB_SUFFIX_NAME ; then
|
||||
DOM_LIBNAME=xml2
|
||||
else
|
||||
DOM_LIBNAME=xml
|
||||
|
||||
+36
-12
@@ -18,7 +18,6 @@
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
@@ -191,6 +190,7 @@ static zend_function_entry php_domxmlnode_class_functions[] = {
|
||||
|
||||
static zend_function_entry php_domxmlelement_class_functions[] = {
|
||||
PHP_FALIAS(domelement, domxml_element, NULL)
|
||||
PHP_FALIAS(name, domxml_elem_tagname, NULL)
|
||||
PHP_FALIAS(tagname, domxml_elem_tagname, NULL)
|
||||
PHP_FALIAS(get_attribute, domxml_elem_get_attribute, NULL)
|
||||
PHP_FALIAS(set_attribute, domxml_elem_set_attribute, NULL)
|
||||
@@ -392,16 +392,19 @@ void *php_xpath_get_object(zval *wrapper, int rsrc_type1, int rsrc_type2)
|
||||
TSRMLS_FETCH();
|
||||
|
||||
if (Z_TYPE_P(wrapper) != IS_OBJECT) {
|
||||
php_error(E_ERROR, "Wrapper is not an object");
|
||||
php_error(E_WARNING, "Wrapper is not an object");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (zend_hash_index_find(Z_OBJPROP_P(wrapper), 0, (void **) &handle) == FAILURE) {
|
||||
php_error(E_ERROR, "Underlying object missing");
|
||||
php_error(E_WARNING, "Underlying object missing");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
obj = zend_list_find(Z_LVAL_PP(handle), &type);
|
||||
if (!obj || ((type != rsrc_type1) && (type != rsrc_type2))) {
|
||||
php_error(E_ERROR, "Underlying object missing or of invalid type");
|
||||
php_error(E_WARNING, "Underlying object missing or of invalid type");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return obj;
|
||||
@@ -492,17 +495,20 @@ void *php_xpath_get_context(zval *wrapper, int rsrc_type1, int rsrc_type2 TSRMLS
|
||||
int type;
|
||||
|
||||
if (Z_TYPE_P(wrapper) != IS_OBJECT) {
|
||||
php_error(E_ERROR, "Wrapper is not an object");
|
||||
php_error(E_WARNING, "Wrapper is not an object");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (zend_hash_index_find(Z_OBJPROP_P(wrapper), 0, (void **) &handle) ==
|
||||
FAILURE) {
|
||||
php_error(E_ERROR, "Underlying object missing");
|
||||
php_error(E_WARNING, "Underlying object missing");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
obj = zend_list_find(Z_LVAL_PP(handle), &type);
|
||||
if (!obj || ((type != rsrc_type1) && (type != rsrc_type2))) {
|
||||
php_error(E_ERROR, "Underlying object missing or of invalid type");
|
||||
php_error(E_WARNING, "Underlying object missing or of invalid type");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return obj;
|
||||
@@ -590,18 +596,21 @@ void *php_dom_get_object(zval *wrapper, int rsrc_type1, int rsrc_type2 TSRMLS_DC
|
||||
int type;
|
||||
|
||||
if (Z_TYPE_P(wrapper) != IS_OBJECT) {
|
||||
php_error(E_ERROR, "Wrapper is not an object");
|
||||
php_error(E_WARNING, "Wrapper is not an object");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (zend_hash_index_find(Z_OBJPROP_P(wrapper), 0, (void **) &handle) == FAILURE) {
|
||||
php_error(E_ERROR, "Underlying object missing");
|
||||
php_error(E_WARNING, "Underlying object missing");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
obj = zend_list_find(Z_LVAL_PP(handle), &type);
|
||||
|
||||
/* The following test should be replaced with search in all parents */
|
||||
if (!obj) { /* || ((type != rsrc_type1) && (type != rsrc_type2))) { */
|
||||
php_error(E_ERROR, "Underlying object missing or of invalid type");
|
||||
php_error(E_WARNING, "Underlying object missing or of invalid type");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return obj;
|
||||
@@ -669,8 +678,10 @@ static zval *php_domobject_new(xmlNodePtr obj, int *found TSRMLS_DC)
|
||||
object_init_ex(wrapper, domxmltext_class_entry);
|
||||
rsrc_type = le_domxmltextp;
|
||||
content = xmlNodeGetContent(nodep);
|
||||
if (content)
|
||||
if (content) {
|
||||
add_property_long(wrapper, "type", nodep->type);
|
||||
add_property_stringl(wrapper, "content", (char *) content, strlen(content), 1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -799,6 +810,7 @@ PHP_MINIT_FUNCTION(domxml)
|
||||
Therefore nodes, attributes etc. may not be freed seperately.
|
||||
*/
|
||||
le_domxmlnodep = zend_register_list_destructors_ex(php_free_xml_node, NULL, "domnode", module_number);
|
||||
le_domxmlcommentp = zend_register_list_destructors_ex(php_free_xml_node, NULL, "domnode", module_number);
|
||||
le_domxmlattrp = zend_register_list_destructors_ex(php_free_xml_node, NULL, "domattribute", module_number);
|
||||
le_domxmltextp = zend_register_list_destructors_ex(php_free_xml_node, NULL, "domtext", module_number);
|
||||
le_domxmlelementp = zend_register_list_destructors_ex(php_free_xml_node, NULL, "domelement", module_number);
|
||||
@@ -949,6 +961,9 @@ PHP_FUNCTION(domxml_attr_name)
|
||||
|
||||
id = getThis();
|
||||
attrp = php_dom_get_object(id, le_domxmlattrp, 0 TSRMLS_CC);
|
||||
if (!attrp) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
RETURN_STRING((char *) (attrp->name), 1);
|
||||
}
|
||||
@@ -2254,7 +2269,6 @@ PHP_FUNCTION(xmldocfile)
|
||||
if (!docp) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
ret = zend_list_insert(docp, le_domxmldocp);
|
||||
|
||||
rv = php_domobject_new((xmlNodePtr) docp, &ret TSRMLS_CC);
|
||||
SEPARATE_ZVAL(&rv);
|
||||
@@ -2556,6 +2570,11 @@ static void php_xpathptr_new_context(INTERNAL_FUNCTION_PARAMETERS, int mode)
|
||||
int ret;
|
||||
|
||||
id = getThis();
|
||||
if (!id) {
|
||||
php_error(E_WARNING, "Invalid object");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
docp = php_dom_get_object(id, le_domxmldocp, 0 TSRMLS_CC);
|
||||
|
||||
#if defined(LIBXML_XPTR_ENABLED)
|
||||
@@ -2627,6 +2646,9 @@ static void php_xpathptr_eval(INTERNAL_FUNCTION_PARAMETERS, int mode, int expr)
|
||||
|
||||
|
||||
ctxp = php_xpath_get_context(id, le_xpathctxp, 0 TSRMLS_CC);
|
||||
if (!ctxp) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
convert_to_string(str);
|
||||
|
||||
if (contextnode) {
|
||||
@@ -2766,4 +2788,6 @@ PHP_FUNCTION(domxml_version)
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
* vim600: noet sw=4 ts=4 tw=78 fdm=marker
|
||||
* vim<600: noet sw=4 ts=4 tw=78
|
||||
*/
|
||||
+7
-14
@@ -4,21 +4,15 @@ PHP_ARG_WITH(fdftk, for fdftk support,
|
||||
[ --with-fdftk[=DIR] Include fdftk support])
|
||||
|
||||
if test "$PHP_FDFTK" != "no"; then
|
||||
if test -r $PHP_FDFTK/include/FdfTk.h -o -r $PHP_FDFTK/fdftk.h; then
|
||||
FDFTK_DIR=$PHP_FDFTK
|
||||
else
|
||||
AC_MSG_CHECKING(for fdftk in default path)
|
||||
for i in /usr/local /usr; do
|
||||
if test -r $i/include/FdfTk.h -o -r $i/include/fdftk.h; then
|
||||
FDFTK_DIR=$i
|
||||
AC_MSG_RESULT(found in $i)
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
for i in /usr /usr/local $PHP_FDFTK; do
|
||||
if test -r $i/include/FdfTk.h -o -r $i/include/fdftk.h; then
|
||||
FDFTK_DIR=$i
|
||||
fi
|
||||
done
|
||||
|
||||
if test -z "$FDFTK_DIR"; then
|
||||
AC_MSG_RESULT(not found)
|
||||
AC_MSG_ERROR(Please reinstall the fdftk distribution)
|
||||
AC_MSG_ERROR(FdfTk.h or fdftk.h not found. Please reinstall the fdftk distribution)
|
||||
fi
|
||||
|
||||
PHP_ADD_INCLUDE($FDFTK_DIR/include)
|
||||
@@ -38,4 +32,3 @@ if test "$PHP_FDFTK" != "no"; then
|
||||
PHP_SUBST(FDFTK_SHARED_LIBADD)
|
||||
PHP_EXTENSION(fdf, $ext_shared)
|
||||
fi
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
FRIBIDI
|
||||
Onn Ben-Zvi
|
||||
+2
-2
@@ -35,8 +35,8 @@ Compiling
|
||||
|
||||
Prerequisites
|
||||
=============
|
||||
1) FriBidi must be installed. Latest version can be obtained thru
|
||||
http://imagic.weizmann.ac.il/~dov/freesw/FriBidi.
|
||||
1) FriBidi version 0.9.0 or later must be installed. Latest version can be obtained thru
|
||||
http://fribidi.sourceforge.net/
|
||||
|
||||
2) glib header files: glib.h and glibconfig.h.
|
||||
|
||||
|
||||
+17
-11
@@ -1,16 +1,11 @@
|
||||
dnl $Id$
|
||||
dnl config.m4 for extension fribidi
|
||||
dnl don't forget to call PHP_EXTENSION(fribidi)
|
||||
|
||||
|
||||
|
||||
PHP_ARG_WITH(fribidi, whether to add fribidi support,
|
||||
[ --with-fribidi[=DIR] Include fribidi support (requires FriBidi >=0.1.12).
|
||||
DIR is the fribidi installation directory -
|
||||
default /usr/local/])
|
||||
|
||||
|
||||
|
||||
if test "$PHP_FRIBIDI" != "no"; then
|
||||
|
||||
dnl if module was requested with default path of fribidi installation then
|
||||
@@ -19,8 +14,6 @@ dnl $PHP_FRIBIDI will be "yes"
|
||||
if test "$PHP_FRIBIDI" = "yes"; then
|
||||
PHP_FRIBIDI=/usr/local
|
||||
fi
|
||||
|
||||
|
||||
|
||||
dnl check for fribidi header files
|
||||
|
||||
@@ -32,8 +25,6 @@ dnl $PHP_FRIBIDI will be "yes"
|
||||
AC_MSG_RESULT([missing])
|
||||
fi
|
||||
|
||||
|
||||
|
||||
dnl check for fribidi shared library
|
||||
|
||||
AC_MSG_CHECKING([for libfribidi.so file in "$PHP_FRIBIDI/lib/"])
|
||||
@@ -54,20 +45,35 @@ dnl $PHP_FRIBIDI will be "yes"
|
||||
AC_MSG_RESULT([missing])
|
||||
fi
|
||||
|
||||
|
||||
dnl check for fribidi version
|
||||
AC_MSG_CHECKING([for FriBidi version])
|
||||
FRIBIDI_CONFIG=$PHP_FRIBIDI/bin/fribidi-config
|
||||
if test -x $FRIBIDI_CONFIG; then
|
||||
fribidi_version_full=`$FRIBIDI_CONFIG --version`
|
||||
fi
|
||||
|
||||
fribidi_version=`echo ${fribidi_version_full} | awk 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
|
||||
|
||||
if test "$fribidi_version" -ge 9000; then
|
||||
AC_MSG_RESULT([$fribidi_version_full])
|
||||
else
|
||||
AC_MSG_ERROR(FriBidi version 0.9.0 or later is required to compile php with FriBidi support)
|
||||
fi
|
||||
|
||||
|
||||
AC_MSG_CHECKING([sanity to build extension])
|
||||
if test -n "$FRIBIDI_INCDIR" && test -n "$FRIBIDI_LIBDIR" && test -n "$GLIB_INCDIR"; then
|
||||
|
||||
AC_MSG_RESULT([yes])
|
||||
|
||||
|
||||
PHP_ADD_INCLUDE("$FRIBIDI_INCDIR")
|
||||
PHP_ADD_INCLUDE("$GLIB_INCDIR")
|
||||
PHP_ADD_LIBRARY_WITH_PATH(fribidi,"$FRIBIDI_LIBDIR", FRIBIDI_SHARED_LIBADD)
|
||||
PHP_SUBST(FRIBIDI_SHARED_LIBADD)
|
||||
|
||||
AC_DEFINE(HAVE_FRIBIDI, 1, [ ])
|
||||
PHP_EXTENSION(fribidi, $ext_shared)
|
||||
PHP_SUBST(FRIBIDI_SHARED_LIBADD)
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
|
||||
+12
-12
@@ -12,7 +12,7 @@
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: |
|
||||
| Authors: Onn Ben-Zvi <onn@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
@@ -66,8 +66,8 @@ ZEND_GET_MODULE(fribidi)
|
||||
PHP_MINIT_FUNCTION(fribidi)
|
||||
{
|
||||
REGISTER_LONG_CONSTANT("FRIBIDI_CHARSET_UTF8", FRIBIDI_CHARSET_UTF8, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("FRIBIDI_CHARSET_8859_6", FRIBIDI_CHARSET_8859_6, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("FRIBIDI_CHARSET_8859_8", FRIBIDI_CHARSET_8859_8, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("FRIBIDI_CHARSET_8859_6", FRIBIDI_CHARSET_ISO8859_6, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("FRIBIDI_CHARSET_8859_8", FRIBIDI_CHARSET_ISO8859_8, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("FRIBIDI_CHARSET_CP1255", FRIBIDI_CHARSET_CP1255, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("FRIBIDI_CHARSET_CP1256", FRIBIDI_CHARSET_CP1256, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("FRIBIDI_CHARSET_ISIRI_3342", FRIBIDI_CHARSET_ISIRI_3342, CONST_CS | CONST_PERSISTENT);
|
||||
@@ -108,13 +108,13 @@ PHP_MINFO_FUNCTION(fribidi)
|
||||
/* Possible values (i.e., char sets supported) */
|
||||
/* FRIBIDI_CHARSET_UTF8 */
|
||||
/* FRIBIDI_CHARSET_8859_6 */
|
||||
/* FRIBIDI_CHARSET_8859_8 */
|
||||
/* FRIBIDI_CHARSET_CP1255 */
|
||||
/* FRIBIDI_CHARSET_CP1256 */
|
||||
/* FRIBIDI_CHARSET_ISIRI_3342 */
|
||||
/* FRIBIDI_CHARSET_8859_8 */
|
||||
/* FRIBIDI_CHARSET_CP1255 */
|
||||
/* FRIBIDI_CHARSET_CP1256 */
|
||||
/* FRIBIDI_CHARSET_ISIRI_3342 */
|
||||
/* */
|
||||
/* Output: on success: The visual string. */
|
||||
/* on failure: */
|
||||
/* on failure: */
|
||||
/*--------------------------------------------------------------*/
|
||||
|
||||
/* {{{ proto string fribidi_log2vis(string str, string direction, int charset)
|
||||
@@ -174,10 +174,10 @@ PHP_FUNCTION(fribidi_log2vis)
|
||||
case FRIBIDI_CHARSET_UTF8:
|
||||
utf8_len=fribidi_utf8_to_unicode(inString, u_logical_str);
|
||||
break;
|
||||
case FRIBIDI_CHARSET_8859_6:
|
||||
case FRIBIDI_CHARSET_ISO8859_6:
|
||||
fribidi_iso8859_6_to_unicode(inString, u_logical_str);
|
||||
break;
|
||||
case FRIBIDI_CHARSET_8859_8:
|
||||
case FRIBIDI_CHARSET_ISO8859_8:
|
||||
fribidi_iso8859_8_to_unicode(inString, u_logical_str);
|
||||
break;
|
||||
case FRIBIDI_CHARSET_CP1255:
|
||||
@@ -211,10 +211,10 @@ PHP_FUNCTION(fribidi_log2vis)
|
||||
case FRIBIDI_CHARSET_UTF8:
|
||||
fribidi_unicode_to_utf8(u_visual_str, utf8_len , outString);
|
||||
break;
|
||||
case FRIBIDI_CHARSET_8859_6:
|
||||
case FRIBIDI_CHARSET_ISO8859_6:
|
||||
fribidi_unicode_to_iso8859_6(u_visual_str, len , outString);
|
||||
break;
|
||||
case FRIBIDI_CHARSET_8859_8:
|
||||
case FRIBIDI_CHARSET_ISO8859_8:
|
||||
fribidi_unicode_to_iso8859_8(u_visual_str, len , outString);
|
||||
break;
|
||||
case FRIBIDI_CHARSET_CP1255:
|
||||
|
||||
@@ -12,8 +12,7 @@
|
||||
| obtain it through the world-wide-web, please send a note to |
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: |
|
||||
| |
|
||||
| Authors: Onn Ben-Zvi <onn@zend.com> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
|
||||
+8
-5
@@ -9,7 +9,7 @@ AC_DEFUN(PHP_GD_JPEG,[
|
||||
if test "$PHP_JPEG_DIR" != "no"; then
|
||||
|
||||
for i in /usr /usr/local $PHP_JPEG_DIR; do
|
||||
test -f "$i/lib/libjpeg.s?" -o -f "$i/lib/libjpeg.a" && GD_JPEG_DIR=$i
|
||||
test -f $i/lib/libjpeg.$SHLIB_SUFFIX_NAME -o -f $i/lib/libjpeg.a && GD_JPEG_DIR=$i
|
||||
done
|
||||
|
||||
AC_CHECK_LIB(jpeg,jpeg_read_header,
|
||||
@@ -32,7 +32,7 @@ AC_DEFUN(PHP_GD_PNG,[
|
||||
if test "$PHP_PNG_DIR" != "no"; then
|
||||
|
||||
for i in /usr /usr/local $PHP_PNG_DIR; do
|
||||
test -f "$i/lib/libpng.s?" -o -f "$i/lib/libpng.a" && GD_PNG_DIR=$i
|
||||
test -f $i/lib/libpng.$SHLIB_SUFFIX_NAME -o -f $i/lib/libpng.a && GD_PNG_DIR=$i
|
||||
done
|
||||
|
||||
if test "$PHP_ZLIB_DIR" = "no"; then
|
||||
@@ -59,7 +59,7 @@ AC_DEFUN(PHP_GD_XPM,[
|
||||
|
||||
if test "$PHP_XPM_DIR" != "no"; then
|
||||
for i in /usr /usr/local /usr/X11R6 $PHP_XPM_DIR; do
|
||||
test -f "$i/lib/libXpm.s?" -o -f "$i/lib/libXpm.a" && GD_XPM_DIR=$i
|
||||
test -f $i/lib/libXpm.$SHLIB_SUFFIX_NAME -o -f $i/lib/libXpm.a && GD_XPM_DIR=$i
|
||||
done
|
||||
|
||||
AC_CHECK_LIB(Xpm,XpmFreeXpmImage,
|
||||
@@ -172,7 +172,8 @@ AC_DEFUN(PHP_GD_CHECK_VERSION,[
|
||||
AC_CHECK_LIB(gd, gdImageString16, [AC_DEFINE(HAVE_LIBGD13, 1, [ ])])
|
||||
AC_CHECK_LIB(gd, gdImagePaletteCopy, [AC_DEFINE(HAVE_LIBGD15, 1, [ ])])
|
||||
AC_CHECK_LIB(gd, gdImageCreateFromPng, [AC_DEFINE(HAVE_GD_PNG, 1, [ ])])
|
||||
AC_CHECK_LIB(gd, gdImageCreateFromGif, [AC_DEFINE(HAVE_GD_GIF, 1, [ ])])
|
||||
AC_CHECK_LIB(gd, gdImageCreateFromGif, [AC_DEFINE(HAVE_GD_GIF_READ, 1, [ ])])
|
||||
AC_CHECK_LIB(gd, gdImageGif, [AC_DEFINE(HAVE_GD_GIF_CREATE, 1, [ ])])
|
||||
AC_CHECK_LIB(gd, gdImageWBMP, [AC_DEFINE(HAVE_GD_WBMP, 1, [ ])])
|
||||
AC_CHECK_LIB(gd, gdImageCreateFromJpeg, [AC_DEFINE(HAVE_GD_JPG, 1, [ ])])
|
||||
AC_CHECK_LIB(gd, gdImageCreateFromXpm, [AC_DEFINE(HAVE_GD_XPM, 1, [ ])])
|
||||
@@ -180,6 +181,8 @@ AC_DEFUN(PHP_GD_CHECK_VERSION,[
|
||||
AC_CHECK_LIB(gd, gdImageCreateTrueColor, [AC_DEFINE(HAVE_LIBGD20, 1, [ ])])
|
||||
AC_CHECK_LIB(gd, gdImageSetTile, [AC_DEFINE(HAVE_GD_IMAGESETTILE, 1, [ ])])
|
||||
AC_CHECK_LIB(gd, gdImageSetBrush, [AC_DEFINE(HAVE_GD_IMAGESETBRUSH, 1, [ ])])
|
||||
AC_CHECK_LIB(gd, gdImageStringTTF, [AC_DEFINE(HAVE_GD_STRINGTTF, 1, [ ])])
|
||||
AC_CHECK_LIB(gd, gdImageStringFT, [AC_DEFINE(HAVE_GD_STRINGFT, 1, [ ])])
|
||||
AC_CHECK_LIB(gd, gdImageStringFTEx, [AC_DEFINE(HAVE_GD_STRINGFTEX, 1, [ ])])
|
||||
AC_CHECK_LIB(gd, gdImageColorClosestHWB, [AC_DEFINE(HAVE_COLORCLOSESTHWB, 1, [ ])])
|
||||
AC_CHECK_LIB(gd, gdImageColorResolve, [AC_DEFINE(HAVE_GDIMAGECOLORRESOLVE, 1, [ ])])
|
||||
@@ -219,7 +222,7 @@ dnl A whole whack of possible places where these might be
|
||||
done
|
||||
|
||||
for i in lib/gd1.3 lib/gd lib gd1.3 gd ""; do
|
||||
test -f $PHP_GD/$i/libgd.s? -o -f $PHP_GD/$i/libgd.a && GD_LIB=$PHP_GD/$i
|
||||
test -f $PHP_GD/$i/libgd.$SHLIB_SUFFIX_NAME -o -f $PHP_GD/$i/libgd.a && GD_LIB=$PHP_GD/$i
|
||||
done
|
||||
|
||||
if test -n "$GD_INCLUDE" && test -n "$GD_LIB" ; then
|
||||
|
||||
+32
-21
@@ -305,8 +305,11 @@ PHP_MINFO_FUNCTION(gd)
|
||||
|
||||
/* this next part is stupid ... if I knew better, I'd put them all on one row (cmv) */
|
||||
|
||||
#ifdef HAVE_GD_GIF
|
||||
php_info_print_table_row(2, "GIF Support", "enabled");
|
||||
#ifdef HAVE_GD_GIF_READ
|
||||
php_info_print_table_row(2, "GIF Read Support", "enabled");
|
||||
#endif
|
||||
#ifdef HAVE_GD_GIF_CREATE
|
||||
php_info_print_table_row(2, "GIF Create Support", "enabled");
|
||||
#endif
|
||||
#ifdef HAVE_GD_JPG
|
||||
php_info_print_table_row(2, "JPG Support", "enabled");
|
||||
@@ -1045,7 +1048,7 @@ PHP_FUNCTION(imagecreatefromstring)
|
||||
break;
|
||||
|
||||
case PHP_GDIMG_TYPE_GIF:
|
||||
#ifdef HAVE_GD_GIF
|
||||
#ifdef HAVE_GD_GIF_READ
|
||||
im = _php_image_create_from_string (data, "GIF", gdImageCreateFromGifCtx TSRMLS_CC);
|
||||
#else
|
||||
php_error(E_WARNING, "No GIF support in this PHP build");
|
||||
@@ -1187,10 +1190,10 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type,
|
||||
Create a new image from GIF file or URL */
|
||||
PHP_FUNCTION(imagecreatefromgif)
|
||||
{
|
||||
#ifdef HAVE_GD_GIF
|
||||
#ifdef HAVE_GD_GIF_READ
|
||||
_php_image_create_from(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_GIF, "GIF", gdImageCreateFromGif, gdImageCreateFromGifCtx);
|
||||
#else /* HAVE_GD_GIF */
|
||||
php_error(E_WARNING, "ImageCreateFromGif: No GIF support in this PHP build");
|
||||
#else /* HAVE_GD_GIF_READ */
|
||||
php_error(E_WARNING, "ImageCreateFromGif: No GIF read support in this PHP build");
|
||||
RETURN_FALSE;
|
||||
#endif /* HAVE_GD_GIF */
|
||||
}
|
||||
@@ -1413,14 +1416,14 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char
|
||||
Output GIF image to browser or file */
|
||||
PHP_FUNCTION(imagegif)
|
||||
{
|
||||
#ifdef HAVE_GD_GIF
|
||||
#ifdef HAVE_GD_GIF_CREATE
|
||||
#ifdef HAVE_GD_GIF_CTX
|
||||
_php_image_output_ctx(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_GIF, "GIF", gdImageGifCtx);
|
||||
#else
|
||||
_php_image_output(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_GIF, "GIF", gdImageGif);
|
||||
#endif
|
||||
#else /* HAVE_GD_GIF */
|
||||
php_error(E_WARNING, "ImageGif: No GIF support in this PHP build");
|
||||
php_error(E_WARNING, "ImageGif: No GIF create support in this PHP build");
|
||||
RETURN_FALSE;
|
||||
#endif /* HAVE_GD_GIF */
|
||||
}
|
||||
@@ -1574,10 +1577,16 @@ PHP_FUNCTION(imagecolorat)
|
||||
|
||||
ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
|
||||
|
||||
#if HAVE_LIBGD20
|
||||
if(im->trueColor) {
|
||||
php_error(E_WARNING, "ImageColorAt does not work on TrueColor images");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
#endif
|
||||
convert_to_long_ex(x);
|
||||
convert_to_long_ex(y);
|
||||
|
||||
if (gdImageBoundsSafe(im, Z_LVAL_PP(x), Z_LVAL_PP(y))) {
|
||||
if (im->pixels && gdImageBoundsSafe(im, Z_LVAL_PP(x), Z_LVAL_PP(y))) {
|
||||
#if HAVE_LIBGD13
|
||||
RETURN_LONG(im->pixels[Z_LVAL_PP(y)][Z_LVAL_PP(x)]);
|
||||
#else
|
||||
@@ -2257,7 +2266,7 @@ PHP_FUNCTION(imagefontheight)
|
||||
|
||||
/* {{{ php_gdimagecharup
|
||||
* workaround for a bug in gd 1.2 */
|
||||
void php_gdimagecharup(gdImagePtr im, gdFontPtr f, int x, int y, int c, int color)
|
||||
static void php_gdimagecharup(gdImagePtr im, gdFontPtr f, int x, int y, int c, int color)
|
||||
{
|
||||
int cx, cy, px, py, fline;
|
||||
cx = 0;
|
||||
@@ -2607,7 +2616,6 @@ PHP_FUNCTION(imagefttext)
|
||||
/* }}} */
|
||||
|
||||
|
||||
|
||||
/* {{{ proto array imagettfbbox(int size, int angle, string font_file, string text)
|
||||
Give the bounding box of a text using TrueType fonts */
|
||||
PHP_FUNCTION(imagettfbbox)
|
||||
@@ -2637,8 +2645,7 @@ PHP_FUNCTION(imagettftext)
|
||||
#ifdef ENABLE_GD_TTF
|
||||
/* {{{ php_imagettftext_common
|
||||
*/
|
||||
static
|
||||
void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode, int extended)
|
||||
static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode, int extended)
|
||||
{
|
||||
zval **IM, **PTSIZE, **ANGLE, **X, **Y, **C, **FONTNAME, **COL, **EXT = NULL;
|
||||
gdImagePtr im=NULL;
|
||||
@@ -2736,23 +2743,27 @@ void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode, int extende
|
||||
fontname = (unsigned char*)Z_STRVAL_PP(FONTNAME);
|
||||
#endif
|
||||
|
||||
#ifdef USE_GD_IMGSTRTTF
|
||||
# if HAVE_LIBFREETYPE
|
||||
|
||||
#if HAVE_GD_STRINGFTEX
|
||||
#ifdef USE_GD_IMGSTRTTF
|
||||
# if HAVE_GD_STRINGFTEX
|
||||
if (extended) {
|
||||
error = gdImageStringFTEx(im, brect, col, fontname, ptsize, angle, x, y, str, &strex);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
# endif
|
||||
# if HAVE_GD_STRINGFT
|
||||
error = gdImageStringFT(im, brect, col, fontname, ptsize, angle, x, y, str);
|
||||
# else
|
||||
# endif
|
||||
|
||||
# if HAVE_GD_STRINGTTF
|
||||
error = gdImageStringTTF(im, brect, col, fontname, ptsize, angle, x, y, str);
|
||||
# endif
|
||||
#else
|
||||
|
||||
#else /* !USE_GD_IMGSTRTTF */
|
||||
error = gdttf(im, brect, col, fontname, ptsize, angle, x, y, str);
|
||||
#endif
|
||||
|
||||
|
||||
if (error) {
|
||||
php_error(E_WARNING, "%s", error);
|
||||
RETURN_FALSE;
|
||||
@@ -3447,7 +3458,7 @@ static void _php_image_convert(INTERNAL_FUNCTION_PARAMETERS, int image_type )
|
||||
}
|
||||
|
||||
switch (image_type) {
|
||||
#ifdef HAVE_GD_GIF
|
||||
#ifdef HAVE_GD_GIF_READ
|
||||
case PHP_GDIMG_TYPE_GIF:
|
||||
im_org = gdImageCreateFromGif (org);
|
||||
if (im_org == NULL) {
|
||||
@@ -3455,7 +3466,7 @@ static void _php_image_convert(INTERNAL_FUNCTION_PARAMETERS, int image_type )
|
||||
RETURN_FALSE;
|
||||
}
|
||||
break;
|
||||
#endif /* HAVE_GD_GIF */
|
||||
#endif /* HAVE_GD_GIF_READ */
|
||||
|
||||
#ifdef HAVE_GD_JPG
|
||||
case PHP_GDIMG_TYPE_JPG:
|
||||
|
||||
@@ -146,7 +146,6 @@ PHP_FUNCTION(imagestring);
|
||||
PHP_FUNCTION(imagestringup);
|
||||
PHP_FUNCTION(imagesx);
|
||||
PHP_FUNCTION(imagesy);
|
||||
static void php_gdimagecharup(gdImagePtr, gdFontPtr, int, int, int, int);
|
||||
PHP_FUNCTION(imagedashedline);
|
||||
PHP_FUNCTION(imagettfbbox);
|
||||
PHP_FUNCTION(imagettftext);
|
||||
|
||||
+5
-2
@@ -14,9 +14,12 @@ if test "$PHP_ICONV" != "no"; then
|
||||
AC_MSG_ERROR(Please reinstall the iconv library.)
|
||||
fi
|
||||
|
||||
if test -f $ICONV_DIR/lib/libconv.a -o -f $ICONV_DIR/lib/libiconv.s? ; then
|
||||
if test -f $ICONV_DIR/lib/libconv.a -o -f $ICONV_DIR/lib/libiconv.$SHLIB_SUFFIX_NAME ; then
|
||||
PHP_ADD_LIBRARY_WITH_PATH(iconv, $ICONV_DIR/lib, ICONV_SHARED_LIBADD)
|
||||
AC_CHECK_LIB(iconv, libiconv_open, AC_DEFINE(HAVE_ICONV, 1, [ ]))
|
||||
AC_CHECK_LIB(iconv, libiconv_open, [
|
||||
AC_DEFINE(HAVE_ICONV, 1, [ ])
|
||||
AC_DEFINE(HAVE_LIBICONV, 1, [ ])
|
||||
])
|
||||
else
|
||||
AC_CHECK_LIB(c, iconv_open, AC_DEFINE(HAVE_ICONV, 1, [ ]))
|
||||
fi
|
||||
|
||||
+26
-22
@@ -336,8 +336,7 @@ void mail_free_errorlist(ERRORLIST **errlist)
|
||||
*/
|
||||
MESSAGELIST *mail_newmessagelist(void)
|
||||
{
|
||||
return (MESSAGELIST *) memset(fs_get(sizeof(MESSAGELIST)), 0,
|
||||
sizeof(MESSAGELIST));
|
||||
return (MESSAGELIST *) memset(fs_get(sizeof(MESSAGELIST)), 0, sizeof(MESSAGELIST));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -347,12 +346,17 @@ MESSAGELIST *mail_newmessagelist(void)
|
||||
* Accepts: pointer to MESSAGELIST pointer
|
||||
* Author: CJH
|
||||
*/
|
||||
void mail_free_messagelist(MESSAGELIST **msglist)
|
||||
void mail_free_messagelist(MESSAGELIST **msglist, MESSAGELIST **tail)
|
||||
{
|
||||
if (*msglist) { /* only free if exists */
|
||||
mail_free_messagelist (&(*msglist)->next);
|
||||
fs_give ((void **) msglist); /* return string to free storage */
|
||||
MESSAGELIST *cur, *next;
|
||||
|
||||
for (cur = *msglist, next = cur->next; cur; cur = next) {
|
||||
next = cur->next;
|
||||
fs_give((void **)&cur);
|
||||
}
|
||||
|
||||
*tail = NIL;
|
||||
*msglist = NIL;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -381,15 +385,16 @@ void mail_getquota(MAILSTREAM *stream, char *qroot, QUOTALIST *qlist)
|
||||
*/
|
||||
static void php_imap_init_globals(zend_imap_globals *imap_globals)
|
||||
{
|
||||
imap_globals->imap_user=NIL;
|
||||
imap_globals->imap_password=NIL;
|
||||
imap_globals->imap_folders=NIL;
|
||||
imap_globals->imap_sfolders=NIL;
|
||||
imap_globals->imap_alertstack=NIL;
|
||||
imap_globals->imap_errorstack=NIL;
|
||||
imap_globals->imap_messages=NIL;
|
||||
imap_globals->imap_folder_objects=NIL;
|
||||
imap_globals->imap_sfolder_objects=NIL;
|
||||
imap_globals->imap_user = NIL;
|
||||
imap_globals->imap_password = NIL;
|
||||
imap_globals->imap_folders = NIL;
|
||||
imap_globals->imap_sfolders = NIL;
|
||||
imap_globals->imap_alertstack = NIL;
|
||||
imap_globals->imap_errorstack = NIL;
|
||||
imap_globals->imap_messages = NIL;
|
||||
imap_globals->imap_messages_tail = NIL;
|
||||
imap_globals->imap_folder_objects = NIL;
|
||||
imap_globals->imap_sfolder_objects = NIL;
|
||||
imap_globals->folderlist_style = FLIST_ARRAY;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -3357,7 +3362,7 @@ PHP_FUNCTION(imap_search)
|
||||
flags = Z_LVAL_PP(search_flags);
|
||||
}
|
||||
|
||||
IMAPG(imap_messages) = NIL;
|
||||
IMAPG(imap_messages) = IMAPG(imap_messages_tail) = NIL;
|
||||
mail_search_full(imap_le_struct->imap_stream, NIL, mail_criteria(search_criteria), flags);
|
||||
if (IMAPG(imap_messages) == NIL) {
|
||||
efree(search_criteria);
|
||||
@@ -3371,7 +3376,7 @@ PHP_FUNCTION(imap_search)
|
||||
add_next_index_long(return_value, cur->msgid);
|
||||
cur = cur->next;
|
||||
}
|
||||
mail_free_messagelist(&IMAPG(imap_messages));
|
||||
mail_free_messagelist(&IMAPG(imap_messages), &IMAPG(imap_messages_tail));
|
||||
efree(search_criteria);
|
||||
}
|
||||
/* }}} */
|
||||
@@ -3895,20 +3900,19 @@ void mm_searched(MAILSTREAM *stream, unsigned long number)
|
||||
{
|
||||
MESSAGELIST *cur = NIL;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
|
||||
if (IMAPG(imap_messages) == NIL) {
|
||||
IMAPG(imap_messages) = mail_newmessagelist();
|
||||
IMAPG(imap_messages)->msgid = number;
|
||||
IMAPG(imap_messages)->next = NIL;
|
||||
IMAPG(imap_messages_tail) = IMAPG(imap_messages);
|
||||
} else {
|
||||
cur = IMAPG(imap_messages);
|
||||
while (cur->next != NIL) {
|
||||
cur = cur->next;
|
||||
}
|
||||
cur = IMAPG(imap_messages_tail);
|
||||
cur->next = mail_newmessagelist();
|
||||
cur = cur->next;
|
||||
cur->msgid = number;
|
||||
cur->next = NIL;
|
||||
IMAPG(imap_messages_tail) = cur;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -190,6 +190,7 @@ ZEND_BEGIN_MODULE_GLOBALS(imap)
|
||||
STRINGLIST *imap_alertstack;
|
||||
ERRORLIST *imap_errorstack;
|
||||
MESSAGELIST *imap_messages;
|
||||
MESSAGELIST *imap_messages_tail;
|
||||
FOBJECTLIST *imap_folder_objects;
|
||||
FOBJECTLIST *imap_sfolder_objects;
|
||||
folderlist_style_t folderlist_style;
|
||||
|
||||
+53
-12
@@ -25,6 +25,12 @@ A lot... */
|
||||
|
||||
/*
|
||||
Changes:
|
||||
2001-05-31: Jeremy Bettis <jeremy@deadbeef.com>
|
||||
- If a blob handle was expected and something else was
|
||||
received create a blob and add the value to it.
|
||||
- If the incoming argument to a bind parameter is NULL
|
||||
then store a NULL in the database.
|
||||
- More verbose date errors.
|
||||
1999-09-21: Ivo Panacek <ivop@regionet.cz>
|
||||
- added COMPILE_DL section
|
||||
- more verbose php_info_ibase function
|
||||
@@ -484,13 +490,13 @@ PHP_INI_BEGIN()
|
||||
STD_PHP_INI_ENTRY("ibase.timeformat", "%H:%M:%S", PHP_INI_ALL, OnUpdateString, cfg_timeformat, zend_ibase_globals, ibase_globals)
|
||||
PHP_INI_END()
|
||||
|
||||
static void php_ibase_init_globals(TSRMLS_D)
|
||||
static void php_ibase_init_globals(zend_ibase_globals *ibase_globals)
|
||||
{
|
||||
IBG(timestampformat) = NULL;
|
||||
IBG(dateformat) = NULL;
|
||||
IBG(timeformat) = NULL;
|
||||
IBG(errmsg) = NULL;
|
||||
IBG(num_persistent) = 0;
|
||||
ibase_globals->timestampformat = NULL;
|
||||
ibase_globals->dateformat = NULL;
|
||||
ibase_globals->timeformat = NULL;
|
||||
ibase_globals->errmsg = NULL;
|
||||
ibase_globals->num_persistent = 0;
|
||||
}
|
||||
|
||||
PHP_MINIT_FUNCTION(ibase)
|
||||
@@ -1118,7 +1124,7 @@ _php_ibase_alloc_query_error:
|
||||
|
||||
/* {{{ _php_ibase_bind()
|
||||
Bind parameter placeholders in a previously prepared query */
|
||||
static int _php_ibase_bind(XSQLDA *sqlda, pval **b_vars, BIND_BUF *buf)
|
||||
static int _php_ibase_bind(XSQLDA *sqlda, pval **b_vars, BIND_BUF *buf, ibase_query *ib_query)
|
||||
{
|
||||
XSQLVAR *var;
|
||||
pval *b_var;
|
||||
@@ -1131,6 +1137,15 @@ static int _php_ibase_bind(XSQLDA *sqlda, pval **b_vars, BIND_BUF *buf)
|
||||
var->sqlind = &buf[i].sqlind;
|
||||
b_var = b_vars[i];
|
||||
|
||||
if (b_var->type == IS_NULL) {
|
||||
static char nothing[64];
|
||||
static short null_flag = -1;
|
||||
var->sqldata = nothing;
|
||||
var->sqltype |= 1;
|
||||
var->sqlind = &null_flag;
|
||||
if (var->sqllen > 64)
|
||||
var->sqllen = 64;
|
||||
} else
|
||||
switch(var->sqltype & ~1) {
|
||||
case SQL_TEXT: /* direct to variable */
|
||||
case SQL_VARYING:
|
||||
@@ -1208,7 +1223,7 @@ static int _php_ibase_bind(XSQLDA *sqlda, pval **b_vars, BIND_BUF *buf)
|
||||
n = sscanf(b_var->value.str.val, "%d%*[/]%d%*[/]%d %d%*[:]%d%*[:]%d",
|
||||
&t.tm_mon, &t.tm_mday, &t.tm_year, &t.tm_hour, &t.tm_min, &t.tm_sec);
|
||||
if(n != 3 && n != 6){
|
||||
_php_ibase_module_error("invalid date/time format");
|
||||
_php_ibase_module_error("invalid date/time format: Expected 3 or 6 fields, got %d. Use format m/d/Y H:i:s. You gave '%s'", n, b_var->value.str.val);
|
||||
return FAILURE;
|
||||
}
|
||||
t.tm_year -= 1900;
|
||||
@@ -1266,12 +1281,38 @@ static int _php_ibase_bind(XSQLDA *sqlda, pval **b_vars, BIND_BUF *buf)
|
||||
if (b_var->type != IS_STRING
|
||||
|| b_var->value.str.len != sizeof(ibase_blob_handle)
|
||||
|| ((ibase_blob_handle *)(b_var->value.str.val))->bl_handle != 0) {
|
||||
ibase_blob_handle *ib_blob;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
ib_blob = (ibase_blob_handle *) emalloc(sizeof(ibase_blob_handle));
|
||||
ib_blob->trans_handle = ib_query->trans;
|
||||
ib_blob->link = ib_query->link;
|
||||
ib_blob->bl_handle = NULL;
|
||||
if (isc_create_blob(IB_STATUS, &ib_blob->link, &ib_blob->trans_handle, &ib_blob->bl_handle, &ib_blob->bl_qd)) {
|
||||
efree(ib_blob);
|
||||
_php_ibase_error();
|
||||
return FAILURE;
|
||||
}
|
||||
convert_to_string(b_var);
|
||||
if (isc_put_segment(IB_STATUS, &ib_blob->bl_handle, (unsigned short) b_var->value.str.len, b_var->value.str.val)) {
|
||||
_php_ibase_error();
|
||||
return FAILURE;
|
||||
}
|
||||
if (isc_close_blob(IB_STATUS, &ib_blob->bl_handle)) {
|
||||
_php_ibase_error();
|
||||
return FAILURE;
|
||||
}
|
||||
ib_blob_id = ib_blob;
|
||||
var->sqldata = (void ISC_FAR *)&ib_blob_id->bl_qd;
|
||||
/*
|
||||
_php_ibase_module_error("invalid blob id string");
|
||||
return FAILURE;
|
||||
}
|
||||
ib_blob_id = (ibase_blob_handle *)b_var->value.str.val;
|
||||
*/
|
||||
} else {
|
||||
ib_blob_id = (ibase_blob_handle *)b_var->value.str.val;
|
||||
|
||||
var->sqldata = (void ISC_FAR *)&ib_blob_id->bl_qd;
|
||||
var->sqldata = (void ISC_FAR *)&ib_blob_id->bl_qd;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SQL_ARRAY:
|
||||
@@ -1383,7 +1424,7 @@ static int _php_ibase_exec(ibase_result **ib_resultp, ibase_query *ib_query, int
|
||||
in_sqlda = emalloc(XSQLDA_LENGTH(ib_query->in_sqlda->sqld));
|
||||
memcpy(in_sqlda, ib_query->in_sqlda, XSQLDA_LENGTH(ib_query->in_sqlda->sqld));
|
||||
bind_buf = emalloc(sizeof(BIND_BUF) * ib_query->in_sqlda->sqld);
|
||||
if (_php_ibase_bind(in_sqlda, args, bind_buf) == FAILURE) {
|
||||
if (_php_ibase_bind(in_sqlda, args, bind_buf, ib_query) == FAILURE) {
|
||||
IBDEBUG("Could not bind input XSQLDA... (_php_ibase_exec)");
|
||||
goto _php_ibase_exec_error;
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ RSC=rc.exe
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\main" /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\..\php_build\Interbase SDK\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "INTERBASE_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D ZEND_DEBUG=1 /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\main" /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\..\php_build\Interbase SDK\include" /I "..\..\..\bindlib_w32" /D "_DEBUG" /D ZEND_DEBUG=1 /D "ZTS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "INTERBASE_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_IBASE=1 /FR /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\main" /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\..\php_build\Interbase SDK\include" /I "..\..\..\bindlib_w32" /D "_DEBUG" /D ZEND_DEBUG=1 /D "ZTS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "INTERBASE_EXPORTS" /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_IBASE=1 /D "COMPILE_DL_INTERBASE" /FR /YX /FD /GZ /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x40d /d "_DEBUG"
|
||||
|
||||
@@ -159,7 +159,6 @@ enum php_interbase_option {
|
||||
};
|
||||
|
||||
#ifdef ZTS
|
||||
#define IBG(v) (ibase_globals->v)
|
||||
#define IBG(v) TSRMG(ibase_globals_id, zend_ibase_globals *, v)
|
||||
#else
|
||||
#define IBG(v) (ibase_globals.v)
|
||||
|
||||
+129
-2
@@ -101,6 +101,7 @@
|
||||
#define mbfl_pfree free
|
||||
|
||||
/* unicode table */
|
||||
extern const unsigned short cp1252_ucs_table[];
|
||||
extern const unsigned short iso8859_2_ucs_table[];
|
||||
extern const unsigned short iso8859_3_ucs_table[];
|
||||
extern const unsigned short iso8859_4_ucs_table[];
|
||||
@@ -558,6 +559,17 @@ static mbfl_encoding mbfl_encoding_2022jp = {
|
||||
MBFL_ENCTYPE_MBCS | MBFL_ENCTYPE_SHFTCODE
|
||||
};
|
||||
|
||||
static const char *mbfl_encoding_cp1252_aliases[] = {"cp1252", NULL};
|
||||
|
||||
static mbfl_encoding mbfl_encoding_cp1252 = {
|
||||
mbfl_no_encoding_cp1252,
|
||||
"Windows-1252",
|
||||
"Windows-1252",
|
||||
&mbfl_encoding_cp1252_aliases,
|
||||
NULL,
|
||||
MBFL_ENCTYPE_SBCS
|
||||
};
|
||||
|
||||
static const char *mbfl_encoding_8859_1_aliases[] = {"ISO_8859-1", "latin1", NULL};
|
||||
|
||||
static mbfl_encoding mbfl_encoding_8859_1 = {
|
||||
@@ -736,6 +748,7 @@ static mbfl_encoding *mbfl_encoding_ptr_list[] = {
|
||||
&mbfl_encoding_sjis_win,
|
||||
&mbfl_encoding_jis,
|
||||
&mbfl_encoding_2022jp,
|
||||
&mbfl_encoding_cp1252,
|
||||
&mbfl_encoding_8859_1,
|
||||
&mbfl_encoding_8859_2,
|
||||
&mbfl_encoding_8859_3,
|
||||
@@ -800,6 +813,8 @@ static int mbfl_filt_conv_wchar_utf7imap(int c, mbfl_convert_filter *filter);
|
||||
static int mbfl_filt_conv_wchar_utf7imap_flush(mbfl_convert_filter *filter);
|
||||
static int mbfl_filt_conv_wchar_ascii(int c, mbfl_convert_filter *filter);
|
||||
|
||||
static int mbfl_filt_conv_wchar_cp1252(int c, mbfl_convert_filter *filter);
|
||||
static int mbfl_filt_conv_cp1252_wchar(int c, mbfl_convert_filter *filter);
|
||||
static int mbfl_filt_conv_wchar_8859_1(int c, mbfl_convert_filter *filter);
|
||||
static int mbfl_filt_conv_8859_2_wchar(int c, mbfl_convert_filter *filter);
|
||||
static int mbfl_filt_conv_wchar_8859_2(int c, mbfl_convert_filter *filter);
|
||||
@@ -836,6 +851,7 @@ static int mbfl_filt_ident_eucjp(int c, mbfl_identify_filter *filter);
|
||||
static int mbfl_filt_ident_sjis(int c, mbfl_identify_filter *filter);
|
||||
static int mbfl_filt_ident_sjiswin(int c, mbfl_identify_filter *filter);
|
||||
static int mbfl_filt_ident_jis(int c, mbfl_identify_filter *filter);
|
||||
static int mbfl_filt_ident_cp1252(int c, mbfl_identify_filter *filter);
|
||||
static int mbfl_filt_ident_2022jp(int c, mbfl_identify_filter *filter);
|
||||
static int mbfl_filt_ident_false(int c, mbfl_identify_filter *filter);
|
||||
static int mbfl_filt_ident_true(int c, mbfl_identify_filter *filter);
|
||||
@@ -1323,6 +1339,23 @@ static struct mbfl_convert_vtbl vtbl_wchar_sjiswin = {
|
||||
mbfl_filt_conv_wchar_sjiswin,
|
||||
mbfl_filt_conv_common_flush };
|
||||
|
||||
static struct mbfl_convert_vtbl vtbl_cp1252_wchar = {
|
||||
mbfl_no_encoding_cp1252,
|
||||
mbfl_no_encoding_wchar,
|
||||
mbfl_filt_conv_common_ctor,
|
||||
mbfl_filt_conv_common_dtor,
|
||||
mbfl_filt_conv_cp1252_wchar,
|
||||
mbfl_filt_conv_common_flush };
|
||||
|
||||
static struct mbfl_convert_vtbl vtbl_wchar_cp1252 = {
|
||||
mbfl_no_encoding_cp1252,
|
||||
mbfl_no_encoding_wchar,
|
||||
mbfl_filt_conv_common_ctor,
|
||||
mbfl_filt_conv_common_dtor,
|
||||
mbfl_filt_conv_wchar_cp1252,
|
||||
mbfl_filt_conv_common_flush };
|
||||
|
||||
|
||||
static struct mbfl_convert_vtbl vtbl_8859_1_wchar = {
|
||||
mbfl_no_encoding_8859_1,
|
||||
mbfl_no_encoding_wchar,
|
||||
@@ -1547,6 +1580,8 @@ static struct mbfl_convert_vtbl *mbfl_convert_filter_list[] = {
|
||||
&vtbl_wchar_eucjpwin,
|
||||
&vtbl_sjiswin_wchar,
|
||||
&vtbl_wchar_sjiswin,
|
||||
&vtbl_cp1252_wchar,
|
||||
&vtbl_wchar_cp1252,
|
||||
&vtbl_ascii_wchar,
|
||||
&vtbl_wchar_ascii,
|
||||
&vtbl_8859_1_wchar,
|
||||
@@ -1678,6 +1713,12 @@ static struct mbfl_identify_vtbl vtbl_identify_2022jp = {
|
||||
mbfl_filt_ident_common_dtor,
|
||||
mbfl_filt_ident_2022jp };
|
||||
|
||||
static struct mbfl_identify_vtbl vtbl_identify_cp1252 = {
|
||||
mbfl_no_encoding_cp1252,
|
||||
mbfl_filt_ident_common_ctor,
|
||||
mbfl_filt_ident_common_dtor,
|
||||
mbfl_filt_ident_cp1252 };
|
||||
|
||||
static struct mbfl_identify_vtbl vtbl_identify_8859_1 = {
|
||||
mbfl_no_encoding_8859_1,
|
||||
mbfl_filt_ident_common_ctor,
|
||||
@@ -1772,6 +1813,7 @@ static struct mbfl_identify_vtbl *mbfl_identify_filter_list[] = {
|
||||
&vtbl_identify_sjiswin,
|
||||
&vtbl_identify_jis,
|
||||
&vtbl_identify_2022jp,
|
||||
&vtbl_identify_cp1252,
|
||||
&vtbl_identify_8859_1,
|
||||
&vtbl_identify_8859_2,
|
||||
&vtbl_identify_8859_3,
|
||||
@@ -2596,7 +2638,7 @@ mbfl_filt_conv_uudec(int c, mbfl_convert_filter * filter)
|
||||
break;
|
||||
case uudec_state_skip_newline:
|
||||
/* skip newline */
|
||||
filter->status = 0;
|
||||
filter->status = uudec_state_size;
|
||||
}
|
||||
return c;
|
||||
}
|
||||
@@ -4070,6 +4112,61 @@ mbfl_filt_conv_wchar_ascii(int c, mbfl_convert_filter *filter)
|
||||
return c;
|
||||
}
|
||||
|
||||
/*
|
||||
* wchar => cp1252
|
||||
*/
|
||||
static int
|
||||
mbfl_filt_conv_wchar_cp1252(int c, mbfl_convert_filter *filter)
|
||||
{
|
||||
int s, n;
|
||||
|
||||
if (c >= 0x100) {
|
||||
/* look it up from the cp1252 table */
|
||||
s = -1;
|
||||
n = 30;
|
||||
while (n >= 0) {
|
||||
if (c == cp1252_ucs_table[n]) {
|
||||
s = 0x80 + n;
|
||||
break;
|
||||
}
|
||||
n--;
|
||||
}
|
||||
if (s <= 0 && (c & ~MBFL_WCSPLANE_MASK) == MBFL_WCSPLANE_8859_1)
|
||||
{
|
||||
s = c & MBFL_WCSPLANE_MASK;
|
||||
}
|
||||
}
|
||||
else if (c >= 0 && c < 0x100) {
|
||||
s = c;
|
||||
}
|
||||
if (s >= 0) {
|
||||
CK((*filter->output_function)(s, filter->data));
|
||||
} else {
|
||||
if (filter->illegal_mode != MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE) {
|
||||
CK(mbfl_filt_conv_illegal_output(c, filter));
|
||||
}
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
/*
|
||||
* cp1252 => wchar
|
||||
*/
|
||||
static int
|
||||
mbfl_filt_conv_cp1252_wchar(int c, mbfl_convert_filter *filter)
|
||||
{
|
||||
int s;
|
||||
|
||||
if (c >= 0x80 && c < 0xa0) {
|
||||
s = cp1252_ucs_table[c - 0x80];
|
||||
} else {
|
||||
s = c;
|
||||
}
|
||||
|
||||
CK((*filter->output_function)(s, filter->data));
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
/*
|
||||
* wchar => ISO-8859-1
|
||||
@@ -5194,6 +5291,22 @@ retry:
|
||||
return c;
|
||||
}
|
||||
|
||||
/* We only distinguish the MS extensions to ISO-8859-1.
|
||||
* Actually, this is pretty much a NO-OP, since the identification
|
||||
* system doesn't allow us to discriminate between a positive match,
|
||||
* a possible match and a definite non-match.
|
||||
* The problem here is that cp1252 looks like SJIS for certain chars.
|
||||
* */
|
||||
static int
|
||||
mbfl_filt_ident_cp1252(int c, mbfl_identify_filter *filter)
|
||||
{
|
||||
if (c >= 0x80 && c < 0xa0)
|
||||
filter->flag = 0;
|
||||
else
|
||||
filter->flag = 1; /* not it */
|
||||
return c;
|
||||
}
|
||||
|
||||
static int
|
||||
mbfl_filt_ident_2022jp(int c, mbfl_identify_filter *filter)
|
||||
{
|
||||
@@ -6948,10 +7061,10 @@ mbfl_strimwidth(
|
||||
n = string->len;
|
||||
if (p != NULL) {
|
||||
while (n > 0) {
|
||||
n--;
|
||||
if ((*encoder->filter_function)(*p++, encoder) < 0) {
|
||||
break;
|
||||
}
|
||||
n--;
|
||||
}
|
||||
mbfl_convert_filter_flush(encoder);
|
||||
if (pc.status != 0 && mkwidth > 0) {
|
||||
@@ -8146,6 +8259,20 @@ mbfl_html_numeric_entity(
|
||||
/*
|
||||
* Unicode table
|
||||
*/
|
||||
|
||||
|
||||
/* Windows CodePage 1252 - it's the same as iso-8859-1 but
|
||||
* defines extra symbols in the range 0x80-0x9f.
|
||||
* This table differs from the rest of the unicode tables below
|
||||
* as it only covers this range, while the rest cover 0xa0 onwards */
|
||||
static const unsigned short cp1252_ucs_table[] = {
|
||||
0xfffe,0xfffe,0x201a,0x0192,0x201e,0x2026,0x2020,0x2021,
|
||||
0x02c6,0x2030,0x0160,0x2039,0x0152,0xfffe,0xfffe,0xfffe,
|
||||
0xfffe,0x2018,0x2019,0x201c,0x201d,0x2022,0x2013,0x02dc,
|
||||
0x2122,0x0161,0x203a,0x0153,0xfffe,0xfffe,0x0178
|
||||
};
|
||||
|
||||
|
||||
static const unsigned short iso8859_2_ucs_table[] = {
|
||||
0x00A0,0x0104,0x02D8,0x0141,0x00A4,0x013D,0x015A,0x00A7,
|
||||
0x00A8,0x0160,0x015E,0x0164,0x0179,0x00AD,0x017D,0x017B,
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
/* charset=UTF-8 */
|
||||
/* charset=UTF-8
|
||||
* vim: encoding=utf-8:
|
||||
* */
|
||||
|
||||
/*
|
||||
* "streamable kanji code filter and converter"
|
||||
@@ -151,6 +153,7 @@ enum mbfl_no_encoding {
|
||||
mbfl_no_encoding_sjis_mac,
|
||||
mbfl_no_encoding_jis,
|
||||
mbfl_no_encoding_2022jp,
|
||||
mbfl_no_encoding_cp1252,
|
||||
mbfl_no_encoding_8859_1,
|
||||
mbfl_no_encoding_8859_2,
|
||||
mbfl_no_encoding_8859_3,
|
||||
@@ -230,7 +233,6 @@ typedef struct _mbfl_encoding {
|
||||
#define MBFL_WCSPLANE_8859_15 0x70f00000 /* 00h - FFh */
|
||||
#define MBFL_WCSPLANE_KSC5601 0x70f10000 /* 2121h - 7E7Eh */
|
||||
#define MBFL_WCSPLANE_GB2312 0x70f20000 /* 2121h - 7E7Eh */
|
||||
|
||||
#define MBFL_WCSGROUP_MASK 0xffffff
|
||||
#define MBFL_WCSGROUP_UCS4MAX 0x70000000
|
||||
#define MBFL_WCSGROUP_WCHARMAX 0x78000000
|
||||
|
||||
@@ -921,7 +921,7 @@ php_mbstr_encoding_handler(zval *arg, char *res, char *separator TSRMLS_DC)
|
||||
|
||||
}
|
||||
|
||||
#if !defined(COMPILE_DL_MBSTRING)
|
||||
#if defined(MBSTR_ENC_TRANS)
|
||||
SAPI_POST_HANDLER_FUNC(php_mbstr_post_handler)
|
||||
{
|
||||
MBSTRG(http_input_identify_post) = mbfl_no_encoding_invalid;
|
||||
|
||||
+27
-14
@@ -35,6 +35,8 @@
|
||||
#include "php_globals.h"
|
||||
#include "ext/standard/info.h"
|
||||
|
||||
static int le_mcrypt;
|
||||
|
||||
|
||||
function_entry mcrypt_functions[] = {
|
||||
PHP_FE(mcrypt_ecb, NULL)
|
||||
@@ -196,7 +198,7 @@ ZEND_GET_MODULE(mcrypt)
|
||||
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &mcryptind) == FAILURE) { \
|
||||
WRONG_PARAM_COUNT \
|
||||
} \
|
||||
ZEND_FETCH_RESOURCE (td, MCRYPT, mcryptind, -1, "MCrypt", MCG(le_h));
|
||||
ZEND_FETCH_RESOURCE (td, MCRYPT, mcryptind, -1, "MCrypt", le_mcrypt);
|
||||
|
||||
#define MCRYPT_GET_MODE_DIR_ARGS(DIRECTORY) \
|
||||
switch (argc) { \
|
||||
@@ -244,12 +246,22 @@ PHP_INI_BEGIN()
|
||||
PHP_INI_END()
|
||||
#endif
|
||||
|
||||
static void php_mcrypt_module_dtor(zend_rsrc_list_entry *rsrc)
|
||||
{
|
||||
MCRYPT td = (MCRYPT) rsrc->ptr;
|
||||
mcrypt_module_close (td);
|
||||
}
|
||||
|
||||
|
||||
static PHP_MINIT_FUNCTION(mcrypt)
|
||||
{
|
||||
#if defined(ZTS) && defined(HAVE_LIBMCRYPT24)
|
||||
ZEND_INIT_MODULE_GLOBALS(mcrypt, NULL, NULL);
|
||||
Z_TYPE(mcrypt_module_entry) = type;
|
||||
#endif
|
||||
|
||||
le_mcrypt = zend_register_list_destructors_ex(php_mcrypt_module_dtor, NULL, "mcrypt", module_number);
|
||||
|
||||
/* modes for mcrypt_??? routines */
|
||||
REGISTER_LONG_CONSTANT("MCRYPT_ENCRYPT", 0, CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("MCRYPT_DECRYPT", 1, CONST_PERSISTENT);
|
||||
@@ -427,7 +439,7 @@ PHP_FUNCTION(mcrypt_module_open)
|
||||
php_error (E_WARNING, "could not open encryption module");
|
||||
RETURN_FALSE;
|
||||
} else {
|
||||
ZEND_REGISTER_RESOURCE (return_value, td, MCG(le_h));
|
||||
ZEND_REGISTER_RESOURCE (return_value, td, le_mcrypt);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@@ -449,13 +461,18 @@ PHP_FUNCTION(mcrypt_generic_init)
|
||||
MCRYPT_CHECK_PARAM_COUNT (3,3)
|
||||
|
||||
zend_get_parameters_ex(3, &mcryptind, &key, &iv);
|
||||
ZEND_FETCH_RESOURCE (td, MCRYPT, mcryptind, -1, "MCrypt", MCG(le_h));
|
||||
ZEND_FETCH_RESOURCE (td, MCRYPT, mcryptind, -1, "MCrypt", le_mcrypt);
|
||||
convert_to_string_ex (key);
|
||||
convert_to_string_ex (iv);
|
||||
|
||||
max_key_size = mcrypt_enc_get_key_size (td);
|
||||
iv_size = mcrypt_enc_get_iv_size (td);
|
||||
|
||||
if (Z_STRLEN_PP(key) == 0) {
|
||||
php_error (E_WARNING, "key size is 0");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
key_s = emalloc (Z_STRLEN_PP(key));
|
||||
memset (key_s, 0, Z_STRLEN_PP(key));
|
||||
|
||||
@@ -500,7 +517,7 @@ PHP_FUNCTION(mcrypt_generic)
|
||||
MCRYPT_CHECK_PARAM_COUNT (2,2)
|
||||
|
||||
zend_get_parameters_ex(2, &mcryptind, &data);
|
||||
ZEND_FETCH_RESOURCE (td, MCRYPT, mcryptind, -1, "MCrypt", MCG(le_h));
|
||||
ZEND_FETCH_RESOURCE (td, MCRYPT, mcryptind, -1, "MCrypt", le_mcrypt);
|
||||
convert_to_string_ex (data);
|
||||
|
||||
/* Check blocksize */
|
||||
@@ -540,7 +557,7 @@ PHP_FUNCTION(mdecrypt_generic)
|
||||
MCRYPT_CHECK_PARAM_COUNT (2,2)
|
||||
|
||||
zend_get_parameters_ex(2, &mcryptind, &data);
|
||||
ZEND_FETCH_RESOURCE (td, MCRYPT, mcryptind, -1, "MCrypt", MCG(le_h));
|
||||
ZEND_FETCH_RESOURCE (td, MCRYPT, mcryptind, -1, "MCrypt", le_mcrypt);
|
||||
convert_to_string_ex (data);
|
||||
|
||||
/* Check blocksize */
|
||||
@@ -607,7 +624,8 @@ PHP_FUNCTION(mcrypt_enc_self_test)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ proto bool mcrypt_module_close(resource td)
|
||||
Free the descriptor td */
|
||||
PHP_FUNCTION(mcrypt_module_close)
|
||||
{
|
||||
zval **mcryptind;
|
||||
@@ -615,15 +633,10 @@ PHP_FUNCTION(mcrypt_module_close)
|
||||
|
||||
MCRYPT_GET_TD_ARG
|
||||
|
||||
if (mcrypt_module_close (td) < 0) {
|
||||
php_error (E_WARNING, "could not close module");
|
||||
RETURN_FALSE
|
||||
} else {
|
||||
zend_list_delete (Z_LVAL_PP(mcryptind));
|
||||
RETURN_TRUE
|
||||
}
|
||||
zend_list_delete (Z_LVAL_PP(mcryptind));
|
||||
RETURN_TRUE;
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
|
||||
/* {{{ proto bool mcrypt_generic_end(resource td)
|
||||
This function terminates encrypt specified by the descriptor td */
|
||||
|
||||
@@ -61,7 +61,6 @@ PHP_FUNCTION(mcrypt_module_get_supported_key_sizes);
|
||||
PHP_FUNCTION(mcrypt_module_close);
|
||||
|
||||
ZEND_BEGIN_MODULE_GLOBALS(mcrypt)
|
||||
int le_h;
|
||||
char *modes_dir;
|
||||
char *algorithms_dir;
|
||||
ZEND_END_MODULE_GLOBALS(mcrypt)
|
||||
|
||||
+1
-2
@@ -849,11 +849,10 @@ PHP_FUNCTION(msql_result)
|
||||
return_value->value.str.len = (sql_row[field_offset]?strlen(sql_row[field_offset]):0);
|
||||
return_value->value.str.val = (char *) safe_estrndup(sql_row[field_offset],return_value->value.str.len);
|
||||
}
|
||||
return_value->type = IS_STRING;
|
||||
} else {
|
||||
ZVAL_FALSE(return_value);
|
||||
}
|
||||
|
||||
return_value->type = IS_STRING;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
+3
-3
@@ -5,11 +5,11 @@ AC_DEFUN(AC_OCI8_VERSION,[
|
||||
if test -s "$OCI8_DIR/orainst/unix.rgs"; then
|
||||
OCI8_VERSION=`grep '"ocommon"' $OCI8_DIR/orainst/unix.rgs | sed 's/[ ][ ]*/:/g' | cut -d: -f 6 | cut -c 2-4`
|
||||
test -z "$OCI8_VERSION" && OCI8_VERSION=7.3
|
||||
elif test -f $OCI8_DIR/lib/libclntsh.s?.9.0; then
|
||||
elif test -f $OCI8_DIR/lib/libclntsh.$SHLIB_SUFFIX_NAME.9.0; then
|
||||
OCI8_VERSION=9.0
|
||||
elif test -f $OCI8_DIR/lib/libclntsh.s?.8.0; then
|
||||
elif test -f $OCI8_DIR/lib/libclntsh.$SHLIB_SUFFIX_NAME.8.0; then
|
||||
OCI8_VERSION=8.1
|
||||
elif test -f $OCI8_DIR/lib/libclntsh.s?.1.0; then
|
||||
elif test -f $OCI8_DIR/lib/libclntsh.$SHLIB_SUFFIX_NAME.1.0; then
|
||||
OCI8_VERSION=8.0
|
||||
elif test -f $OCI8_DIR/lib/libclntsh.a; then
|
||||
if test -f $OCI8_DIR/lib/libcore4.a; then
|
||||
|
||||
+872
-640
File diff suppressed because it is too large.
Load diff
@@ -1284,7 +1284,8 @@ PHP_FUNCTION(openssl_pkcs7_encrypt)
|
||||
X509 * cert;
|
||||
int argc;
|
||||
EVP_CIPHER *cipher = NULL;
|
||||
ulong strindexlen, intindex;
|
||||
uint strindexlen;
|
||||
ulong intindex;
|
||||
char * strindex;
|
||||
|
||||
argc = ZEND_NUM_ARGS();
|
||||
@@ -1419,7 +1420,8 @@ PHP_FUNCTION(openssl_pkcs7_sign)
|
||||
BIO * infile = NULL, * outfile = NULL;
|
||||
STACK_OF(X509) *others = NULL;
|
||||
long certresource = -1, keyresource = -1;
|
||||
ulong strindexlen, intindex;
|
||||
ulong intindex;
|
||||
uint strindexlen;
|
||||
HashPosition hpos;
|
||||
char * strindex;
|
||||
|
||||
|
||||
@@ -5,9 +5,9 @@ AC_DEFUN(AC_ORACLE_VERSION,[
|
||||
if test -s "$ORACLE_DIR/orainst/unix.rgs"; then
|
||||
ORACLE_VERSION=`grep '"ocommon"' $ORACLE_DIR/orainst/unix.rgs | sed 's/[ ][ ]*/:/g' | cut -d: -f 6 | cut -c 2-4`
|
||||
test -z "$ORACLE_VERSION" && ORACLE_VERSION=7.3
|
||||
elif test -f $ORACLE_DIR/lib/libclntsh.s?.8.0; then
|
||||
elif test -f $ORACLE_DIR/lib/libclntsh.$SHLIB_SUFFIX_NAME.8.0; then
|
||||
ORACLE_VERSION=8.1
|
||||
elif test -f $ORACLE_DIR/lib/libclntsh.s?.1.0; then
|
||||
elif test -f $ORACLE_DIR/lib/libclntsh.$SHLIB_SUFFIX_NAME.1.0; then
|
||||
ORACLE_VERSION=8.0
|
||||
elif test -f $ORACLE_DIR/lib/libclntsh.a; then
|
||||
if test -f $ORACLE_DIR/lib/libcore4.a; then
|
||||
@@ -56,7 +56,7 @@ if test "$PHP_ORACLE" != "no"; then
|
||||
AC_ORACLE_VERSION($ORACLE_DIR)
|
||||
case $ORACLE_VERSION in
|
||||
7.0|7.1)
|
||||
if test -f $ORACLE_DIR/lib/liboracle.s?; then
|
||||
if test -f $ORACLE_DIR/lib/liboracle.$SHLIB_SUFFIX_NAME; then
|
||||
PHP_ADD_LIBRARY_WITH_PATH(oracle, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
|
||||
else
|
||||
PHP_ADD_LIBRARY_WITH_PATH(core, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
|
||||
@@ -85,7 +85,7 @@ if test "$PHP_ORACLE" != "no"; then
|
||||
;;
|
||||
|
||||
7.2)
|
||||
if test -f $ORACLE_DIR/lib/libclntsh.s?; then
|
||||
if test -f $ORACLE_DIR/lib/libclntsh.$SHLIB_SUFFIX_NAME; then
|
||||
PHP_ADD_LIBRARY_WITH_PATH(clntsh, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
|
||||
else
|
||||
PHP_ADD_LIBRARY_WITH_PATH(core3, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
|
||||
@@ -106,7 +106,7 @@ if test "$PHP_ORACLE" != "no"; then
|
||||
;;
|
||||
|
||||
7.3)
|
||||
if test -f $ORACLE_DIR/lib/libclntsh.s?; then
|
||||
if test -f $ORACLE_DIR/lib/libclntsh.$SHLIB_SUFFIX_NAME; then
|
||||
PHP_ADD_LIBRARY_WITH_PATH(clntsh, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
|
||||
else
|
||||
PHP_ADD_LIBRARY_WITH_PATH(core3, $ORACLE_DIR/lib, ORACLE_SHARED_LIBADD)
|
||||
|
||||
@@ -64,7 +64,7 @@ typedef struct {
|
||||
} php_pfpro_globals;
|
||||
|
||||
#ifdef ZTS
|
||||
#define PFPROG(v) TSRMG(gd_pfpro_id, php_pfpro_globals *, v)
|
||||
#define PFPROG(v) TSRMG(pfpro_globals_id, php_pfpro_globals *, v)
|
||||
#else
|
||||
#define PFPROG(v) (pfpro_globals.v)
|
||||
#endif
|
||||
|
||||
+11
-11
@@ -160,25 +160,22 @@ static void _close_pgsql_plink(zend_rsrc_list_entry *rsrc TSRMLS_DC)
|
||||
PQfinish(link);
|
||||
PGG(num_persistent)--;
|
||||
PGG(num_links)--;
|
||||
if(PGG(last_notice) != NULL) {
|
||||
efree(PGG(last_notice));
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ _notice_handler
|
||||
*/
|
||||
static void
|
||||
_notice_handler(void *arg, const char *message)
|
||||
static void _notice_handler(void *arg, const char *message)
|
||||
{
|
||||
TSRMLS_FETCH();
|
||||
|
||||
if (! PGG(ignore_notices)) {
|
||||
php_log_err((char *) message TSRMLS_CC);
|
||||
if (PGG(last_notice) != NULL) {
|
||||
if (PGG(last_notice)) {
|
||||
efree(PGG(last_notice));
|
||||
}
|
||||
PGG(last_notice) = estrdup(message);
|
||||
PGG(last_notice_len) = strlen(message);
|
||||
PGG(last_notice) = estrndup(message, PGG(last_notice_len));
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@@ -237,7 +234,6 @@ static void php_pgsql_init_globals(php_pgsql_globals *pgsql_globals_p TSRMLS_DC)
|
||||
{
|
||||
PGG(num_persistent) = 0;
|
||||
PGG(ignore_notices) = 0;
|
||||
PGG(last_notice) = NULL;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -283,6 +279,7 @@ PHP_RINIT_FUNCTION(pgsql)
|
||||
{
|
||||
PGG(default_link)=-1;
|
||||
PGG(num_links) = PGG(num_persistent);
|
||||
PGG(last_notice) = NULL;
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -291,6 +288,9 @@ PHP_RINIT_FUNCTION(pgsql)
|
||||
*/
|
||||
PHP_RSHUTDOWN_FUNCTION(pgsql)
|
||||
{
|
||||
if (PGG(last_notice)) {
|
||||
efree(PGG(last_notice));
|
||||
}
|
||||
zend_hash_apply(&EG(persistent_list), (apply_func_t) _rollback_transactions TSRMLS_CC);
|
||||
return SUCCESS;
|
||||
}
|
||||
@@ -923,10 +923,10 @@ PHP_FUNCTION(pg_cmdtuples)
|
||||
Returns the last notice set by the backend */
|
||||
PHP_FUNCTION(pg_last_notice)
|
||||
{
|
||||
if (PGG(last_notice) == NULL) {
|
||||
RETURN_FALSE;
|
||||
if (PGG(last_notice)) {
|
||||
RETURN_STRINGL(PGG(last_notice), PGG(last_notice_len), 0);
|
||||
} else {
|
||||
RETURN_STRING(PGG(last_notice),0);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -123,6 +123,7 @@ typedef struct {
|
||||
int le_lofp,le_string;
|
||||
int ignore_notices;
|
||||
char *last_notice;
|
||||
uint last_notice_len;
|
||||
} php_pgsql_globals;
|
||||
|
||||
|
||||
|
||||
@@ -9,6 +9,12 @@ PHP_ARG_WITH(readline,for readline support,
|
||||
[ --with-readline[=DIR] Include readline support. DIR is the readline
|
||||
install directory.])
|
||||
|
||||
if test "$PHP_READLINE" != "no" -o "$PHP_LIBEDIT" != "no"; then
|
||||
if test "$PHP_SAPI" != "cgi"; then
|
||||
AC_MSG_ERROR([readline extension can only be used with CGI build!])
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$PHP_READLINE" != "no"; then
|
||||
for i in /usr/local /usr $PHP_READLINE; do
|
||||
if test -f $i/include/readline/readline.h; then
|
||||
|
||||
@@ -26,10 +26,6 @@
|
||||
#warning Readline module will *NEVER* be thread-safe
|
||||
#endif
|
||||
|
||||
#ifndef CGI_BINARY
|
||||
#error Readline module only useable in standalone-binary
|
||||
#endif
|
||||
|
||||
extern zend_module_entry readline_module_entry;
|
||||
#define phpext_readline_ptr &readline_module_entry
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ static zend_function_entry php_readline_functions[] = {
|
||||
PHP_FE(readline_info, NULL)
|
||||
PHP_FE(readline_add_history, NULL)
|
||||
PHP_FE(readline_clear_history, NULL)
|
||||
#ifdef HAVE_READLINE
|
||||
#ifdef HAVE_LIBREADLINE
|
||||
PHP_FE(readline_list_history, NULL)
|
||||
#else
|
||||
PHP_FALIAS(readline_list_history, warn_not_available, NULL)
|
||||
@@ -147,7 +147,7 @@ PHP_FUNCTION(readline_info)
|
||||
add_assoc_string(return_value,"line_buffer",SAFE_STRING(rl_line_buffer),1);
|
||||
add_assoc_long(return_value,"point",rl_point);
|
||||
add_assoc_long(return_value,"end",rl_end);
|
||||
#ifdef HAVE_READLINE
|
||||
#ifdef HAVE_LIBREADLINE
|
||||
add_assoc_long(return_value,"mark",rl_mark);
|
||||
add_assoc_long(return_value,"done",rl_done);
|
||||
add_assoc_long(return_value,"pending_input",rl_pending_input);
|
||||
@@ -174,7 +174,7 @@ PHP_FUNCTION(readline_info)
|
||||
RETVAL_LONG(rl_point);
|
||||
} else if (! strcasecmp((*what)->value.str.val,"end")) {
|
||||
RETVAL_LONG(rl_end);
|
||||
#ifdef HAVE_READLINE
|
||||
#ifdef HAVE_LIBREADLINE
|
||||
} else if (! strcasecmp((*what)->value.str.val,"mark")) {
|
||||
RETVAL_LONG(rl_mark);
|
||||
} else if (! strcasecmp((*what)->value.str.val,"done")) {
|
||||
@@ -256,7 +256,7 @@ PHP_FUNCTION(readline_clear_history)
|
||||
/* }}} */
|
||||
/* {{{ proto array readline_list_history(void)
|
||||
Lists the history */
|
||||
#ifdef HAVE_READLINE
|
||||
#ifdef HAVE_LIBREADLINE
|
||||
PHP_FUNCTION(readline_list_history)
|
||||
{
|
||||
HIST_ENTRY **history;
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
1) Multi-dimenstional array support
|
||||
2) IErrorInfo
|
||||
3) WithEvents
|
||||
4) Documentation (internal and user) and howtos
|
||||
5) IEnumVariant::All() which would be like IEnumVariant::Next(IDispatch::Count)
|
||||
6) Look for memory leaks and AdRef/Release problems - I KNOW there are some...
|
||||
7) Test component (goes with the docs)
|
||||
8) Test suite (Needs test component)
|
||||
9) reduce the need for VARIANT()
|
||||
10) lets try if we are able to call non IDispatch - only Typelib components
|
||||
11) IEnumVariant::Next() without parameter should only return an object, not an array with one element
|
||||
|
||||
|
||||
these seem to be done:
|
||||
|
||||
2) 6) 11)
|
||||
@@ -437,7 +437,7 @@ PHP_INI_ENTRY("com.typelib_file", "", PHP_INI_SYSTEM, OnTypelibFileChange)
|
||||
PHP_INI_END()
|
||||
|
||||
|
||||
/* {{{ proto int com_load(string module_name [, string remote_host [, int codepage[, string typelib]]])
|
||||
/* {{{ proto int com_load(string module_name [, string remote_host [, int codepage [, string typelib]]])
|
||||
Loads a COM module */
|
||||
PHP_FUNCTION(com_load)
|
||||
{
|
||||
@@ -511,6 +511,12 @@ PHP_FUNCTION(com_load)
|
||||
/* @todo if (server_name) */
|
||||
|
||||
if (!server_name) {
|
||||
/* @todo shouldn't the bind context be fetched on module startup and kept as a global shared instance ?
|
||||
* all calls to BindToObject would deliver the same instance then (as desired)
|
||||
* IBindCtx::RegisterObjectBound() should be called then after mkparsedisplayname()
|
||||
*
|
||||
* @todo use mkparsedisplaynameex() ?
|
||||
*/
|
||||
if (SUCCEEDED(hr = CreateBindCtx(0, &pBindCtx))) {
|
||||
if (SUCCEEDED(hr = MkParseDisplayName(pBindCtx, ProgID, &ulEaten, &pMoniker))) {
|
||||
hr = pMoniker->lpVtbl->BindToObject(pMoniker, pBindCtx, NULL, &IID_IDispatch, (LPVOID *) &C_DISPATCH(obj));
|
||||
@@ -548,7 +554,7 @@ PHP_FUNCTION(com_load)
|
||||
pResults.pIID = &IID_IDispatch;
|
||||
pResults.pItf = NULL;
|
||||
pResults.hr = S_OK;
|
||||
hr=CoCreateInstanceEx(&clsid, NULL, CLSCTX_SERVER, &server_info, 1, &pResults);
|
||||
hr=CoCreateInstanceEx(&clsid, NULL, CLSCTX_REMOTE_SERVER, &server_info, 1, &pResults);
|
||||
if (SUCCEEDED(hr)) {
|
||||
hr = pResults.hr;
|
||||
C_DISPATCH(obj) = (IDispatch *) pResults.pItf;
|
||||
@@ -742,7 +748,11 @@ int do_COM_invoke(comval *obj, pval *function_name, VARIANT *var_result, pval **
|
||||
|
||||
efree(funcname);
|
||||
for (current_arg=0;current_arg<arg_count;current_arg++) {
|
||||
VariantClear(&variant_args[current_arg]);
|
||||
/* don't release IDispatch pointers as they are used afterwards */
|
||||
if (V_VT(&variant_args[current_arg]) != VT_DISPATCH) {
|
||||
/* @todo review this: what happens to an array of IDispatchs or a VARIANT->IDispatch */
|
||||
VariantClear(&variant_args[current_arg]);
|
||||
}
|
||||
}
|
||||
efree(variant_args);
|
||||
|
||||
@@ -804,9 +814,8 @@ PHP_FUNCTION(com_invoke)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
php_variant_to_pval(var_result, return_value, codepage TSRMLS_CC);
|
||||
RETVAL_VARIANT(var_result);
|
||||
|
||||
FREE_VARIANT(var_result);
|
||||
efree(arguments);
|
||||
}
|
||||
/* }}} */
|
||||
@@ -1049,9 +1058,7 @@ PHP_FUNCTION(com_propget)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
php_variant_to_pval(var_result, return_value, codepage TSRMLS_CC);
|
||||
|
||||
FREE_VARIANT(var_result);
|
||||
RETVAL_VARIANT(var_result);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1082,7 +1089,8 @@ PHP_FUNCTION(com_propput)
|
||||
/* }}} */
|
||||
|
||||
|
||||
/* {{{ proto bool com_load_typelib(string typelib_name[, int case_insensitiv]) */
|
||||
/* {{{ proto bool com_load_typelib(string typelib_name [, int case_insensitiv])
|
||||
Loads a Typelib */
|
||||
PHP_FUNCTION(com_load_typelib)
|
||||
{
|
||||
pval *arg_typelib, *arg_cis;
|
||||
@@ -1200,6 +1208,10 @@ PHPAPI pval php_COM_get_property_handler(zend_property_reference *property_refer
|
||||
pval_destructor(&overloaded_property->element);
|
||||
}
|
||||
|
||||
if (obj_prop != NULL) {
|
||||
RETVAL_COM(obj);
|
||||
}
|
||||
|
||||
FREE_VARIANT(var_result);
|
||||
|
||||
return return_value;
|
||||
|
||||
+22
-17
@@ -86,7 +86,7 @@ PHPAPI void php_pval_to_variant(pval *pval_arg, VARIANT *var_arg, int codepage T
|
||||
}
|
||||
|
||||
if (pval_arg->is_ref) { /* deprecated, implemented for downwards compatiblity */
|
||||
type |= VT_BYREF;
|
||||
// type |= VT_BYREF;
|
||||
}
|
||||
|
||||
pval_to_variant_ex(pval_arg, var_arg, type, codepage TSRMLS_CC);
|
||||
@@ -452,11 +452,11 @@ PHPAPI int php_variant_to_pval(VARIANT *var_arg, pval *pval_arg, int codepage TS
|
||||
ZVAL_NULL(pval_arg);
|
||||
return FAILURE;
|
||||
}
|
||||
SafeArrayLock( array);
|
||||
SafeArrayLock(array);
|
||||
|
||||
/* This call has failed for everything I have tried */
|
||||
/* But best leave it to be on the safe side */
|
||||
if (FAILED(SafeArrayGetVartype(array, &vartype))) {
|
||||
if (FAILED(SafeArrayGetVartype(array, &vartype)) || (vartype == VT_EMPTY)) {
|
||||
/* Fall back to what we do know */
|
||||
/* Mask off the array bit and assume */
|
||||
/* what is left is the type of the array */
|
||||
@@ -519,9 +519,9 @@ PHPAPI int php_variant_to_pval(VARIANT *var_arg, pval *pval_arg, int codepage TS
|
||||
|
||||
case VT_UI1:
|
||||
if (V_ISBYREF(var_arg)) {
|
||||
ZVAL_LONG(pval_arg, (long)*V_UI4REF(var_arg));
|
||||
ZVAL_LONG(pval_arg, (long)*V_UI1REF(var_arg));
|
||||
} else {
|
||||
ZVAL_LONG(pval_arg, (long)V_UI4(var_arg));
|
||||
ZVAL_LONG(pval_arg, (long)V_UI1(var_arg));
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -614,27 +614,32 @@ PHPAPI int php_variant_to_pval(VARIANT *var_arg, pval *pval_arg, int codepage TS
|
||||
break;
|
||||
|
||||
case VT_DATE: {
|
||||
BOOL success;
|
||||
SYSTEMTIME wintime;
|
||||
struct tm phptime;
|
||||
|
||||
if (V_ISBYREF(var_arg)) {
|
||||
VariantTimeToSystemTime(*V_DATEREF(var_arg), &wintime);
|
||||
success = VariantTimeToSystemTime(*V_DATEREF(var_arg), &wintime);
|
||||
} else {
|
||||
VariantTimeToSystemTime(V_DATE(var_arg), &wintime);
|
||||
success = VariantTimeToSystemTime(V_DATE(var_arg), &wintime);
|
||||
}
|
||||
|
||||
memset(&phptime, 0, sizeof(phptime));
|
||||
if (success) {
|
||||
memset(&phptime, 0, sizeof(phptime));
|
||||
|
||||
phptime.tm_year = wintime.wYear - 1900;
|
||||
phptime.tm_mon = wintime.wMonth - 1;
|
||||
phptime.tm_mday = wintime.wDay;
|
||||
phptime.tm_hour = wintime.wHour;
|
||||
phptime.tm_min = wintime.wMinute;
|
||||
phptime.tm_sec = wintime.wSecond;
|
||||
phptime.tm_isdst = -1;
|
||||
phptime.tm_year = wintime.wYear - 1900;
|
||||
phptime.tm_mon = wintime.wMonth - 1;
|
||||
phptime.tm_mday = wintime.wDay;
|
||||
phptime.tm_hour = wintime.wHour;
|
||||
phptime.tm_min = wintime.wMinute;
|
||||
phptime.tm_sec = wintime.wSecond;
|
||||
phptime.tm_isdst = -1;
|
||||
|
||||
tzset();
|
||||
ZVAL_LONG(pval_arg, mktime(&phptime));
|
||||
tzset();
|
||||
ZVAL_LONG(pval_arg, mktime(&phptime));
|
||||
} else {
|
||||
ret = FAILURE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@@ -185,10 +185,10 @@ static pval php_VARIANT_get_property_handler(zend_property_reference *property_r
|
||||
{
|
||||
zend_overloaded_element *overloaded_property;
|
||||
int type;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
pval result, **var_handle, *object = property_reference->object;
|
||||
VARIANT *var_arg;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
|
||||
/* fetch the VARIANT structure */
|
||||
zend_hash_index_find(Z_OBJPROP_P(object), 0, (void **) &var_handle);
|
||||
@@ -230,10 +230,10 @@ static int php_VARIANT_set_property_handler(zend_property_reference *property_re
|
||||
{
|
||||
zend_overloaded_element *overloaded_property;
|
||||
int type;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
pval **var_handle, *object = property_reference->object;
|
||||
VARIANT *var_arg;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
|
||||
/* fetch the VARIANT structure */
|
||||
zend_hash_index_find(Z_OBJPROP_P(object), 0, (void **) &var_handle);
|
||||
|
||||
+17
-2
@@ -3,15 +3,30 @@
|
||||
|
||||
#if PHP_WIN32
|
||||
|
||||
#define ALLOC_VARIANT(v) (v) = (VARIANT *) emalloc(sizeof(VARIANT)); \
|
||||
#define ALLOC_VARIANT(v) (v) = (VARIANT *) emalloc(sizeof(VARIANT)); \
|
||||
VariantInit(v);
|
||||
|
||||
#define FREE_VARIANT(v) VariantClear(v); \
|
||||
#define FREE_VARIANT(v) VariantClear(v); \
|
||||
efree(v);
|
||||
|
||||
|
||||
#define IS_VARIANT php_VARIANT_get_le_variant()
|
||||
|
||||
#define ZVAL_VARIANT(z, v) if (V_VT(v) == VT_DISPATCH) { \
|
||||
comval *obj; \
|
||||
ALLOC_COM(obj); \
|
||||
php_COM_set(obj, &V_DISPATCH(v), TRUE TSRMLS_CC); \
|
||||
ZVAL_LONG((z), zend_list_insert(obj, IS_COM)); \
|
||||
} else { \
|
||||
php_variant_to_pval((v), (z), codepage TSRMLS_CC); \
|
||||
FREE_VARIANT(v); \
|
||||
}
|
||||
|
||||
#define RETVAL_VARIANT(v) ZVAL_VARIANT(return_value, (v));
|
||||
#define RETURN_VARIANT(v) RETVAL_VARIANT(v) \
|
||||
return;
|
||||
|
||||
|
||||
#endif /* PHP_WIN32 */
|
||||
|
||||
#endif /* VARIANT_H */
|
||||
@@ -32,7 +32,7 @@ if test "$PHP_SABLOT" != "no"; then
|
||||
|
||||
testval=no
|
||||
for i in $PHP_EXPAT_DIR $SABLOT_DIR; do
|
||||
if test -f $i/lib/libexpat.a -o -f $i/lib/libexpat.s?; then
|
||||
if test -f $i/lib/libexpat.a" -o -f "$i/lib/libexpat.$SHLIB_SUFFIX_NAME; then
|
||||
AC_DEFINE(HAVE_LIBEXPAT2,1,[ ])
|
||||
PHP_ADD_LIBRARY_WITH_PATH(expat, $i/lib, SABLOT_SHARED_LIBADD)
|
||||
PHP_ADD_INCLUDE($i/include)
|
||||
@@ -52,14 +52,12 @@ if test "$PHP_SABLOT" != "no"; then
|
||||
found_iconv=no
|
||||
AC_CHECK_LIB(c, iconv_open, found_iconv=yes)
|
||||
if test "$found_iconv" = "no"; then
|
||||
if test "$PHP_ICONV" = "no"; then
|
||||
for i in /usr /usr/local; do
|
||||
if test -f $i/lib/libconv.a -o -f $i/lib/libiconv.s?; then
|
||||
PHP_ADD_LIBRARY_WITH_PATH(iconv, $i/lib)
|
||||
for i in /usr /usr/local $ICONV_DIR; do
|
||||
if test -f $i/lib/libconv.a -o -f $i/lib/libiconv.$SHLIB_SUFFIX_NAME; then
|
||||
PHP_ADD_LIBRARY_WITH_PATH(iconv, $i/lib, SABLOT_SHARED_LIBADD)
|
||||
found_iconv=yes
|
||||
fi
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$found_iconv" = "no"; then
|
||||
|
||||
@@ -174,7 +174,7 @@ int php_session_register_serializer(const char *name,
|
||||
|
||||
#define PS_ENCODE_VARS \
|
||||
char *key; \
|
||||
ulong key_length; \
|
||||
uint key_length; \
|
||||
ulong num_key; \
|
||||
zval **struc;
|
||||
|
||||
|
||||
@@ -529,7 +529,7 @@ static void php_session_save_current_state(TSRMLS_D)
|
||||
int vallen;
|
||||
int ret = FAILURE;
|
||||
char *variable;
|
||||
ulong variable_len;
|
||||
uint variable_len;
|
||||
ulong num_key;
|
||||
HashPosition pos;
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ typedef struct {
|
||||
} php_shmop_globals;
|
||||
|
||||
#ifdef ZTS
|
||||
#define SHMOPG(v) TSRMG(gd_shmop_id, php_shmop_globals *, v)
|
||||
#define SHMOPG(v) TSRMG(shmop_globals_id, php_shmop_globals *, v)
|
||||
#else
|
||||
#define SHMOPG(v) (shmop_globals.v)
|
||||
#endif
|
||||
|
||||
@@ -131,17 +131,15 @@ PHP_MINFO_FUNCTION(extname)
|
||||
Return a string to confirm that the module is compiled in */
|
||||
PHP_FUNCTION(confirm_extname_compiled)
|
||||
{
|
||||
zval **arg;
|
||||
int len;
|
||||
char *arg = NULL;
|
||||
int arg_len, len;
|
||||
char string[256];
|
||||
|
||||
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
|
||||
ZEND_WRONG_PARAM_COUNT();
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &arg, &arg_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
convert_to_string_ex(arg);
|
||||
|
||||
len = sprintf(string, "Congratulations! You have successfully modified ext/%.78s/config.m4. Module %.78s is now compiled into PHP.", "extname", Z_STRVAL_PP(arg));
|
||||
len = sprintf(string, "Congratulations! You have successfully modified ext/%.78s/config.m4. Module %.78s is now compiled into PHP.", "extname", arg);
|
||||
RETURN_STRINGL(string, len, 1);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
<?
|
||||
if(!extension_loaded('extname')) {
|
||||
dl('extname.so');
|
||||
}
|
||||
$module = 'extname';
|
||||
$functions = get_extension_funcs($module);
|
||||
echo "Functions available in the test extension:<br>\n";
|
||||
foreach($functions as $func) {
|
||||
echo $func."<br>\n";
|
||||
}
|
||||
echo "<br>\n";
|
||||
$function = 'confirm_' . $module . '_compiled';
|
||||
if (extension_loaded($module)) {
|
||||
$str = $function($module);
|
||||
|
||||
@@ -4,6 +4,4 @@ LTLIBRARY_SOURCES = snmp.c
|
||||
LTLIBRARY_SHARED_NAME = snmp.la
|
||||
LTLIBRARY_SHARED_LIBADD = $(SNMP_SHARED_LIBADD)
|
||||
|
||||
EXTRA_INCLUDES = $(SNMP_INCLUDE)
|
||||
|
||||
include $(top_srcdir)/build/dynlib.mk
|
||||
+29
-23
@@ -10,6 +10,7 @@ PHP_ARG_WITH(snmp,for SNMP support,
|
||||
to build as a dl and still specify DIR.])
|
||||
|
||||
if test "$PHP_SNMP" != "no"; then
|
||||
|
||||
if test "$PHP_SNMP" = "yes"; then
|
||||
for i in /usr/include /usr/local/include; do
|
||||
test -f $i/snmp.h && SNMP_INCDIR=$i
|
||||
@@ -18,11 +19,11 @@ PHP_ARG_WITH(snmp,for SNMP support,
|
||||
test -f $i/snmp/include/ucd-snmp/snmp.h && SNMP_INCDIR=$i/snmp/include/ucd-snmp
|
||||
done
|
||||
for i in /usr /usr/snmp /usr/local /usr/local/snmp; do
|
||||
test -f $i/lib/libsnmp.a -o -f $i/lib/libsnmp.s? && SNMP_LIBDIR=$i/lib
|
||||
test -f $i/lib/libsnmp.a -o -f $i/lib/libsnmp.$SHLIB_SUFFIX_NAME && SNMP_LIBDIR=$i/lib
|
||||
done
|
||||
else
|
||||
SNMP_INCDIR=$PHP_SNMP/include
|
||||
test -d $PHP_SNMP/include/ucd-snmp && SNMP_INCDIR=$withval/include/ucd-snmp
|
||||
test -d $PHP_SNMP/include/ucd-snmp && SNMP_INCDIR=$PHP_SNMP/include/ucd-snmp
|
||||
SNMP_LIBDIR=$PHP_SNMP/lib
|
||||
fi
|
||||
|
||||
@@ -32,41 +33,46 @@ PHP_ARG_WITH(snmp,for SNMP support,
|
||||
AC_MSG_ERROR(libsnmp not found. Check your SNMP installation.)
|
||||
fi
|
||||
|
||||
AC_DEFINE(HAVE_SNMP,1,[ ])
|
||||
PHP_ADD_INCLUDE($SNMP_INCDIR)
|
||||
PHP_ADD_LIBRARY_WITH_PATH(snmp, $SNMP_LIBDIR, SNMP_SHARED_LIBADD)
|
||||
|
||||
old_CPPFLAGS=$CPPFLAGS
|
||||
CPPFLAGS="$INCLUDES $CPPFLAGS"
|
||||
CPPFLAGS=-I$SNMP_INCDIR
|
||||
AC_CHECK_HEADERS(default_store.h)
|
||||
if test "$ac_cv_header_default_store_h" = "yes"; then
|
||||
dnl UCD SNMP 4.1.x
|
||||
AC_TRY_RUN([
|
||||
#include <ucd-snmp-config.h>
|
||||
main() { exit(USE_OPENSSL != 1); }
|
||||
AC_MSG_CHECKING(for OpenSSL support in SNMP libraries)
|
||||
AC_EGREP_CPP(yes,[
|
||||
#include <ucd-snmp-config.h>
|
||||
#if USE_OPENSSL
|
||||
yes
|
||||
#endif
|
||||
],[
|
||||
SNMP_SSL=yes
|
||||
],[
|
||||
SNMP_SSL=no
|
||||
],[
|
||||
SNMP_SSL=no
|
||||
])
|
||||
|
||||
if test "$SNMP_SSL" = "yes"; then
|
||||
PHP_SETUP_OPENSSL
|
||||
fi
|
||||
fi
|
||||
CPPFLAGS=$old_CPPFLAGS
|
||||
AC_MSG_RESULT($SNMP_SSL)
|
||||
|
||||
if test "$SNMP_SSL" = "yes"; then
|
||||
if test "$PHP_OPENSSL" != "no"; then
|
||||
PHP_ADD_LIBRARY(ssl, 1, SNMP_SHARED_LIBADD)
|
||||
PHP_ADD_LIBRARY(crypto,1, SNMP_SHARED_LIBADD)
|
||||
else
|
||||
AC_MSG_ERROR(The UCD-SNMP in this system is build with SSL support.
|
||||
|
||||
Add --with-openssl<=DIR> to your configure line.)
|
||||
fi
|
||||
fi
|
||||
|
||||
PHP_EXTENSION(snmp,$ext_shared)
|
||||
PHP_SUBST(SNMP_SHARED_LIBADD)
|
||||
|
||||
AC_CHECK_LIB(kstat, kstat_read, [ PHP_ADD_LIBRARY(kstat,,SNMP_SHARED_LIBADD) ])
|
||||
SNMP_INCLUDE=-I$SNMP_INCDIR
|
||||
|
||||
AC_DEFINE(HAVE_SNMP,1,[ ])
|
||||
PHP_ADD_INCLUDE($SNMP_INCDIR)
|
||||
PHP_ADD_LIBRARY_WITH_PATH(snmp, $SNMP_LIBDIR, SNMP_SHARED_LIBADD)
|
||||
|
||||
PHP_EXTENSION(snmp, $ext_shared)
|
||||
PHP_SUBST(SNMP_SHARED_LIBADD)
|
||||
fi
|
||||
|
||||
PHP_SUBST(SNMP_LIBDIR)
|
||||
PHP_SUBST(SNMP_INCLUDE)
|
||||
|
||||
AC_MSG_CHECKING(whether to enable UCD SNMP hack)
|
||||
AC_ARG_ENABLE(ucd-snmp-hack,
|
||||
|
||||
@@ -87,7 +87,7 @@ typedef int SOCKET;
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
SOCKET socket;
|
||||
SOCKET bsd_socket;
|
||||
int type;
|
||||
} php_socket;
|
||||
|
||||
|
||||
@@ -151,10 +151,10 @@ int inet_aton(const char *cp, struct in_addr *inp) {
|
||||
}
|
||||
|
||||
int fcntl(int fd, int cmd, ...) {
|
||||
va_list va;
|
||||
int retval;
|
||||
|
||||
va_start(va, cmd);
|
||||
va_list va;
|
||||
int retval, io, mode;
|
||||
|
||||
va_start(va, cmd);
|
||||
|
||||
switch(cmd) {
|
||||
case F_GETFL:
|
||||
@@ -165,7 +165,9 @@ int fcntl(int fd, int cmd, ...) {
|
||||
break;
|
||||
|
||||
case F_SETFL:
|
||||
retval = ioctlsocket(fd, cmd, va_arg(va, int*));
|
||||
io = va_arg(va, int);
|
||||
mode = io == O_NONBLOCK ? 1 : 0;
|
||||
retval = ioctlsocket(fd, io, &mode);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
+71
-67
@@ -33,9 +33,6 @@
|
||||
#define _XPG4_2
|
||||
#define __EXTENSIONS__
|
||||
|
||||
#ifndef __PRAGMA_REDEFINE_EXTNAME
|
||||
#define __PRAGMA_REDEFINE_EXTNAME
|
||||
#endif
|
||||
|
||||
#include "ext/standard/info.h"
|
||||
#include "php_ini.h"
|
||||
@@ -55,14 +52,14 @@
|
||||
# include <fcntl.h>
|
||||
# include <signal.h>
|
||||
# include <sys/uio.h>
|
||||
# define IS_INVALID_SOCKET(a) (a->socket < 0)
|
||||
# define IS_INVALID_SOCKET(a) (a->bsd_socket < 0)
|
||||
# define set_errno(a) (errno = a)
|
||||
# define set_h_errno(a) (h_errno = a)
|
||||
#else /* windows */
|
||||
# include <winsock.h>
|
||||
# include "php_sockets.h"
|
||||
# include "php_sockets_win.h"
|
||||
# define IS_INVALID_SOCKET(a) (a->socket == INVALID_SOCKET)
|
||||
# define IS_INVALID_SOCKET(a) (a->bsd_socket == INVALID_SOCKET)
|
||||
#endif
|
||||
|
||||
#ifdef ZTS
|
||||
@@ -199,7 +196,7 @@ static void destroy_socket(zend_rsrc_list_entry *rsrc TSRMLS_DC)
|
||||
{
|
||||
php_socket *php_sock = (php_socket *) rsrc->ptr;
|
||||
|
||||
close(php_sock->socket);
|
||||
close(php_sock->bsd_socket);
|
||||
efree(php_sock);
|
||||
}
|
||||
|
||||
@@ -224,7 +221,7 @@ static php_socket *open_listen_sock(int port, int backlog)
|
||||
la.sin_family = hp->h_addrtype;
|
||||
la.sin_port = htons((unsigned short) port);
|
||||
|
||||
php_sock->socket = socket(PF_INET, SOCK_STREAM, 0);
|
||||
php_sock->bsd_socket = socket(PF_INET, SOCK_STREAM, 0);
|
||||
php_sock->type = PF_INET;
|
||||
if (IS_INVALID_SOCKET(php_sock)) {
|
||||
php_error(E_WARNING, "Couldn't allocate a new socket from open_listen_sock()");
|
||||
@@ -232,16 +229,16 @@ static php_socket *open_listen_sock(int port, int backlog)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (bind(php_sock->socket, (struct sockaddr *)&la, sizeof(la)) < 0) {
|
||||
if (bind(php_sock->bsd_socket, (struct sockaddr *)&la, sizeof(la)) < 0) {
|
||||
php_error(E_WARNING, "Couldn't bind socket to given address from open_listen_sock()");
|
||||
close(php_sock->socket);
|
||||
close(php_sock->bsd_socket);
|
||||
efree(php_sock);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (listen(php_sock->socket, backlog) < 0) {
|
||||
php_error(E_WARNING, "Couldn't listen on socket %d from open_listen_sock()", php_sock->socket);
|
||||
close(php_sock->socket);
|
||||
if (listen(php_sock->bsd_socket, backlog) < 0) {
|
||||
php_error(E_WARNING, "Couldn't listen on socket %d from open_listen_sock()", php_sock->bsd_socket);
|
||||
close(php_sock->bsd_socket);
|
||||
efree(php_sock);
|
||||
return NULL;
|
||||
}
|
||||
@@ -258,7 +255,7 @@ static php_socket *accept_connect(php_socket *php_sock, struct sockaddr *la)
|
||||
|
||||
m = sizeof(*la);
|
||||
|
||||
retval->socket = accept(php_sock->socket, la, &m);
|
||||
retval->bsd_socket = accept(php_sock->bsd_socket, la, &m);
|
||||
if (IS_INVALID_SOCKET(retval)) {
|
||||
php_error(E_WARNING, "Couldn't accept incoming connection in accept_connect()");
|
||||
efree(retval);
|
||||
@@ -269,14 +266,14 @@ static php_socket *accept_connect(php_socket *php_sock, struct sockaddr *la)
|
||||
}
|
||||
|
||||
/* {{{ php_read -- wrapper around read() so that it only reads to a \r or \n. */
|
||||
int php_read(int socket, void *buf, int maxlen)
|
||||
int php_read(int bsd_socket, void *buf, int maxlen)
|
||||
{
|
||||
int m = 0, n = 0;
|
||||
int no_read = 0;
|
||||
int nonblock = 0;
|
||||
char *t = (char *) buf;
|
||||
|
||||
m = fcntl(socket, F_GETFL);
|
||||
m = fcntl(bsd_socket, F_GETFL);
|
||||
if (m < 0) {
|
||||
return m;
|
||||
}
|
||||
@@ -306,7 +303,7 @@ int php_read(int socket, void *buf, int maxlen)
|
||||
}
|
||||
|
||||
if (n < maxlen) {
|
||||
m = read(socket, (void *) t, 1);
|
||||
m = read(bsd_socket, (void *) t, 1);
|
||||
}
|
||||
|
||||
if (errno != 0 && errno != ESPIPE && errno != EAGAIN) {
|
||||
@@ -446,14 +443,14 @@ PHP_FUNCTION(socket_fd_set)
|
||||
zend_hash_internal_pointer_reset(Z_ARRVAL_PP(arg2));
|
||||
while (zend_hash_get_current_data(Z_ARRVAL_PP(arg2), (void**)&tmp) == SUCCESS) {
|
||||
ZEND_FETCH_RESOURCE(php_sock, php_socket*, tmp, -1, le_socket_name, le_socket);
|
||||
FD_SET(php_sock->socket, &(php_fd->set));
|
||||
max_fd = (php_sock->socket > max_fd) ? php_sock->socket : max_fd;
|
||||
FD_SET(php_sock->bsd_socket, &(php_fd->set));
|
||||
max_fd = (php_sock->bsd_socket > max_fd) ? php_sock->bsd_socket : max_fd;
|
||||
zend_hash_move_forward(Z_ARRVAL_PP(arg2));
|
||||
}
|
||||
} else if (Z_TYPE_PP(arg2) == IS_RESOURCE) {
|
||||
ZEND_FETCH_RESOURCE(php_sock, php_socket*, arg2, -1, le_socket_name, le_socket);
|
||||
FD_SET(php_sock->socket, &(php_fd->set));
|
||||
max_fd = php_sock->socket;
|
||||
FD_SET(php_sock->bsd_socket, &(php_fd->set));
|
||||
max_fd = php_sock->bsd_socket;
|
||||
} else {
|
||||
php_error(E_ERROR, "expecting variable of type array or resource in %s()", get_active_function_name(TSRMLS_C));
|
||||
RETURN_FALSE;
|
||||
@@ -482,12 +479,12 @@ PHP_FUNCTION(socket_fd_clear)
|
||||
zend_hash_internal_pointer_reset(Z_ARRVAL_PP(arg2));
|
||||
while (zend_hash_get_current_data(Z_ARRVAL_PP(arg2), (void**)&tmp) == SUCCESS) {
|
||||
ZEND_FETCH_RESOURCE(php_sock, php_socket*, tmp, -1, le_socket_name, le_socket);
|
||||
FD_CLR(php_sock->socket, &(php_fd->set));
|
||||
FD_CLR(php_sock->bsd_socket, &(php_fd->set));
|
||||
zend_hash_move_forward(Z_ARRVAL_PP(arg2));
|
||||
}
|
||||
} else if (Z_TYPE_PP(arg2) == IS_RESOURCE) {
|
||||
ZEND_FETCH_RESOURCE(php_sock, php_socket*, arg2, -1, le_socket_name, le_socket);
|
||||
FD_CLR(php_sock->socket, &(php_fd->set));
|
||||
FD_CLR(php_sock->bsd_socket, &(php_fd->set));
|
||||
} else {
|
||||
php_error(E_ERROR, "expecting variable of type array or resource in %s()", get_active_function_name(TSRMLS_C));
|
||||
RETURN_FALSE;
|
||||
@@ -513,7 +510,7 @@ PHP_FUNCTION(socket_fd_isset)
|
||||
ZEND_FETCH_RESOURCE(php_fd, php_fd_set*, arg1, -1, le_destroy_name, le_destroy);
|
||||
ZEND_FETCH_RESOURCE(php_sock, php_socket*, arg2, -1, le_socket_name, le_socket);
|
||||
|
||||
if (FD_ISSET(php_sock->socket, &(php_fd->set))) {
|
||||
if (FD_ISSET(php_sock->bsd_socket, &(php_fd->set))) {
|
||||
RETURN_TRUE;
|
||||
}
|
||||
|
||||
@@ -546,7 +543,7 @@ PHP_FUNCTION(socket_select)
|
||||
{
|
||||
zval **arg1, **arg2, **arg3, **arg4, **arg5;
|
||||
struct timeval tv;
|
||||
php_fd_set *rfds, *wfds, *xfds;
|
||||
php_fd_set *rfds = NULL, *wfds = NULL, *xfds = NULL;
|
||||
SOCKET max_fd;
|
||||
int sets = 0;
|
||||
|
||||
@@ -583,7 +580,10 @@ PHP_FUNCTION(socket_select)
|
||||
tv.tv_sec = Z_LVAL_PP(arg4);
|
||||
tv.tv_usec = Z_LVAL_PP(arg5);
|
||||
|
||||
RETURN_LONG(select(max_fd+1, &(rfds->set), &(wfds->set), &(xfds->set), &tv));
|
||||
RETURN_LONG(select(max_fd+1, rfds ? &(rfds->set) : NULL,
|
||||
wfds ? &(wfds->set) : NULL,
|
||||
xfds ? &(xfds->set) : NULL,
|
||||
&tv));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -656,7 +656,7 @@ PHP_FUNCTION(socket_set_nonblock)
|
||||
|
||||
ZEND_FETCH_RESOURCE(php_sock, php_socket *, arg1, -1, le_socket_name, le_socket);
|
||||
|
||||
if (fcntl(php_sock->socket, F_SETFL, O_NONBLOCK) == 0) {
|
||||
if (fcntl(php_sock->bsd_socket, F_SETFL, O_NONBLOCK) == 0) {
|
||||
RETURN_TRUE;
|
||||
}
|
||||
|
||||
@@ -685,7 +685,8 @@ PHP_FUNCTION(socket_listen)
|
||||
backlog = Z_LVAL_PP(arg2);
|
||||
}
|
||||
|
||||
if (listen(php_sock->socket, backlog) == 0) {
|
||||
if (listen(php_sock->bsd_socket, backlog) != 0) {
|
||||
php_error(E_WARNING, "unable to listen [%d]: %s", errno, strerror(errno));
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -737,13 +738,13 @@ PHP_FUNCTION(socket_write)
|
||||
}
|
||||
|
||||
#ifndef PHP_WIN32
|
||||
retval = write(php_sock->socket, Z_STRVAL_PP(arg2), length);
|
||||
retval = write(php_sock->bsd_socket, Z_STRVAL_PP(arg2), length);
|
||||
#else
|
||||
retval = send(php_sock->socket, Z_STRVAL_PP(arg2), length, 0);
|
||||
retval = send(php_sock->bsd_socket, Z_STRVAL_PP(arg2), length, 0);
|
||||
#endif
|
||||
|
||||
if (retval <= 0) {
|
||||
php_error(E_WARNING, "Unable to write to socket %d [%d]: %s", php_sock->socket, errno, strerror(errno));
|
||||
php_error(E_WARNING, "Unable to write to socket %d [%d]: %s", php_sock->bsd_socket, errno, strerror(errno));
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -782,14 +783,17 @@ PHP_FUNCTION(socket_read)
|
||||
tmpbuf = emalloc(Z_LVAL_PP(arg2) + 1);
|
||||
|
||||
#ifndef PHP_WIN32
|
||||
retval = (*read_function)(php_sock->socket, tmpbuf, Z_LVAL_PP(arg2));
|
||||
retval = (*read_function)(php_sock->bsd_socket, tmpbuf, Z_LVAL_PP(arg2));
|
||||
#else
|
||||
retval = recv(php_sock->socket, tmpbuf, Z_LVAL_PP(arg2), 0);
|
||||
retval = recv(php_sock->bsd_socket, tmpbuf, Z_LVAL_PP(arg2), 0);
|
||||
#endif
|
||||
|
||||
if (retval <= 0) {
|
||||
php_error(E_WARNING, "Couldn't read %d bytes from socket %d [%d]: %s",
|
||||
Z_LVAL_PP(arg2), php_sock->socket, errno, strerror(errno));
|
||||
if (retval != 0) {
|
||||
/* Not EOF */
|
||||
php_error(E_WARNING, "Couldn't read %d bytes from socket %d [%d]: %s",
|
||||
Z_LVAL_PP(arg2), php_sock->bsd_socket, errno, strerror(errno));
|
||||
}
|
||||
efree(tmpbuf);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -822,7 +826,7 @@ PHP_FUNCTION(socket_getsockname)
|
||||
|
||||
sa = (struct sockaddr *) &sa_storage;
|
||||
|
||||
if (getsockname(php_sock->socket, sa, &salen) != 0) {
|
||||
if (getsockname(php_sock->bsd_socket, sa, &salen) != 0) {
|
||||
php_error(E_WARNING, "unable to retrieve socket name, %i", errno);
|
||||
RETURN_FALSE;
|
||||
} else {
|
||||
@@ -881,7 +885,7 @@ PHP_FUNCTION(socket_getpeername)
|
||||
|
||||
sa = (struct sockaddr *) &sa_storage;
|
||||
|
||||
if (getpeername(php_sock->socket, sa, &salen) < 0) {
|
||||
if (getpeername(php_sock->bsd_socket, sa, &salen) < 0) {
|
||||
php_error(E_WARNING, "Unable to retrieve peername [%d]: %s", errno, strerror(errno));
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -943,7 +947,7 @@ PHP_FUNCTION(socket_create)
|
||||
Z_LVAL_PP(arg2) = SOCK_STREAM;
|
||||
}
|
||||
|
||||
php_sock->socket = socket(Z_LVAL_PP(arg1), Z_LVAL_PP(arg2), Z_LVAL_PP(arg3));
|
||||
php_sock->bsd_socket = socket(Z_LVAL_PP(arg1), Z_LVAL_PP(arg2), Z_LVAL_PP(arg3));
|
||||
php_sock->type = Z_LVAL_PP(arg1);
|
||||
if (IS_INVALID_SOCKET(php_sock)) {
|
||||
RETURN_FALSE;
|
||||
@@ -1002,12 +1006,12 @@ PHP_FUNCTION(socket_connect)
|
||||
q[3] = host_struct->h_addr_list[0][3];
|
||||
}
|
||||
|
||||
retval = connect(php_sock->socket, (struct sockaddr *)&sin, sizeof(struct sockaddr_in));
|
||||
retval = connect(php_sock->bsd_socket, (struct sockaddr *)&sin, sizeof(struct sockaddr_in));
|
||||
break;
|
||||
case AF_UNIX:
|
||||
s_un.sun_family = AF_UNIX;
|
||||
snprintf(s_un.sun_path, 108, "%s", Z_STRVAL_PP(arg2));
|
||||
retval = connect(php_sock->socket, (struct sockaddr *) &s_un, SUN_LEN(&s_un));
|
||||
retval = connect(php_sock->bsd_socket, (struct sockaddr *) &s_un, SUN_LEN(&s_un));
|
||||
break;
|
||||
default:
|
||||
RETURN_FALSE;
|
||||
@@ -1068,7 +1072,7 @@ PHP_FUNCTION(socket_strerror)
|
||||
PHP_FUNCTION(socket_bind)
|
||||
{
|
||||
zval **arg1, **arg2, **arg3;
|
||||
long retval;
|
||||
long retval = 0;
|
||||
php_sockaddr_storage sa_storage;
|
||||
struct sockaddr *sock_type = (struct sockaddr*) &sa_storage;
|
||||
php_socket *php_sock;
|
||||
@@ -1094,7 +1098,7 @@ PHP_FUNCTION(socket_bind)
|
||||
memset(sa, 0, sizeof(sa_storage));
|
||||
sa->sun_family = AF_UNIX;
|
||||
snprintf(sa->sun_path, 108, "%s", Z_STRVAL_PP(arg2));
|
||||
retval = bind(php_sock->socket, (struct sockaddr *) sa, SUN_LEN(sa));
|
||||
retval = bind(php_sock->bsd_socket, (struct sockaddr *) sa, SUN_LEN(sa));
|
||||
} else if (php_sock->type == AF_INET) {
|
||||
struct sockaddr_in sa;
|
||||
struct hostent *hp;
|
||||
@@ -1111,7 +1115,7 @@ PHP_FUNCTION(socket_bind)
|
||||
memcpy((char *)&sa.sin_addr, hp->h_addr, hp->h_length);
|
||||
sa.sin_family = hp->h_addrtype;
|
||||
sa.sin_port = htons((unsigned short)Z_LVAL_PP(arg3));
|
||||
retval = bind(php_sock->socket, (struct sockaddr *)&sa, sizeof(sa));
|
||||
retval = bind(php_sock->bsd_socket, (struct sockaddr *)&sa, sizeof(sa));
|
||||
|
||||
} else {
|
||||
php_error(E_WARNING,"the specified port is not supported");
|
||||
@@ -1119,7 +1123,7 @@ PHP_FUNCTION(socket_bind)
|
||||
}
|
||||
|
||||
if (retval != 0) {
|
||||
php_error(E_WARNING, "unable to bind address, %i", errno);
|
||||
php_error(E_WARNING, "unable to bind address, [%i] %s", errno, strerror(errno));
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@@ -1317,7 +1321,7 @@ PHP_FUNCTION(socket_readv)
|
||||
ZEND_FETCH_RESOURCE(php_sock, php_socket*, arg1, -1, "Socket", le_socket);
|
||||
ZEND_FETCH_RESOURCE(vector, php_iovec_t *, arg2, -1, "IO vector table", le_iov);
|
||||
|
||||
if (readv(php_sock->socket, vector->iov_array, vector->count) != 0) {
|
||||
if (readv(php_sock->bsd_socket, vector->iov_array, vector->count) != 0) {
|
||||
php_error(E_WARNING, "unable to read, %i", errno);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -1341,7 +1345,7 @@ PHP_FUNCTION(socket_writev)
|
||||
ZEND_FETCH_RESOURCE(php_sock, php_socket*, arg1, -1, "Socket", le_socket);
|
||||
ZEND_FETCH_RESOURCE(vector, php_iovec_t *, arg2, -1, "IO vector table", le_iov);
|
||||
|
||||
if (writev(php_sock->socket, vector->iov_array, vector->count) != 0) {
|
||||
if (writev(php_sock->bsd_socket, vector->iov_array, vector->count) != 0) {
|
||||
php_error(E_WARNING, "unable to write, %i", errno);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -1370,7 +1374,7 @@ PHP_FUNCTION(socket_recv)
|
||||
recv_buf = emalloc(Z_LVAL_PP(arg2) + 2);
|
||||
memset(recv_buf, 0, Z_LVAL_PP(arg2) + 2);
|
||||
|
||||
retval = recv(php_sock->socket, recv_buf, Z_LVAL_PP(arg2), Z_LVAL_PP(arg3));
|
||||
retval = recv(php_sock->bsd_socket, recv_buf, Z_LVAL_PP(arg2), Z_LVAL_PP(arg3));
|
||||
|
||||
if (retval == 0) {
|
||||
efree(recv_buf);
|
||||
@@ -1399,7 +1403,7 @@ PHP_FUNCTION(socket_send)
|
||||
convert_to_long_ex(arg4);
|
||||
convert_to_string_ex(arg2);
|
||||
|
||||
retval = send(php_sock->socket, Z_STRVAL_PP(arg2), (Z_STRLEN_PP(arg2) < Z_LVAL_PP(arg3) ? Z_STRLEN_PP(arg2) : Z_LVAL_PP(arg3)), Z_LVAL_PP(arg4));
|
||||
retval = send(php_sock->bsd_socket, Z_STRVAL_PP(arg2), (Z_STRLEN_PP(arg2) < Z_LVAL_PP(arg3) ? Z_STRLEN_PP(arg2) : Z_LVAL_PP(arg3)), Z_LVAL_PP(arg4));
|
||||
|
||||
RETURN_LONG(retval);
|
||||
}
|
||||
@@ -1441,7 +1445,7 @@ PHP_FUNCTION(socket_recvfrom)
|
||||
case AF_UNIX:
|
||||
slen = sizeof(s_un);
|
||||
s_un.sun_family = AF_UNIX;
|
||||
retval = recvfrom(php_sock->socket, recv_buf, Z_LVAL_PP(arg3), Z_LVAL_PP(arg4),
|
||||
retval = recvfrom(php_sock->bsd_socket, recv_buf, Z_LVAL_PP(arg3), Z_LVAL_PP(arg4),
|
||||
(struct sockaddr *)&s_un, (socklen_t *)&slen);
|
||||
|
||||
if (retval < 0) {
|
||||
@@ -1468,7 +1472,7 @@ PHP_FUNCTION(socket_recvfrom)
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
retval = recvfrom(php_sock->socket, recv_buf, Z_LVAL_PP(arg3), Z_LVAL_PP(arg4),
|
||||
retval = recvfrom(php_sock->bsd_socket, recv_buf, Z_LVAL_PP(arg3), Z_LVAL_PP(arg4),
|
||||
(struct sockaddr *)&sin, (socklen_t *)&slen);
|
||||
|
||||
if (retval < 0) {
|
||||
@@ -1527,14 +1531,14 @@ PHP_FUNCTION(socket_sendto)
|
||||
}
|
||||
|
||||
|
||||
switch ( php_sock->socket ) {
|
||||
switch ( php_sock->bsd_socket ) {
|
||||
case AF_UNIX:
|
||||
memset(&s_un, 0, sizeof(s_un));
|
||||
s_un.sun_family = AF_UNIX;
|
||||
snprintf(s_un.sun_path, 108, "%s", Z_STRVAL_PP(arg5));
|
||||
|
||||
which = (Z_STRLEN_PP(arg2) > Z_LVAL_PP(arg3)) ? 1 : 0;
|
||||
retval = sendto(php_sock->socket, Z_STRVAL_PP(arg2), (which ? Z_LVAL_PP(arg3) : Z_STRLEN_PP(arg2)),
|
||||
retval = sendto(php_sock->bsd_socket, Z_STRVAL_PP(arg2), (which ? Z_LVAL_PP(arg3) : Z_STRLEN_PP(arg2)),
|
||||
Z_LVAL_PP(arg4), (struct sockaddr *) &s_un, SUN_LEN(&s_un));
|
||||
|
||||
case AF_INET:
|
||||
@@ -1561,7 +1565,7 @@ PHP_FUNCTION(socket_sendto)
|
||||
|
||||
sin.sin_port = htons((unsigned short)Z_LVAL_PP(arg6));
|
||||
which = (Z_STRLEN_PP(arg2) > Z_LVAL_PP(arg3)) ? 1 : 0;
|
||||
retval = sendto(php_sock->socket, Z_STRVAL_PP(arg2), (which ? Z_LVAL_PP(arg3) : Z_STRLEN_PP(arg2)),
|
||||
retval = sendto(php_sock->bsd_socket, Z_STRVAL_PP(arg2), (which ? Z_LVAL_PP(arg3) : Z_STRLEN_PP(arg2)),
|
||||
Z_LVAL_PP(arg4), (struct sockaddr *) &sin, sizeof(sin));
|
||||
|
||||
default:
|
||||
@@ -1606,7 +1610,7 @@ PHP_FUNCTION(socket_recvmsg)
|
||||
break;
|
||||
}
|
||||
|
||||
if (getsockname(php_sock->socket, sa, &salen) != 0) {
|
||||
if (getsockname(php_sock->bsd_socket, sa, &salen) != 0) {
|
||||
php_error(E_WARNING, "unable to recvms, %i", errno);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -1632,7 +1636,7 @@ PHP_FUNCTION(socket_recvmsg)
|
||||
hdr.msg_controllen = ctl_buf ? Z_LVAL_PP(arg4) : 0;
|
||||
hdr.msg_flags = 0;
|
||||
|
||||
if (recvmsg(php_sock->socket, &hdr, Z_LVAL_PP(arg5)) != 0) {
|
||||
if (recvmsg(php_sock->bsd_socket, &hdr, Z_LVAL_PP(arg5)) != 0) {
|
||||
php_error(E_WARNING, "unable to recvmsg, %i", errno);
|
||||
RETURN_FALSE;
|
||||
} else {
|
||||
@@ -1688,7 +1692,7 @@ PHP_FUNCTION(socket_recvmsg)
|
||||
|
||||
hdr.msg_flags = 0;
|
||||
|
||||
if (recvmsg(php_sock->socket, &hdr, Z_LVAL_PP(arg5)) != 0) {
|
||||
if (recvmsg(php_sock->bsd_socket, &hdr, Z_LVAL_PP(arg5)) != 0) {
|
||||
php_error(E_WARNING, "unable to recvmsg, %i", errno);
|
||||
RETURN_FALSE;
|
||||
} else {
|
||||
@@ -1750,7 +1754,7 @@ PHP_FUNCTION(socket_sendmsg)
|
||||
}
|
||||
|
||||
salen = sizeof(sa);
|
||||
if (getsockname(php_sock->socket, &sa, &salen) != 0) {
|
||||
if (getsockname(php_sock->bsd_socket, &sa, &salen) != 0) {
|
||||
php_error(E_WARNING, "unable to sendmsg, %i", errno);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -1781,7 +1785,7 @@ PHP_FUNCTION(socket_sendmsg)
|
||||
|
||||
sin->sin_port = htons((unsigned short)Z_LVAL_PP(arg5));
|
||||
|
||||
if (sendmsg(php_sock->socket, &hdr, Z_LVAL_PP(arg3)) != 0) {
|
||||
if (sendmsg(php_sock->bsd_socket, &hdr, Z_LVAL_PP(arg3)) != 0) {
|
||||
php_error(E_WARNING, "unable to sendmsg, %i", errno);
|
||||
}
|
||||
|
||||
@@ -1803,7 +1807,7 @@ PHP_FUNCTION(socket_sendmsg)
|
||||
|
||||
hdr.msg_namelen = SUN_LEN(s_un);
|
||||
|
||||
if (sendmsg(php_sock->socket, &hdr, Z_LVAL_PP(arg3)) != 0) {
|
||||
if (sendmsg(php_sock->bsd_socket, &hdr, Z_LVAL_PP(arg3)) != 0) {
|
||||
php_error(E_WARNING, "unable to sendmsg, %i", errno);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -1838,7 +1842,7 @@ PHP_FUNCTION(socket_getopt)
|
||||
if (Z_LVAL_PP(arg2) == SO_LINGER) {
|
||||
optlen = sizeof(struct linger);
|
||||
|
||||
if (getsockopt(php_sock->socket, Z_LVAL_PP(arg2), Z_LVAL_PP(arg3), (char*)&linger_val, &optlen) != 0) {
|
||||
if (getsockopt(php_sock->bsd_socket, Z_LVAL_PP(arg2), Z_LVAL_PP(arg3), (char*)&linger_val, &optlen) != 0) {
|
||||
php_error(E_WARNING, "unable to retrieve socket option, %i", errno);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -1852,7 +1856,7 @@ PHP_FUNCTION(socket_getopt)
|
||||
} else {
|
||||
optlen = sizeof(other_val);
|
||||
|
||||
if (getsockopt(php_sock->socket, Z_LVAL_PP(arg2), Z_LVAL_PP(arg3), (char*)&other_val, &optlen) != 0) {
|
||||
if (getsockopt(php_sock->bsd_socket, Z_LVAL_PP(arg2), Z_LVAL_PP(arg3), (char*)&other_val, &optlen) != 0) {
|
||||
php_error(E_WARNING, "unable to retrieve socket option, %i", errno);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -1906,7 +1910,7 @@ PHP_FUNCTION(socket_setopt)
|
||||
|
||||
optlen = sizeof(lv);
|
||||
|
||||
retval = setsockopt(php_sock->socket, Z_LVAL_PP(arg2), Z_LVAL_PP(arg3), (char*)&lv, optlen);
|
||||
retval = setsockopt(php_sock->bsd_socket, Z_LVAL_PP(arg2), Z_LVAL_PP(arg3), (char*)&lv, optlen);
|
||||
|
||||
} else {
|
||||
convert_to_long_ex(arg4);
|
||||
@@ -1914,7 +1918,7 @@ PHP_FUNCTION(socket_setopt)
|
||||
optlen = sizeof(ov);
|
||||
ov = Z_LVAL_PP(arg3);
|
||||
|
||||
retval = setsockopt(php_sock->socket, Z_LVAL_PP(arg2), Z_LVAL_PP(arg3), (char*)&ov, optlen);
|
||||
retval = setsockopt(php_sock->bsd_socket, Z_LVAL_PP(arg2), Z_LVAL_PP(arg3), (char*)&ov, optlen);
|
||||
}
|
||||
|
||||
if (retval != 0) {
|
||||
@@ -1970,8 +1974,8 @@ PHP_FUNCTION(socket_create_pair)
|
||||
MAKE_STD_ZVAL(retval[0]);
|
||||
MAKE_STD_ZVAL(retval[1]);
|
||||
|
||||
php_sock[0]->socket = fds_array[0];
|
||||
php_sock[1]->socket = fds_array[1];
|
||||
php_sock[0]->bsd_socket = fds_array[0];
|
||||
php_sock[1]->bsd_socket = fds_array[1];
|
||||
php_sock[0]->type = Z_LVAL_PP(arg1);
|
||||
php_sock[1]->type = Z_LVAL_PP(arg1);
|
||||
|
||||
@@ -2004,7 +2008,7 @@ PHP_FUNCTION(socket_shutdown)
|
||||
how_shutdown = Z_LVAL_PP(arg2);
|
||||
}
|
||||
|
||||
if (shutdown(php_sock->socket, how_shutdown) != 0) {
|
||||
if (shutdown(php_sock->bsd_socket, how_shutdown) != 0) {
|
||||
php_error(E_WARNING, "unable to shutdown socket, %i", errno);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -2020,6 +2024,6 @@ PHP_FUNCTION(socket_shutdown)
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
* vim600: sw=4 ts=4 tw=78 fdm=marker
|
||||
* vim<600: sw=4 ts=4 tw=78
|
||||
* vim600: noet sw=4 ts=4 fdm=marker
|
||||
* vim<600: noet sw=4 ts=4
|
||||
*/
|
||||
+41
-12
@@ -948,7 +948,7 @@ static int php_array_walk(HashTable *target_hash, zval **userdata TSRMLS_DC)
|
||||
*retval_ptr, /* Return value - unused */
|
||||
*key; /* Entry key */
|
||||
char *string_key;
|
||||
ulong string_key_len;
|
||||
uint string_key_len;
|
||||
ulong num_key;
|
||||
HashPosition pos;
|
||||
|
||||
@@ -1144,7 +1144,8 @@ PHP_FUNCTION(extract)
|
||||
zval **var_array, **z_extract_type, **prefix;
|
||||
zval **entry, *data;
|
||||
char *var_name, *final_name;
|
||||
ulong num_key, var_name_len;
|
||||
ulong num_key;
|
||||
uint var_name_len;
|
||||
int var_exists, extract_type, key_type, count = 0;
|
||||
HashPosition pos;
|
||||
|
||||
@@ -1735,7 +1736,7 @@ PHP_FUNCTION(array_slice)
|
||||
argc; /* Number of function arguments */
|
||||
|
||||
char *string_key;
|
||||
ulong string_key_len;
|
||||
uint string_key_len;
|
||||
ulong num_key;
|
||||
HashPosition hpos;
|
||||
|
||||
@@ -1821,7 +1822,7 @@ PHPAPI void php_array_merge(HashTable *dest, HashTable *src, int recursive)
|
||||
zval **src_entry,
|
||||
**dest_entry;
|
||||
char *string_key;
|
||||
ulong string_key_len;
|
||||
uint string_key_len;
|
||||
ulong num_key;
|
||||
HashPosition pos;
|
||||
|
||||
@@ -1913,7 +1914,7 @@ PHP_FUNCTION(array_keys)
|
||||
*new_val; /* New value */
|
||||
int add_key; /* Flag to indicate whether a key should be added */
|
||||
char *string_key; /* String key */
|
||||
ulong string_key_len;
|
||||
uint string_key_len;
|
||||
ulong num_key; /* Numeric key */
|
||||
HashPosition pos;
|
||||
|
||||
@@ -2074,7 +2075,7 @@ PHP_FUNCTION(array_reverse)
|
||||
**z_preserve_keys, /* Flag: whether to preserve keys */
|
||||
**entry; /* An entry in the input array */
|
||||
char *string_key;
|
||||
ulong string_key_len;
|
||||
uint string_key_len;
|
||||
ulong num_key;
|
||||
zend_bool preserve_keys = 0;
|
||||
HashPosition pos;
|
||||
@@ -2195,7 +2196,7 @@ PHP_FUNCTION(array_flip)
|
||||
zval **array, **entry, *data;
|
||||
HashTable *target_hash;
|
||||
char *string_key;
|
||||
ulong str_key_len;
|
||||
uint str_key_len;
|
||||
ulong num_key;
|
||||
HashPosition pos;
|
||||
|
||||
@@ -2721,7 +2722,7 @@ PHP_FUNCTION(array_rand)
|
||||
long randval;
|
||||
int num_req_val, num_avail, key_type;
|
||||
char *string_key;
|
||||
ulong string_key_len;
|
||||
uint string_key_len;
|
||||
ulong num_key;
|
||||
HashPosition pos;
|
||||
|
||||
@@ -2926,7 +2927,7 @@ PHP_FUNCTION(array_filter)
|
||||
zval *retval = NULL;
|
||||
char *callback_name;
|
||||
char *string_key;
|
||||
ulong string_key_len;
|
||||
uint string_key_len;
|
||||
ulong num_key;
|
||||
HashPosition pos;
|
||||
|
||||
@@ -2999,6 +3000,7 @@ PHP_FUNCTION(array_map)
|
||||
zval ***params;
|
||||
zval *callback;
|
||||
zval *result, *null;
|
||||
HashPosition *array_pos;
|
||||
char *callback_name;
|
||||
int i, k, maxlen = 0;
|
||||
int *array_len;
|
||||
@@ -3024,8 +3026,9 @@ PHP_FUNCTION(array_map)
|
||||
efree(callback_name);
|
||||
}
|
||||
|
||||
/* Cache array sizes. */
|
||||
/* Allocate array sizes and iterators. */
|
||||
array_len = (int*)emalloc((ZEND_NUM_ARGS()-1) * sizeof(int));
|
||||
array_pos = (HashPosition*)emalloc((ZEND_NUM_ARGS()-1) * sizeof(HashPosition));
|
||||
|
||||
/* Check that arrays are indeed arrays and calculate maximum size. */
|
||||
for (i = 0; i < ZEND_NUM_ARGS()-1; i++) {
|
||||
@@ -3039,6 +3042,7 @@ PHP_FUNCTION(array_map)
|
||||
array_len[i] = zend_hash_num_elements(Z_ARRVAL_PP(args[i+1]));
|
||||
if (array_len[i] > maxlen)
|
||||
maxlen = array_len[i];
|
||||
zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(args[i+1]), &array_pos[i]);
|
||||
}
|
||||
|
||||
/* Short-circuit: if no callback and only one array, just return it. */
|
||||
@@ -3046,6 +3050,7 @@ PHP_FUNCTION(array_map)
|
||||
*return_value = **args[1];
|
||||
zval_copy_ctor(return_value);
|
||||
efree(array_len);
|
||||
efree(array_pos);
|
||||
efree(args);
|
||||
return;
|
||||
}
|
||||
@@ -3057,6 +3062,11 @@ PHP_FUNCTION(array_map)
|
||||
|
||||
/* We iterate through all the arrays at once. */
|
||||
for (k = 0; k < maxlen; k++) {
|
||||
uint str_key_len;
|
||||
ulong num_key;
|
||||
char *str_key;
|
||||
int key_type;
|
||||
|
||||
/*
|
||||
* If no callback, the result will be an array, consisting of current
|
||||
* entries from all arrays.
|
||||
@@ -3072,7 +3082,17 @@ PHP_FUNCTION(array_map)
|
||||
* parameter list, otherwise use null value.
|
||||
*/
|
||||
if (k < array_len[i]) {
|
||||
zend_hash_index_find(Z_ARRVAL_PP(args[i+1]), k, (void **)¶ms[i]);
|
||||
zend_hash_get_current_data_ex(Z_ARRVAL_PP(args[i+1]), (void **)¶ms[i], &array_pos[i]);
|
||||
|
||||
/*
|
||||
* It is safe to store only last value of key type, because
|
||||
* this loop will run just once if there is only 1 array.
|
||||
*/
|
||||
if (ZEND_NUM_ARGS() == 2) {
|
||||
key_type = zend_hash_get_current_key_ex(Z_ARRVAL_PP(args[1]), &str_key, &str_key_len, &num_key, 0, &array_pos[i]);
|
||||
}
|
||||
|
||||
zend_hash_move_forward_ex(Z_ARRVAL_PP(args[i+1]), &array_pos[i]);
|
||||
} else {
|
||||
if (Z_TYPE_P(callback) == IS_NULL)
|
||||
zval_add_ref(&null);
|
||||
@@ -3088,17 +3108,26 @@ PHP_FUNCTION(array_map)
|
||||
php_error(E_WARNING, "%s() had an error invoking the map callback", get_active_function_name(TSRMLS_C));
|
||||
efree(array_len);
|
||||
efree(args);
|
||||
efree(array_pos);
|
||||
zval_dtor(return_value);
|
||||
RETURN_NULL();
|
||||
}
|
||||
}
|
||||
|
||||
add_next_index_zval(return_value, result);
|
||||
if (ZEND_NUM_ARGS() > 2) {
|
||||
add_next_index_zval(return_value, result);
|
||||
} else {
|
||||
if (key_type == HASH_KEY_IS_STRING)
|
||||
add_assoc_zval_ex(return_value, str_key, str_key_len, result);
|
||||
else
|
||||
add_index_zval(return_value, num_key, result);
|
||||
}
|
||||
}
|
||||
|
||||
zval_ptr_dtor(&null);
|
||||
efree(params);
|
||||
efree(array_len);
|
||||
efree(array_pos);
|
||||
efree(args);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -303,12 +303,6 @@ function_entry basic_functions[] = {
|
||||
PHP_FE(log, NULL)
|
||||
PHP_FE(log10, NULL)
|
||||
PHP_FE(sqrt, NULL)
|
||||
PHP_FE(exp2, NULL)
|
||||
PHP_FE(exp10, NULL)
|
||||
PHP_FE(log2, NULL)
|
||||
#ifndef PHP_WIN32
|
||||
PHP_FE(cbrt, NULL)
|
||||
#endif
|
||||
PHP_FE(hypot, NULL)
|
||||
#ifndef PHP_WIN32
|
||||
PHP_FE(expm1, NULL)
|
||||
|
||||
@@ -862,7 +862,7 @@ FileFunction(php_if_lstat, FS_LSTAT)
|
||||
|
||||
/* {{{ proto array stat(string filename)
|
||||
Give information about a file */
|
||||
FileFunction(php_if_stat, FS_SIZE)
|
||||
FileFunction(php_if_stat, FS_STAT)
|
||||
/* }}} */
|
||||
|
||||
/*
|
||||
|
||||
+145
-87
@@ -35,6 +35,7 @@
|
||||
char *_php_math_number_format(double, int, char , char);
|
||||
|
||||
/* {{{ proto int abs(int number)
|
||||
|
||||
Return the absolute value of the number */
|
||||
PHP_FUNCTION(abs)
|
||||
{
|
||||
@@ -510,47 +511,15 @@ PHP_FUNCTION(exp)
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
/* {{{ proto double exp2(double number)
|
||||
Returns 2 raised to the power of the number */
|
||||
|
||||
PHP_FUNCTION(exp2)
|
||||
{
|
||||
zval **num;
|
||||
|
||||
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_double_ex(num);
|
||||
// libc function is broken in RH Linux 6.1, glibc 2.1.3
|
||||
//Z_DVAL_P(return_value) = exp2(Z_DVAL_PP(num));
|
||||
Z_DVAL_P(return_value) = pow(2.0, Z_DVAL_PP(num));
|
||||
Z_TYPE_P(return_value) = IS_DOUBLE;
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
/* {{{ proto double exp10(double number)
|
||||
Returns 10 raised to the power of the number */
|
||||
|
||||
PHP_FUNCTION(exp10)
|
||||
{
|
||||
zval **num;
|
||||
|
||||
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_double_ex(num);
|
||||
// libc function is broken in RH Linux 6.1, glibc 2.1.3
|
||||
//Z_DVAL_P(return_value) = exp10(Z_DVAL_PP(num));
|
||||
Z_DVAL_P(return_value) = pow(10.0, Z_DVAL_PP(num));
|
||||
Z_TYPE_P(return_value) = IS_DOUBLE;
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
|
||||
#ifndef PHP_WIN32
|
||||
/* {{{ proto double expm1(double number)
|
||||
Returns exp(number) - 1, computed in a way that accurate even when
|
||||
the value of number is close to zero */
|
||||
the value of number is close to zero
|
||||
WARNING: this function is expermental: it could change its name or
|
||||
disappear in the next version of PHP!
|
||||
*/
|
||||
|
||||
PHP_FUNCTION(expm1)
|
||||
{
|
||||
@@ -567,7 +536,10 @@ PHP_FUNCTION(expm1)
|
||||
/* }}} */
|
||||
/* {{{ proto double log1p(double number)
|
||||
Returns log(1 + number), computed in a way that accurate even when
|
||||
the value of number is close to zero */
|
||||
the value of number is close to zero
|
||||
WARNING: this function is expermental: it could change its name or
|
||||
disappear in the next version of PHP!
|
||||
*/
|
||||
|
||||
PHP_FUNCTION(log1p)
|
||||
{
|
||||
@@ -599,24 +571,6 @@ PHP_FUNCTION(log)
|
||||
Z_TYPE_P(return_value) = IS_DOUBLE;
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
/* {{{ proto double log2(double number)
|
||||
Returns the base-2 logarithm of the number */
|
||||
|
||||
PHP_FUNCTION(log2)
|
||||
{
|
||||
zval **num;
|
||||
|
||||
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_double_ex(num);
|
||||
// libc function is broken in RH Linux 6.1, glibc 2.1.3
|
||||
//Z_DVAL_P(return_value) = log2(Z_DVAL_PP(num));
|
||||
Z_DVAL_P(return_value) = log(Z_DVAL_PP(num))/log(2.0);
|
||||
Z_TYPE_P(return_value) = IS_DOUBLE;
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
/* {{{ proto double log10(double number)
|
||||
Returns the base-10 logarithm of the number */
|
||||
@@ -651,27 +605,12 @@ PHP_FUNCTION(sqrt)
|
||||
|
||||
/* }}} */
|
||||
|
||||
#ifndef PHP_WIN32
|
||||
/* {{{ proto double cbrt(double number)
|
||||
Returns the cubic root of the number */
|
||||
|
||||
PHP_FUNCTION(cbrt)
|
||||
{
|
||||
zval **num;
|
||||
|
||||
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
convert_to_double_ex(num);
|
||||
Z_DVAL_P(return_value) = cbrt(Z_DVAL_PP(num));
|
||||
Z_TYPE_P(return_value) = IS_DOUBLE;
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
#endif
|
||||
|
||||
/* {{{ proto double hypot(double num1, double num2)
|
||||
Returns sqrt( num1*num1 + num2*num2) */
|
||||
Returns sqrt( num1*num1 + num2*num2)
|
||||
WARNING: this function is expermental: it could change its name or
|
||||
disappear in the next version of PHP!
|
||||
*/
|
||||
|
||||
PHP_FUNCTION(hypot)
|
||||
{
|
||||
@@ -760,6 +699,67 @@ _php_math_basetolong(zval *arg, int base) {
|
||||
/* }}} */
|
||||
/* {{{ _php_math_longtobase */
|
||||
|
||||
/* {{{ _php_math_basetozval */
|
||||
|
||||
/*
|
||||
* Convert a string representation of a base(2-36) number to a zval.
|
||||
*/
|
||||
PHPAPI int
|
||||
_php_math_basetozval(zval *arg, int base, zval *ret) {
|
||||
long mult = 1, num = 0, digit;
|
||||
double fmult, fnum;
|
||||
int i;
|
||||
int f_mode = 0;
|
||||
char c, *s;
|
||||
|
||||
if (Z_TYPE_P(arg) != IS_STRING || base < 2 || base > 36) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
s = Z_STRVAL_P(arg);
|
||||
|
||||
for (i = Z_STRLEN_P(arg) - 1; i >= 0; i--) {
|
||||
c = toupper(s[i]);
|
||||
if (c >= '0' && c <= '9') {
|
||||
digit = (c - '0');
|
||||
} else if (c >= 'A' && c <= 'Z') {
|
||||
digit = (c - 'A' + 10);
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
if (digit >= base) {
|
||||
continue;
|
||||
}
|
||||
if(!f_mode && (!mult || digit > LONG_MAX/mult || num > LONG_MAX-mult*digit)) {
|
||||
f_mode = 1;
|
||||
if(!mult) {
|
||||
fmult = ULONG_MAX + 1;
|
||||
} else {
|
||||
fmult = (unsigned long)mult;
|
||||
}
|
||||
fnum = (unsigned long)num;
|
||||
}
|
||||
|
||||
if(f_mode) {
|
||||
fnum += fmult * digit;
|
||||
fmult *= base;
|
||||
} else {
|
||||
num += mult * digit;
|
||||
mult *= base;
|
||||
}
|
||||
}
|
||||
|
||||
if(f_mode) {
|
||||
ZVAL_DOUBLE(ret, fnum);
|
||||
} else {
|
||||
ZVAL_LONG(ret, num);
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
/* {{{ _php_math_longtobase */
|
||||
|
||||
/*
|
||||
* Convert a long to a string containing a base(2-36) representation of
|
||||
* the number.
|
||||
@@ -798,6 +798,62 @@ _php_math_longtobase(zval *arg, int base)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
/* {{{ _php_math_zvaltobase */
|
||||
|
||||
/*
|
||||
* Convert a zval to a string containing a base(2-36) representation of
|
||||
* the number.
|
||||
*/
|
||||
PHPAPI char *
|
||||
_php_math_zvaltobase(zval *arg, int base)
|
||||
{
|
||||
static char digits[] = "0123456789abcdefghijklmnopqrstuvwxyz";
|
||||
char *result, *ptr, *ret;
|
||||
int len, digit;
|
||||
unsigned long value;
|
||||
double fvalue;
|
||||
int f_mode;
|
||||
|
||||
if ((Z_TYPE_P(arg) != IS_LONG && Z_TYPE_P(arg) != IS_DOUBLE) || base < 2 || base > 36) {
|
||||
return empty_string;
|
||||
}
|
||||
|
||||
f_mode = (Z_TYPE_P(arg) == IS_DOUBLE);
|
||||
|
||||
if(f_mode) {
|
||||
fvalue = floor(Z_DVAL_P(arg)); /* floor it just in case */
|
||||
} else {
|
||||
value = Z_LVAL_P(arg);
|
||||
}
|
||||
|
||||
/* allocates space for the longest possible result with the lowest base */
|
||||
len = (sizeof(Z_DVAL_P(arg)) * 8) + 1;
|
||||
result = emalloc((sizeof(Z_DVAL_P(arg)) * 8) + 1);
|
||||
|
||||
ptr = result + len - 1;
|
||||
*ptr-- = '\0';
|
||||
|
||||
do {
|
||||
if(f_mode) {
|
||||
double d = floor(fvalue/base);
|
||||
digit = (int)ceil(fvalue - d*base);
|
||||
*ptr = digits[digit];
|
||||
fvalue = d;
|
||||
} else {
|
||||
digit = value % base;
|
||||
*ptr = digits[digit];
|
||||
value /= base;
|
||||
}
|
||||
}
|
||||
while (ptr-- > result && (f_mode?(fabs(fvalue)>=1):value));
|
||||
ptr++;
|
||||
ret = estrdup(ptr);
|
||||
efree(result);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
/* {{{ proto int bindec(string binary_number)
|
||||
Returns the decimal equivalent of the binary number */
|
||||
@@ -805,16 +861,15 @@ _php_math_longtobase(zval *arg, int base)
|
||||
PHP_FUNCTION(bindec)
|
||||
{
|
||||
zval **arg;
|
||||
long ret;
|
||||
|
||||
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
convert_to_string_ex(arg);
|
||||
ret = _php_math_basetolong(*arg, 2);
|
||||
|
||||
RETVAL_LONG(ret);
|
||||
if(_php_math_basetozval(*arg, 2, return_value) != SUCCESS) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
@@ -824,7 +879,6 @@ PHP_FUNCTION(bindec)
|
||||
PHP_FUNCTION(hexdec)
|
||||
{
|
||||
zval **arg;
|
||||
long ret;
|
||||
|
||||
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
@@ -832,8 +886,9 @@ PHP_FUNCTION(hexdec)
|
||||
|
||||
convert_to_string_ex(arg);
|
||||
|
||||
ret = _php_math_basetolong(*arg, 16);
|
||||
RETVAL_LONG(ret);
|
||||
if(_php_math_basetozval(*arg, 16, return_value) != SUCCESS) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
@@ -843,7 +898,6 @@ PHP_FUNCTION(hexdec)
|
||||
PHP_FUNCTION(octdec)
|
||||
{
|
||||
zval **arg;
|
||||
long ret;
|
||||
|
||||
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &arg) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
@@ -851,8 +905,9 @@ PHP_FUNCTION(octdec)
|
||||
|
||||
convert_to_string_ex(arg);
|
||||
|
||||
ret = _php_math_basetolong(*arg, 8);
|
||||
RETVAL_LONG(ret);
|
||||
if(_php_math_basetozval(*arg, 8, return_value) != SUCCESS) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
@@ -920,6 +975,7 @@ PHP_FUNCTION(dechex)
|
||||
|
||||
/* }}} */
|
||||
/* {{{ proto string base_convert(string number, int frombase, int tobase)
|
||||
|
||||
Converts a number in a string from any base <= 36 to any base <= 36.
|
||||
*/
|
||||
|
||||
@@ -942,9 +998,11 @@ PHP_FUNCTION(base_convert)
|
||||
php_error(E_WARNING, "base_convert: invalid `to base' (%d)", Z_LVAL_PP(tobase));
|
||||
RETURN_FALSE;
|
||||
}
|
||||
Z_TYPE(temp) = IS_LONG;
|
||||
Z_LVAL(temp) = _php_math_basetolong(*number, Z_LVAL_PP(frombase));
|
||||
result = _php_math_longtobase(&temp, Z_LVAL_PP(tobase));
|
||||
|
||||
if(_php_math_basetozval(*number, Z_LVAL_PP(frombase), &temp) != SUCCESS) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
result = _php_math_zvaltobase(&temp, Z_LVAL_PP(tobase));
|
||||
RETVAL_STRING(result, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -55,13 +55,15 @@ PHP_FUNCTION(number_format);
|
||||
PHP_FUNCTION(deg2rad);
|
||||
PHP_FUNCTION(rad2deg);
|
||||
|
||||
PHP_FUNCTION(exp2);
|
||||
PHP_FUNCTION(exp10);
|
||||
PHP_FUNCTION(log2);
|
||||
PHP_FUNCTION(cbrt);
|
||||
/*
|
||||
WARNING: these functions are expermental: they could change their names or
|
||||
disappear in the next version of PHP!
|
||||
*/
|
||||
PHP_FUNCTION(hypot);
|
||||
PHP_FUNCTION(expm1);
|
||||
PHP_FUNCTION(log1p);
|
||||
|
||||
|
||||
PHP_FUNCTION(sinh);
|
||||
PHP_FUNCTION(cosh);
|
||||
PHP_FUNCTION(tanh);
|
||||
|
||||
@@ -78,27 +78,38 @@ static inline void smart_str_appendl_ex(smart_str *dest, const char *src, size_t
|
||||
|
||||
static inline char *smart_str_print_long(char *buf, long num)
|
||||
{
|
||||
char *p = buf;
|
||||
long tmp = 0;
|
||||
int n = 0;
|
||||
char *p = buf, *end;
|
||||
int n;
|
||||
long tmp;
|
||||
|
||||
if (num < 0) {
|
||||
num = -num;
|
||||
*p++ = '-';
|
||||
}
|
||||
|
||||
while (num > 0) {
|
||||
tmp = tmp * 10 + (num % 10);
|
||||
num /= 10;
|
||||
n++;
|
||||
/* many numbers are < 10 */
|
||||
if (num < 10) {
|
||||
*p++ = num + '0';
|
||||
return p;
|
||||
}
|
||||
|
||||
n = 1;
|
||||
tmp = num;
|
||||
|
||||
/* calculate the number of digits we need */
|
||||
do {
|
||||
*p++ = (tmp % 10) + '0';
|
||||
tmp /= 10;
|
||||
n++;
|
||||
} while (tmp >= 10);
|
||||
|
||||
end = p += n;
|
||||
|
||||
do {
|
||||
*--p = (num % 10) + '0';
|
||||
num /= 10;
|
||||
} while (--n > 0);
|
||||
|
||||
return p;
|
||||
return end;
|
||||
}
|
||||
|
||||
static inline void smart_str_append_long_ex(smart_str *dest, long num, int type)
|
||||
|
||||
@@ -53,8 +53,9 @@ if (var_hash) { \
|
||||
while (zend_hash_get_current_data_ex(var_hash, (void **) &zval_ref, &pos) == SUCCESS) { \
|
||||
if (*zval_ref == ozval) { \
|
||||
char *string_key; \
|
||||
ulong str_key_len; \
|
||||
uint str_key_len; \
|
||||
ulong num_key; \
|
||||
\
|
||||
zend_hash_get_current_key_ex(var_hash, &string_key, &str_key_len, &num_key, 1, &pos); \
|
||||
/* this is our hash and it _will_ be number indexed! */ \
|
||||
zend_hash_index_update(var_hash, num_key, &nzval, sizeof(zval *), NULL); \
|
||||
|
||||
@@ -2713,7 +2713,8 @@ PHP_FUNCTION(str_replace)
|
||||
zval **subject, **search, **replace, **subject_entry, **pboyer;
|
||||
zval *result;
|
||||
char *string_key;
|
||||
ulong string_key_len, num_key;
|
||||
uint string_key_len;
|
||||
ulong num_key;
|
||||
int boyer = 0;
|
||||
|
||||
if(ZEND_NUM_ARGS() < 3 ||
|
||||
|
||||
@@ -40,6 +40,8 @@ echo serialize((bool) false)."\n";
|
||||
echo serialize(1)."\n";
|
||||
echo serialize(0)."\n";
|
||||
echo serialize(-1)."\n";
|
||||
echo serialize(2147483647)."\n";
|
||||
echo serialize(-2147483647)."\n";
|
||||
echo serialize(1.123456789)."\n";
|
||||
echo serialize(1.0)."\n";
|
||||
echo serialize(0.0)."\n";
|
||||
@@ -75,6 +77,8 @@ b:0;
|
||||
i:1;
|
||||
i:0;
|
||||
i:-1;
|
||||
i:2147483647;
|
||||
i:-2147483647;
|
||||
d:1.123456789;
|
||||
d:1;
|
||||
d:0;
|
||||
|
||||
@@ -158,11 +158,11 @@ yy3:
|
||||
yy4: yych = *++YYCURSOR;
|
||||
yy5:
|
||||
#line 112
|
||||
{ sep = separator; goto done; }
|
||||
{ sep = separator; goto scan; }
|
||||
yy6: yych = *++YYCURSOR;
|
||||
yy7:
|
||||
#line 113
|
||||
{ bash = p; goto done; }
|
||||
{ bash = p - 1; goto done; }
|
||||
yy8: ++YYCURSOR;
|
||||
if(YYLIMIT == YYCURSOR) YYFILL(1);
|
||||
yych = *YYCURSOR;
|
||||
|
||||
@@ -109,8 +109,8 @@ static inline void append_modified_url(smart_str *url, smart_str *dest, smart_st
|
||||
scan:
|
||||
/*!re2c
|
||||
":" { smart_str_append(dest, url); return; }
|
||||
"?" { sep = separator; goto done; }
|
||||
"#" { bash = p; goto done; }
|
||||
"?" { sep = separator; goto scan; }
|
||||
"#" { bash = p - 1; goto done; }
|
||||
(any\[:?#])+ { goto scan; }
|
||||
*/
|
||||
done:
|
||||
|
||||
+1
-1
@@ -322,7 +322,7 @@ static void php_var_serialize_intern(smart_str *buf, zval **struc, HashTable *va
|
||||
char *key;
|
||||
zval **data;
|
||||
ulong index;
|
||||
ulong key_len;
|
||||
uint key_len;
|
||||
HashPosition pos;
|
||||
|
||||
zend_hash_internal_pointer_reset_ex(myht, &pos);
|
||||
|
||||
@@ -75,7 +75,7 @@ ZEND_BEGIN_MODULE_GLOBALS(vpopmail)
|
||||
ZEND_END_MODULE_GLOBALS(vpopmail)
|
||||
|
||||
#ifdef ZTS
|
||||
#define VPOPMAILG(v) TSRMG(gd_vpopmail_id, php_vpopmail_globals *, v)
|
||||
#define VPOPMAILG(v) TSRMG(vpopmail_globals_id, zend_vpopmail_globals *, v)
|
||||
#else
|
||||
#define VPOPMAILG(v) (vpopmail_globals.v)
|
||||
#endif
|
||||
|
||||
+3
-3
@@ -246,7 +246,7 @@ PS_SERIALIZER_DECODE_FUNC(wddx)
|
||||
zval *retval;
|
||||
zval **ent;
|
||||
char *key;
|
||||
ulong key_length;
|
||||
uint key_length;
|
||||
char tmp[128];
|
||||
ulong idx;
|
||||
int hash_type;
|
||||
@@ -477,7 +477,7 @@ static void php_wddx_serialize_object(wddx_packet *packet, zval *obj)
|
||||
php_wddx_add_chunk_static(packet, WDDX_STRUCT_E);
|
||||
}
|
||||
} else {
|
||||
ulong key_len;
|
||||
uint key_len;
|
||||
|
||||
PHP_CLASS_ATTRIBUTES;
|
||||
|
||||
@@ -524,7 +524,7 @@ static void php_wddx_serialize_array(wddx_packet *packet, zval *arr)
|
||||
{
|
||||
zval **ent;
|
||||
char *key;
|
||||
ulong key_len;
|
||||
uint key_len;
|
||||
int is_struct = 0, ent_type;
|
||||
ulong idx;
|
||||
HashTable *target_hash;
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ else
|
||||
AC_DEFINE(HAVE_LIBEXPAT, 1, [ ])
|
||||
|
||||
for i in $PHP_XML $PHP_EXPAT_DIR; do
|
||||
if test -f $i/lib/libexpat.a -o -f $i/lib/libexpat.s? ; then
|
||||
if test -f $i/lib/libexpat.a -o -f $i/lib/libexpat.$SHLIB_SUFFIX_NAME ; then
|
||||
EXPAT_DIR=$i
|
||||
fi
|
||||
done
|
||||
|
||||
+2
-4
@@ -68,14 +68,12 @@ if test "$PHP_XSLT" != "no"; then
|
||||
found_iconv=no
|
||||
AC_CHECK_LIB(c, iconv_open, found_iconv=yes)
|
||||
if test "$found_iconv" = "no"; then
|
||||
if test "$PHP_ICONV" = "no"; then
|
||||
for i in /usr /usr/local; do
|
||||
for i in /usr /usr/local $ICONV_DIR; do
|
||||
if test -f $i/lib/libconv.a -o -f $i/lib/libiconv.so; then
|
||||
PHP_ADD_LIBRARY_WITH_PATH(iconv, $i/lib)
|
||||
PHP_ADD_LIBRARY_WITH_PATH(iconv, $i/lib, XSLT_SHARED_LIBADD)
|
||||
found_iconv=yes
|
||||
fi
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$found_iconv" = "no"; then
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
Zlib
|
||||
Rasmus Lerdorf, Stefan Roehrich
|
||||
Rasmus Lerdorf, Stefan Roehrich, Zeev Suraski, Jade Nicoletti
|
||||
+3
-3
@@ -14,6 +14,8 @@
|
||||
+----------------------------------------------------------------------+
|
||||
| Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
|
||||
| Stefan Röhrich <sr@linux.de> |
|
||||
| Zeev Suraski <zeev@zend.com> |
|
||||
| Jade Nicoletti <nicoletti@nns.ch> |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
/* $Id$ */
|
||||
@@ -1200,13 +1202,11 @@ PHP_FUNCTION(ob_gzhandler)
|
||||
|
||||
if (return_original) {
|
||||
zval_dtor(return_value);
|
||||
#if 0
|
||||
} else {
|
||||
} else if (do_start && do_end) {
|
||||
char lenbuf[64];
|
||||
|
||||
sprintf(lenbuf,"Content-Length: %d",Z_STRLEN_P(return_value));
|
||||
sapi_add_header(lenbuf,strlen(lenbuf), 1);
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
return_original = 1;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
STD='make -f Makefile.am LEX="flex -L" YACC="bison -y -l" srcdir=.'
|
||||
|
||||
(cd Zend && eval "$STD zend_language_parser.c zend_language_scanner.c zend_language_scanner_cc.cc zend_ini_parser.c zend_ini_scanner.c zend_ini_scanner_cc.cc")
|
||||
(cd Zend && eval "$STD zend_language_parser.c zend_language_scanner.c zend_ini_parser.c zend_ini_scanner.c")
|
||||
|
||||
files="Makefile main/Makefile ext/standard/Makefile"
|
||||
sh build/fastgen.sh . yes no $files
|
||||
|
||||
+7
-5
@@ -985,9 +985,6 @@ void php_module_shutdown(TSRMLS_D)
|
||||
return;
|
||||
}
|
||||
|
||||
/* close down the ini config */
|
||||
php_shutdown_config();
|
||||
|
||||
#ifdef PHP_WIN32
|
||||
/*close winsock */
|
||||
WSACleanup();
|
||||
@@ -1000,12 +997,17 @@ void php_module_shutdown(TSRMLS_D)
|
||||
php_shutdown_fopen_wrappers(TSRMLS_C);
|
||||
php_shutdown_info_logos();
|
||||
UNREGISTER_INI_ENTRIES();
|
||||
|
||||
/* close down the ini config */
|
||||
php_shutdown_config();
|
||||
|
||||
#ifdef ZTS
|
||||
ts_free_thread();
|
||||
#else
|
||||
zend_ini_shutdown(TSRMLS_C);
|
||||
shutdown_memory_manager(0, 1);
|
||||
shutdown_memory_manager(CG(unclean_shutdown), 1);
|
||||
#endif
|
||||
|
||||
module_initialized = 0;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -1305,7 +1307,7 @@ PHPAPI int php_execute_script(zend_file_handle *primary_file TSRMLS_DC)
|
||||
} else {
|
||||
append_file_p = NULL;
|
||||
}
|
||||
zend_execute_scripts(ZEND_REQUIRE TSRMLS_CC, 3, prepend_file_p, primary_file, append_file_p);
|
||||
zend_execute_scripts(ZEND_REQUIRE TSRMLS_CC, NULL, 3, prepend_file_p, primary_file, append_file_p);
|
||||
} zend_end_try();
|
||||
|
||||
if (old_cwd[0] != '\0') {
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@
|
||||
#include <dmalloc.h>
|
||||
#endif
|
||||
|
||||
#define PHP_API_VERSION 20010119
|
||||
#define PHP_API_VERSION 20010901
|
||||
|
||||
#define YYDEBUG 0
|
||||
|
||||
|
||||
+1
-1
@@ -209,7 +209,7 @@ int php_init_config(char *php_ini_path_override)
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
zend_llist_init(&extension_lists.engine, sizeof(zval), (llist_dtor_func_t) free_estring, 1);
|
||||
zend_llist_init(&extension_lists.engine, sizeof(char *), (llist_dtor_func_t) free_estring, 1);
|
||||
zend_llist_init(&extension_lists.functions, sizeof(zval), (llist_dtor_func_t) ZVAL_DESTRUCTOR, 1);
|
||||
|
||||
safe_mode_state = PG(safe_mode);
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
/* automatically generated by configure */
|
||||
/* edit configure.in to change version number */
|
||||
#define PHP_VERSION "4.0.7RC1"
|
||||
#define PHP_VERSION "4.0.7RC3"
|
||||
+60
-28
@@ -102,7 +102,7 @@ void destroy_uploaded_files_hash(TSRMLS_D)
|
||||
*/
|
||||
static void php_mime_split(char *buf, int cnt, char *boundary, zval *array_ptr TSRMLS_DC)
|
||||
{
|
||||
char *ptr, *loc, *loc2, *loc3, *s, *name, *filename, *u, *temp_filename;
|
||||
char *ptr, *loc, *loc2, *loc3, *s, *name, *filename, *u, *temp_filename, c;
|
||||
int len, state = 0, Done = 0, rem, urem;
|
||||
int eolsize;
|
||||
long bytes, max_file_size = 0;
|
||||
@@ -130,14 +130,14 @@ static void php_mime_split(char *buf, int cnt, char *boundary, zval *array_ptr T
|
||||
while ((ptr - buf < cnt) && !Done) {
|
||||
switch (state) {
|
||||
case 0: /* Looking for mime boundary */
|
||||
loc = memchr(ptr, *boundary, cnt);
|
||||
loc = memchr(ptr, *boundary, rem); /* fixed */
|
||||
if (loc) {
|
||||
if (!strncmp(loc, boundary, len)) {
|
||||
|
||||
state = 1;
|
||||
|
||||
eolsize = 2;
|
||||
if(*(loc+len)==0x0a) {
|
||||
if(*(loc+len)=='\n') {
|
||||
eolsize = 1;
|
||||
}
|
||||
|
||||
@@ -163,17 +163,37 @@ static void php_mime_split(char *buf, int cnt, char *boundary, zval *array_ptr T
|
||||
}
|
||||
/* some other headerfield found, skip it */
|
||||
loc = (char *) memchr(ptr, '\n', rem)+1;
|
||||
if (!loc) {
|
||||
/* broken */
|
||||
php_error(E_WARNING, "File Upload Mime headers garbled ptr: [%c%c%c%c%c]", *ptr, *(ptr + 1), *(ptr + 2), *(ptr + 3), *(ptr + 4));
|
||||
SAFE_RETURN;
|
||||
}
|
||||
while (*loc == ' ' || *loc == '\t') {
|
||||
/* other field is folded, skip it */
|
||||
loc = (char *) memchr(loc, '\n', rem-(loc-ptr))+1;
|
||||
if (!loc) {
|
||||
/* broken */
|
||||
php_error(E_WARNING, "File Upload Mime headers garbled ptr: [%c%c%c%c%c]", *ptr, *(ptr + 1), *(ptr + 2), *(ptr + 3), *(ptr + 4));
|
||||
SAFE_RETURN;
|
||||
}
|
||||
}
|
||||
rem -= (loc - ptr);
|
||||
ptr = loc;
|
||||
}
|
||||
loc = memchr(ptr, '\n', rem);
|
||||
if (!loc) {
|
||||
/* broken */
|
||||
php_error(E_WARNING, "File Upload Mime headers garbled ptr: [%c%c%c%c%c]", *ptr, *(ptr + 1), *(ptr + 2), *(ptr + 3), *(ptr + 4));
|
||||
SAFE_RETURN;
|
||||
}
|
||||
while (loc[1] == ' ' || loc[1] == '\t') {
|
||||
/* field is folded, look for end */
|
||||
loc = memchr(loc+1, '\n', rem-(loc-ptr)-1);
|
||||
if (!loc) {
|
||||
/* broken */
|
||||
php_error(E_WARNING, "File Upload Mime headers garbled ptr: [%c%c%c%c%c]", *ptr, *(ptr + 1), *(ptr + 2), *(ptr + 3), *(ptr + 4));
|
||||
SAFE_RETURN;
|
||||
}
|
||||
}
|
||||
name = strstr(ptr, " name=");
|
||||
if (name && name < loc) {
|
||||
@@ -181,13 +201,14 @@ static void php_mime_split(char *buf, int cnt, char *boundary, zval *array_ptr T
|
||||
if ( *name == '\"' ) {
|
||||
name++;
|
||||
s = memchr(name, '\"', loc - name);
|
||||
if(!s) {
|
||||
php_error(E_WARNING, "File Upload Mime headers garbled name: [%c%c%c%c%c]", *name, *(name + 1), *(name + 2), *(name + 3), *(name + 4));
|
||||
SAFE_RETURN;
|
||||
}
|
||||
} else {
|
||||
s = strpbrk(name, " \t()<>@,;:\\\"/[]?=\r\n");
|
||||
}
|
||||
if (!s) {
|
||||
php_error(E_WARNING, "File Upload Mime headers garbled name: [%c%c%c%c%c]", *name, *(name + 1), *(name + 2), *(name + 3), *(name + 4));
|
||||
SAFE_RETURN;
|
||||
}
|
||||
|
||||
if (namebuf) {
|
||||
efree(namebuf);
|
||||
}
|
||||
@@ -197,13 +218,15 @@ static void php_mime_split(char *buf, int cnt, char *boundary, zval *array_ptr T
|
||||
}
|
||||
lbuf = emalloc(s-name + MAX_SIZE_OF_INDEX + 1);
|
||||
state = 2;
|
||||
loc2 = loc;
|
||||
while (loc2[2] != '\n') {
|
||||
/* empty line as end of header not yet found */
|
||||
loc2 = memchr(loc2 + 1, '\n', rem-(loc2-ptr)-1);
|
||||
}
|
||||
rem -= (loc2 - ptr) + 3;
|
||||
ptr = loc2 + 3;
|
||||
|
||||
/* the fix at this position was wrong
|
||||
* the end of headers search was broken
|
||||
* below. fix moved there and restored
|
||||
* pre 4.0.6 code here
|
||||
*/
|
||||
loc2 = memchr(loc + 1, '\n', rem);
|
||||
rem -= (loc2 - ptr) + 1;
|
||||
ptr = loc2 + 1;
|
||||
/* is_arr_upload is true when name of file upload field
|
||||
* ends in [.*]
|
||||
* start_arr is set to point to 1st [
|
||||
@@ -211,9 +234,9 @@ static void php_mime_split(char *buf, int cnt, char *boundary, zval *array_ptr T
|
||||
*/
|
||||
is_arr_upload = (start_arr = strchr(namebuf,'[')) &&
|
||||
(end_arr = strrchr(namebuf,']')) &&
|
||||
(end_arr = namebuf+strlen(namebuf)-1);
|
||||
(end_arr == namebuf+strlen(namebuf)-1);
|
||||
if(is_arr_upload) {
|
||||
arr_len = strlen(start_arr);
|
||||
arr_len = strlen(start_arr); /* is NOW >=2 */
|
||||
if(arr_index) efree(arr_index);
|
||||
arr_index = estrndup(start_arr+1, arr_len-2);
|
||||
}
|
||||
@@ -267,21 +290,26 @@ static void php_mime_split(char *buf, int cnt, char *boundary, zval *array_ptr T
|
||||
s = "";
|
||||
if ((loc2 - loc) > 2) {
|
||||
if (!strncasecmp(loc + 1, "Content-Type:", 13)) {
|
||||
c = *(loc2 - 1);
|
||||
*(loc2 - 1) = '\0';
|
||||
s = loc+15;
|
||||
}
|
||||
loc3=memchr(loc2+1, '\n', rem-1);
|
||||
if (loc3==NULL) {
|
||||
php_error(E_WARNING, "File Upload Mime headers garbled header3: [%c%c%c%c%c]", *loc2, *(loc2 + 1), *(loc2 + 2), *(loc2 + 3), *(loc2 + 4));
|
||||
SAFE_RETURN;
|
||||
}
|
||||
if (loc3 - loc2 > 2) { /* we have a third header */
|
||||
rem -= (ptr-loc3)+3;
|
||||
ptr = loc3+3;
|
||||
} else {
|
||||
rem -= (ptr-loc3)+1;
|
||||
ptr = loc3+1;
|
||||
/* end of header fix fixed and moved here
|
||||
* find the double newline that marks the
|
||||
* end of the headers
|
||||
*/
|
||||
loc3 = loc2;
|
||||
while (loc3[2] != '\n') {
|
||||
|
||||
/* empty line as end of headers not yet found */
|
||||
loc3 = memchr(loc3 + 1, '\n', rem-(loc3-ptr)-1);
|
||||
if (loc3==NULL) {
|
||||
php_error(E_WARNING, "File Upload Mime headers garbled header3: [%c%c%c%c%c]", *loc2, *(loc2 + 1), *(loc2 + 2), *(loc2 + 3), *(loc2 + 4));
|
||||
SAFE_RETURN;
|
||||
}
|
||||
}
|
||||
rem -= (loc3 - ptr) + 3;
|
||||
ptr = loc3 + 3;
|
||||
}
|
||||
|
||||
/* Add $foo_type */
|
||||
@@ -300,7 +328,11 @@ static void php_mime_split(char *buf, int cnt, char *boundary, zval *array_ptr T
|
||||
}
|
||||
register_http_post_files_variable(lbuf, s, http_post_files, 0 TSRMLS_CC);
|
||||
if(*s != '\0') {
|
||||
*(loc2 - 1) = '\n';
|
||||
/* write old char back
|
||||
* most probably it is '\r'
|
||||
* and not '\n'
|
||||
*/
|
||||
*(loc2 - 1) = c;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -0,0 +1,880 @@
|
||||
<?php
|
||||
/* vim: set ts=4 sw=4: */
|
||||
// +----------------------------------------------------------------------+
|
||||
// | PHP version 4.0 |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 1997-2001 The PHP Group |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to version 2.02 of the PHP license, |
|
||||
// | that is bundled with this package in the file LICENSE, and is |
|
||||
// | available at through the world-wide-web at |
|
||||
// | http://www.php.net/license/2_02.txt. |
|
||||
// | If you did not receive a copy of the PHP license and are unable to |
|
||||
// | obtain it through the world-wide-web, please send a note to |
|
||||
// | license@php.net so we can mail you a copy immediately. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Authors: Vincent Blavet <vincent@blavet.net> |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id$
|
||||
|
||||
require_once 'PEAR.php';
|
||||
|
||||
class Archive_Tar extends PEAR
|
||||
{
|
||||
var $_tarname;
|
||||
var $_compress;
|
||||
|
||||
// ----- File descriptor (when file is opened or 0 if closed)
|
||||
var $_file;
|
||||
|
||||
// {{{ constructor
|
||||
function Archive_Tar($p_tarname, $p_compress = false)
|
||||
{
|
||||
$this->PEAR();
|
||||
$this->_tarname = $p_tarname;
|
||||
$this->_compress = $p_compress;
|
||||
}
|
||||
// }}}
|
||||
|
||||
/*
|
||||
// {{{ constructor
|
||||
function Archive_Tar($p_tarname, $p_filelist, $p_compress = false)
|
||||
{
|
||||
$this->PEAR();
|
||||
$this->_tarname = $p_tarname;
|
||||
$this->_compress = $p_compress;
|
||||
|
||||
if (!$this->create($p_filelist))
|
||||
return 0;
|
||||
}
|
||||
// }}}
|
||||
*/
|
||||
|
||||
// {{{ destructor
|
||||
function _Archive_Tar()
|
||||
{
|
||||
$this->_close();
|
||||
$this->_PEAR();
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ create()
|
||||
function create($p_filelist)
|
||||
{
|
||||
return $this->createModify($p_filelist, "", "");
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ add()
|
||||
function add($p_filelist)
|
||||
{
|
||||
return $this->addModify($p_filelist, "", "");
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ extract()
|
||||
function extract($p_path="")
|
||||
{
|
||||
return $this->extractModify($p_path, "");
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ listContent()
|
||||
function listContent()
|
||||
{
|
||||
$v_list_detail = array();
|
||||
|
||||
if ($this->_openRead()) {
|
||||
if (!$this->_extractList("", $v_list_detail, "list", "", "")) {
|
||||
unset($v_list_detail);
|
||||
return(0);
|
||||
}
|
||||
$this->_close();
|
||||
}
|
||||
|
||||
return $v_list_detail;
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ createModify()
|
||||
function createModify($p_filelist, $p_add_dir, $p_remove_dir="")
|
||||
{
|
||||
$v_result = true;
|
||||
|
||||
if (!$this->_openWrite())
|
||||
return false;
|
||||
|
||||
if ($p_filelist != "") {
|
||||
if (is_array($p_filelist))
|
||||
$v_list = $p_filelist;
|
||||
elseif (is_string($p_filelist))
|
||||
$v_list = explode(" ", $p_filelist);
|
||||
else {
|
||||
$this->_cleanFile();
|
||||
$this->_error("Invalid file list");
|
||||
return false;
|
||||
}
|
||||
|
||||
$v_result = $this->_addList($v_list, "", "");
|
||||
}
|
||||
|
||||
if ($v_result) {
|
||||
$this->_writeFooter();
|
||||
$this->_close();
|
||||
} else
|
||||
$this->_cleanFile();
|
||||
|
||||
return $v_result;
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ addModify()
|
||||
function addModify($p_filelist, $p_add_dir, $p_remove_dir="")
|
||||
{
|
||||
$v_result = true;
|
||||
|
||||
if (!@is_file($this->_tarname))
|
||||
$v_result = $this->createModify($p_filelist, $p_add_dir, $p_remove_dir);
|
||||
else {
|
||||
if (is_array($p_filelist))
|
||||
$v_list = $p_filelist;
|
||||
elseif (is_string($p_filelist))
|
||||
$v_list = explode(" ", $p_filelist);
|
||||
else {
|
||||
$this->_error("Invalid file list");
|
||||
return false;
|
||||
}
|
||||
|
||||
$v_result = $this->_append($v_list, $p_add_dir, $p_remove_dir);
|
||||
}
|
||||
|
||||
return $v_result;
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ extractModify()
|
||||
function extractModify($p_path, $p_remove_path)
|
||||
{
|
||||
$v_result = true;
|
||||
$v_list_detail = array();
|
||||
|
||||
if ($v_result = $this->_openRead()) {
|
||||
$v_result = $this->_extractList($p_path, $v_list_detail, "complete", 0, $p_remove_path);
|
||||
$this->_close();
|
||||
}
|
||||
|
||||
return $v_result;
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ extractList()
|
||||
function extractList($p_filelist, $p_path="", $p_remove_path="")
|
||||
{
|
||||
$v_result = true;
|
||||
$v_list_detail = array();
|
||||
|
||||
if (is_array($p_filelist))
|
||||
$v_list = $p_filelist;
|
||||
elseif (is_string($p_filelist))
|
||||
$v_list = explode(" ", $p_filelist);
|
||||
else {
|
||||
$this->_error("Invalid string list");
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($v_result = $this->_openRead()) {
|
||||
$v_result = $this->_extractList($p_path, $v_list_detail, "complete", $v_list, $p_remove_path);
|
||||
$this->_close();
|
||||
}
|
||||
|
||||
return $v_result;
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ _error()
|
||||
function _error($p_message)
|
||||
{
|
||||
// ----- To be completed
|
||||
$this->raiseError($p_message);
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ _warning()
|
||||
function _warning($p_message)
|
||||
{
|
||||
// ----- To be completed
|
||||
$this->raiseError($p_message);
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ _openWrite()
|
||||
function _openWrite()
|
||||
{
|
||||
if ($this->_compress)
|
||||
$this->_file = @gzopen($this->_tarname, "w");
|
||||
else
|
||||
$this->_file = @fopen($this->_tarname, "w");
|
||||
|
||||
if ($this->_file == 0) {
|
||||
$this->_error("Unable to open in write mode '".$this->_tarname."'");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ _openRead()
|
||||
function _openRead()
|
||||
{
|
||||
if ($this->_compress)
|
||||
$this->_file = @gzopen($this->_tarname, "rb");
|
||||
else
|
||||
$this->_file = @fopen($this->_tarname, "rb");
|
||||
|
||||
if ($this->_file == 0) {
|
||||
$this->_error("Unable to open in read mode '".$this->_tarname."'");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ _openReadWrite()
|
||||
function _openReadWrite()
|
||||
{
|
||||
if ($this->_compress)
|
||||
$this->_file = @gzopen($this->_tarname, "r+b");
|
||||
else
|
||||
$this->_file = @fopen($this->_tarname, "r+b");
|
||||
|
||||
if ($this->_file == 0) {
|
||||
$this->_error("Unable to open in read/write mode '".$this->_tarname."'");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ _close()
|
||||
function _close()
|
||||
{
|
||||
if ($this->_file) {
|
||||
if ($this->_compress)
|
||||
@gzclose($this->_file);
|
||||
else
|
||||
@fclose($this->_file);
|
||||
|
||||
$this->_file = 0;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ _cleanFile()
|
||||
function _cleanFile()
|
||||
{
|
||||
_close();
|
||||
@unlink($this->tarname);
|
||||
|
||||
return true;
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ _writeFooter()
|
||||
function _writeFooter()
|
||||
{
|
||||
if ($this->_file) {
|
||||
// ----- Write the last 0 filled block for end of archive
|
||||
$v_binary_data = pack("a512", "");
|
||||
if ($this->_compress)
|
||||
@gzputs($this->_file, $v_binary_data);
|
||||
else
|
||||
@fputs($this->_file, $v_binary_data);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ _addList()
|
||||
function _addList($p_list, $p_add_dir, $p_remove_dir)
|
||||
{
|
||||
$v_result=true;
|
||||
$v_header = array();
|
||||
|
||||
if (!$this->_file) {
|
||||
$this->_error("Invalid file descriptor");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (sizeof($p_list) == 0)
|
||||
return true;
|
||||
|
||||
for ($j=0; ($j<count($p_list)) && ($v_result); $j++) {
|
||||
$v_filename = $p_list[$j];
|
||||
|
||||
// ----- Skip the current tar name
|
||||
if ($v_filename == $this->_tarname)
|
||||
continue;
|
||||
|
||||
if ($v_filename == "")
|
||||
continue;
|
||||
|
||||
if (!file_exists($v_filename)) {
|
||||
$this->_warning("File '$v_filename' does not exist");
|
||||
continue;
|
||||
}
|
||||
|
||||
// ----- Add the file or directory header
|
||||
if (!$this->_addFile($v_filename, $v_header, $p_add_dir, $p_remove_dir))
|
||||
return false;
|
||||
|
||||
if (is_dir($v_filename)) {
|
||||
if (!($p_hdir = opendir($v_filename))) {
|
||||
$this->_warning("Directory '$v_filename' can not be read");
|
||||
continue;
|
||||
}
|
||||
$p_hitem = readdir($p_hdir); // '.' directory
|
||||
$p_hitem = readdir($p_hdir); // '..' directory
|
||||
while ($p_hitem = readdir($p_hdir)) {
|
||||
if ($v_filename != ".")
|
||||
$p_temp_list[0] = $v_filename."/".$p_hitem;
|
||||
else
|
||||
$p_temp_list[0] = $p_hitem;
|
||||
|
||||
$v_result = $this->_addList($p_temp_list, $p_add_dir, $p_remove_dir);
|
||||
}
|
||||
|
||||
unset($p_temp_list);
|
||||
unset($p_hdir);
|
||||
unset($p_hitem);
|
||||
}
|
||||
}
|
||||
|
||||
return $v_result;
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ _addFile()
|
||||
function _addFile($p_filename, &$p_header, $p_add_dir, $p_remove_dir)
|
||||
{
|
||||
if (!$this->_file) {
|
||||
$this->_error("Invalid file descriptor");
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($p_filename == "") {
|
||||
$this->_error("Invalid file name");
|
||||
return false;
|
||||
}
|
||||
|
||||
// ----- Calculate the stored filename
|
||||
$v_stored_filename = $p_filename;
|
||||
if ($p_remove_dir != "") {
|
||||
if (substr($p_remove_dir, -1) != '/')
|
||||
$p_remove_dir .= "/";
|
||||
|
||||
if (substr($p_filename, 0, strlen($p_remove_dir)) == $p_remove_dir)
|
||||
$v_stored_filename = substr($p_filename, strlen($p_remove_dir));
|
||||
}
|
||||
if ($p_add_dir != "") {
|
||||
if (substr($p_add_dir, -1) == "/")
|
||||
$v_stored_filename = $p_add_dir.$v_stored_filename;
|
||||
else
|
||||
$v_stored_filename = $p_add_dir."/".$v_stored_filename;
|
||||
}
|
||||
|
||||
if (strlen($v_stored_filename) > 99) {
|
||||
$this->_warning("Stored file name is too long (max. 99) : '$v_stored_filename'");
|
||||
fclose($v_file);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (is_file($p_filename)) {
|
||||
if (($v_file = @fopen($p_filename, "rb")) == 0) {
|
||||
$this->_warning("Unable to open file '$p_filename' in binary read mode");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!$this->_writeHeader($p_filename, $v_stored_filename))
|
||||
return false;
|
||||
|
||||
while (($v_buffer = fread($v_file, 512)) != "") {
|
||||
$v_binary_data = pack("a512", "$v_buffer");
|
||||
if ($this->_compress)
|
||||
@gzputs($this->_file, $v_binary_data);
|
||||
else
|
||||
@fputs($this->_file, $v_binary_data);
|
||||
}
|
||||
|
||||
fclose($v_file);
|
||||
|
||||
} else {
|
||||
// ----- Only header for dir
|
||||
if (!$this->_writeHeader($p_filename, $v_stored_filename))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ _writeHeader()
|
||||
function _writeHeader($p_filename, $p_stored_filename)
|
||||
{
|
||||
if ($p_stored_filename == "")
|
||||
$p_stored_filename = $p_filename;
|
||||
$v_reduce_filename = $this->_pathReduction($p_stored_filename);
|
||||
|
||||
$v_info = stat($p_filename);
|
||||
$v_uid = sprintf("%6s ", DecOct($v_info[4]));
|
||||
$v_gid = sprintf("%6s ", DecOct($v_info[5]));
|
||||
$v_perms = sprintf("%6s ", DecOct(fileperms($p_filename)));
|
||||
|
||||
clearstatcache();
|
||||
$v_size = sprintf("%11s ", DecOct(filesize($p_filename)));
|
||||
|
||||
$v_mtime = sprintf("%11s", DecOct(filemtime($p_filename)));
|
||||
|
||||
if (is_dir($p_filename))
|
||||
$v_typeflag = "5";
|
||||
else
|
||||
$v_typeflag = "";
|
||||
|
||||
$v_linkname = "";
|
||||
|
||||
$v_magic = "";
|
||||
|
||||
$v_version = "";
|
||||
|
||||
$v_uname = "";
|
||||
|
||||
$v_gname = "";
|
||||
|
||||
$v_devmajor = "";
|
||||
|
||||
$v_devminor = "";
|
||||
|
||||
$v_prefix = "";
|
||||
|
||||
$v_binary_data_first = pack("a100a8a8a8a12A12", $v_reduce_filename, $v_perms, $v_uid, $v_gid, $v_size, $v_mtime);
|
||||
$v_binary_data_last = pack("a1a100a6a2a32a32a8a8a155a12", $v_typeflag, $v_linkname, $v_magic, $v_version, $v_uname, $v_gname, $v_devmajor, $v_devminor, $v_prefix, "");
|
||||
|
||||
// ----- Calculate the checksum
|
||||
$v_checksum = 0;
|
||||
// ..... First part of the header
|
||||
for ($i=0; $i<148; $i++)
|
||||
$v_checksum += ord(substr($v_binary_data_first,$i,1));
|
||||
// ..... Ignore the checksum value and replace it by ' ' (space)
|
||||
for ($i=148; $i<156; $i++)
|
||||
$v_checksum += ord(' ');
|
||||
// ..... Last part of the header
|
||||
for ($i=156, $j=0; $i<512; $i++, $j++)
|
||||
$v_checksum += ord(substr($v_binary_data_last,$j,1));
|
||||
|
||||
// ----- Write the first 148 bytes of the header in the archive
|
||||
if ($this->_compress)
|
||||
@gzputs($this->_file, $v_binary_data_first, 148);
|
||||
else
|
||||
@fputs($this->_file, $v_binary_data_first, 148);
|
||||
|
||||
// ----- Write the calculated checksum
|
||||
$v_checksum = sprintf("%6s ", DecOct($v_checksum));
|
||||
$v_binary_data = pack("a8", $v_checksum);
|
||||
if ($this->_compress)
|
||||
@gzputs($this->_file, $v_binary_data, 8);
|
||||
else
|
||||
@fputs($this->_file, $v_binary_data, 8);
|
||||
|
||||
// ----- Write the last 356 bytes of the header in the archive
|
||||
if ($this->_compress)
|
||||
@gzputs($this->_file, $v_binary_data_last, 356);
|
||||
else
|
||||
@fputs($this->_file, $v_binary_data_last, 356);
|
||||
|
||||
return true;
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ _readHeader()
|
||||
function _readHeader($v_binary_data, &$v_header)
|
||||
{
|
||||
if (strlen($v_binary_data)==0) {
|
||||
$v_header[filename] = "";
|
||||
return true;
|
||||
}
|
||||
|
||||
if (strlen($v_binary_data) != 512) {
|
||||
$v_header[filename] = "";
|
||||
$this->_error("Invalid block size : ".strlen($v_binary_data));
|
||||
return false;
|
||||
}
|
||||
|
||||
// ----- Calculate the checksum
|
||||
$v_checksum = 0;
|
||||
// ..... First part of the header
|
||||
for ($i=0; $i<148; $i++)
|
||||
$v_checksum+=ord(substr($v_binary_data,$i,1));
|
||||
// ..... Ignore the checksum value and replace it by ' ' (space)
|
||||
for ($i=148; $i<156; $i++)
|
||||
$v_checksum += ord(' ');
|
||||
// ..... Last part of the header
|
||||
for ($i=156; $i<512; $i++)
|
||||
$v_checksum+=ord(substr($v_binary_data,$i,1));
|
||||
|
||||
$v_data = unpack("a100filename/a8mode/a8uid/a8gid/a12size/a12mtime/a8checksum/a1typeflag/a100link/a6magic/a2version/a32uname/a32gname/a8devmajor/a8devminor", $v_binary_data);
|
||||
|
||||
// ----- Extract the checksum
|
||||
$v_header[checksum] = OctDec(trim($v_data[checksum]));
|
||||
if ($v_header[checksum] != $v_checksum) {
|
||||
$v_header[filename] = "";
|
||||
|
||||
// ----- Look for last block (empty block)
|
||||
if (($v_checksum == 256) && ($v_header[checksum] == 0))
|
||||
return true;
|
||||
|
||||
$this->_error("Invalid checksum : $v_checksum calculated, ".$v_header[checksum]." expected");
|
||||
return false;
|
||||
}
|
||||
|
||||
// ----- Extract the properties
|
||||
$v_header[filename] = trim($v_data[filename]);
|
||||
$v_header[mode] = OctDec(trim($v_data[mode]));
|
||||
$v_header[uid] = OctDec(trim($v_data[uid]));
|
||||
$v_header[gid] = OctDec(trim($v_data[gid]));
|
||||
$v_header[size] = OctDec(trim($v_data[size]));
|
||||
$v_header[mtime] = OctDec(trim($v_data[mtime]));
|
||||
$v_header[typeflag] = $v_data[typeflag];
|
||||
/* ----- All these fields are removed form the header because they do not carry interesting info
|
||||
$v_header[link] = trim($v_data[link]);
|
||||
$v_header[magic] = trim($v_data[magic]);
|
||||
$v_header[version] = trim($v_data[version]);
|
||||
$v_header[uname] = trim($v_data[uname]);
|
||||
$v_header[gname] = trim($v_data[gname]);
|
||||
$v_header[devmajor] = trim($v_data[devmajor]);
|
||||
$v_header[devminor] = trim($v_data[devminor]);
|
||||
*/
|
||||
|
||||
return true;
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ _extractList()
|
||||
function _extractList($p_path, &$p_list_detail, $p_mode, $p_file_list, $p_remove_path)
|
||||
{
|
||||
$v_result=true;
|
||||
$v_nb = 0;
|
||||
$v_extract_all = true;
|
||||
$v_listing = false;
|
||||
|
||||
if (($p_path == "") || ((substr($p_path, 0, 1) != "/") && (substr($p_path, 0, 3) != "../")))
|
||||
$p_path = "./".$p_path;
|
||||
|
||||
// ----- Look for path to remove format (should end by /)
|
||||
if (($p_remove_path != "") && (substr($p_remove_path, -1) != '/'))
|
||||
$p_remove_path .= '/';
|
||||
$p_remove_path_size = strlen($p_remove_path);
|
||||
|
||||
switch ($p_mode) {
|
||||
case "complete" :
|
||||
$v_extract_all = TRUE;
|
||||
$v_listing = FALSE;
|
||||
break;
|
||||
case "partial" :
|
||||
$v_extract_all = FALSE;
|
||||
$v_listing = FALSE;
|
||||
break;
|
||||
case "list" :
|
||||
$v_extract_all = FALSE;
|
||||
$v_listing = TRUE;
|
||||
break;
|
||||
default :
|
||||
$this->_error("Invalid extract mode ($p_mode)");
|
||||
return false;
|
||||
}
|
||||
|
||||
clearstatcache();
|
||||
|
||||
While (!($v_end_of_file = ($this->_compress?@gzeof($this->_file):@feof($this->_file))))
|
||||
{
|
||||
$v_extract_file = FALSE;
|
||||
$v_extraction_stopped = 0;
|
||||
|
||||
if ($this->_compress)
|
||||
$v_binary_data = @gzread($this->_file, 512);
|
||||
else
|
||||
$v_binary_data = @fread($this->_file, 512);
|
||||
|
||||
if (!$this->_readHeader($v_binary_data, $v_header))
|
||||
return false;
|
||||
|
||||
if ($v_header[filename] == "")
|
||||
continue;
|
||||
|
||||
if ((!$v_extract_all) && (is_array($p_file_list))) {
|
||||
// ----- By default no unzip if the file is not found
|
||||
$v_extract_file = false;
|
||||
|
||||
for ($i=0; $i<sizeof($p_file_list); $i++) {
|
||||
// ----- Look if it is a directory
|
||||
if (substr($p_file_list[$i], -1) == "/") {
|
||||
// ----- Look if the directory is in the filename path
|
||||
if ((strlen($v_header[filename]) > strlen($p_file_list[$i])) && (substr($v_header[filename], 0, strlen($p_file_list[$i])) == $p_file_list[$i])) {
|
||||
$v_extract_file = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// ----- It is a file, so compare the file names
|
||||
elseif ($p_file_list[$i] == $v_header[filename]) {
|
||||
$v_extract_file = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$v_extract_file = TRUE;
|
||||
}
|
||||
|
||||
// ----- Look if this file need to be extracted
|
||||
if (($v_extract_file) && (!$v_listing))
|
||||
{
|
||||
if (($p_remove_path != "")
|
||||
&& (substr($v_header[filename], 0, $p_remove_path_size) == $p_remove_path))
|
||||
$v_header[filename] = substr($v_header[filename], $p_remove_path_size);
|
||||
|
||||
if (($p_path != "./") && ($p_path != "/")) {
|
||||
while (substr($p_path, -1) == "/")
|
||||
$p_path = substr($p_path, 0, strlen($p_path)-1);
|
||||
|
||||
if (substr($v_header[filename], 0, 1) == "/")
|
||||
$v_header[filename] = $p_path.$v_header[filename];
|
||||
else
|
||||
$v_header[filename] = $p_path."/".$v_header[filename];
|
||||
}
|
||||
|
||||
if (file_exists($v_header[filename])) {
|
||||
if ((is_dir($v_header[filename])) && ($v_header[typeflag] == "")) {
|
||||
$this->_error("File '$v_header[filename]' already exists as a directory");
|
||||
return false;
|
||||
}
|
||||
if ((is_file($v_header[filename])) && ($v_header[typeflag] == "5")) {
|
||||
$this->_error("Directory '$v_header[filename]' already exists as a file");
|
||||
return false;
|
||||
}
|
||||
if (!is_writeable($v_header[filename])) {
|
||||
$this->_error("File '$v_header[filename]' already exists and is write protected");
|
||||
return false;
|
||||
}
|
||||
if (filemtime($v_header[filename]) > $v_header[mtime]) {
|
||||
// To be completed : An error or silent no replace ?
|
||||
}
|
||||
}
|
||||
|
||||
// ----- Check the directory availability and create it if necessary
|
||||
elseif (($v_result = $this->_dirCheck(($v_header[typeflag] == "5"?$v_header[filename]:dirname($v_header[filename])))) != 1) {
|
||||
$this->_error("Unable to create path for '$v_header[filename]'");
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($v_extract_file) {
|
||||
if ($v_header[typeflag] == "5") {
|
||||
if (!@file_exists($v_header[filename])) {
|
||||
if (!@mkdir($v_header[filename], 0777)) {
|
||||
$this->_error("Unable to create directory '".$v_header[filename]."'");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (($v_dest_file = @fopen($v_header[filename], "wb")) == 0) {
|
||||
$this->_error("Error while opening '$v_header[filename]' in write binary mode");
|
||||
return false;
|
||||
} else {
|
||||
$n = floor($v_header[size]/512);
|
||||
for ($i=0; $i<$n; $i++) {
|
||||
if ($this->_compress)
|
||||
$v_content = @gzread($this->_file, 512);
|
||||
else
|
||||
$v_content = @fread($this->_file, 512);
|
||||
fwrite($v_dest_file, $v_content, 512);
|
||||
}
|
||||
if (($v_header[size] % 512) != 0) {
|
||||
if ($this->_compress)
|
||||
$v_content = @gzread($this->_file, 512);
|
||||
else
|
||||
$v_content = @fread($this->_file, 512);
|
||||
fwrite($v_dest_file, $v_content, ($v_header[size] % 512));
|
||||
}
|
||||
|
||||
@fclose($v_dest_file);
|
||||
|
||||
// ----- Change the file mode, mtime
|
||||
@touch($v_header[filename], $v_header[mtime]);
|
||||
// To be completed
|
||||
//chmod($v_header[filename], DecOct($v_header[mode]));
|
||||
}
|
||||
|
||||
// ----- Check the file size
|
||||
if (filesize($v_header[filename]) != $v_header[size]) {
|
||||
$this->_error("Extracted file '$v_header[filename]' does not have the correct file size '".filesize($v_filename)."' ('$v_header[size]' expected). Archive may be corrupted.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// ----- Jump to next file
|
||||
if ($this->_compress)
|
||||
@gzseek($this->_file, @gztell($this->_file)+(ceil(($v_header[size]/512))*512));
|
||||
else
|
||||
@fseek($this->_file, @ftell($this->_file)+(ceil(($v_header[size]/512))*512));
|
||||
}
|
||||
} else {
|
||||
// ----- Jump to next file
|
||||
if ($this->_compress)
|
||||
@gzseek($this->_file, @gztell($this->_file)+(ceil(($v_header[size]/512))*512));
|
||||
else
|
||||
@fseek($this->_file, @ftell($this->_file)+(ceil(($v_header[size]/512))*512));
|
||||
}
|
||||
|
||||
if ($this->_compress)
|
||||
$v_end_of_file = @gzeof($this->_file);
|
||||
else
|
||||
$v_end_of_file = @feof($this->_file);
|
||||
|
||||
if ($v_listing || $v_extract_file || $v_extraction_stopped) {
|
||||
// ----- Log extracted files
|
||||
if (($v_file_dir = dirname($v_header[filename])) == $v_header[filename])
|
||||
$v_file_dir = "";
|
||||
if ((substr($v_header[filename], 0, 1) == "/") && ($v_file_dir == ""))
|
||||
$v_file_dir = "/";
|
||||
|
||||
$p_list_detail[$v_nb++] = $v_header;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ _append()
|
||||
function _append($p_filelist, $p_add_dir="", $p_remove_dir="")
|
||||
{
|
||||
if ($this->_compress) {
|
||||
$this->_close();
|
||||
|
||||
if (!@rename($this->_tarname, $this->_tarname.".tmp")) {
|
||||
$this->_error("Error while renaming '".$this->_tarname."' to temporary file '".$this->_tarname.".tmp'");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (($v_temp_tar = @gzopen($this->_tarname.".tmp", "rb")) == 0) {
|
||||
$this->_error("Unable to open file '".$this->_tarname.".tmp' in binary read mode");
|
||||
@rename($this->_tarname.".tmp", $this->_tarname);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$this->_openWrite()) {
|
||||
@rename($this->_tarname.".tmp", $this->_tarname);
|
||||
return false;
|
||||
}
|
||||
|
||||
$v_buffer = @gzread($v_temp_tar, 512);
|
||||
|
||||
// ----- Read the following blocks but not the last one
|
||||
if (!@gzeof($v_temp_tar)) {
|
||||
do{
|
||||
$v_binary_data = pack("a512", "$v_buffer");
|
||||
@gzputs($this->_file, $v_binary_data);
|
||||
$v_buffer = @gzread($v_temp_tar, 512);
|
||||
|
||||
} while (!@gzeof($v_temp_tar));
|
||||
}
|
||||
|
||||
if ($this->_addList($p_filelist, $p_add_dir, $p_remove_dir))
|
||||
$this->_writeFooter();
|
||||
|
||||
$this->_close();
|
||||
@gzclose($v_temp_tar);
|
||||
|
||||
if (!@unlink($this->_tarname.".tmp")) {
|
||||
$this->_error("Error while deleting temporary file '".$this->_tarname.".tmp'");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ----- For not compressed tar, just add files before the last 512 bytes block
|
||||
if (!$this->_openReadWrite())
|
||||
return false;
|
||||
|
||||
$v_size = filesize($this->_tarname);
|
||||
fseek($this->_file, $v_size-512);
|
||||
|
||||
if ($this->_addList($p_filelist, $p_add_dir, $p_remove_dir))
|
||||
$this->_writeFooter();
|
||||
|
||||
$this->_close();
|
||||
|
||||
return true;
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ _dirCheck()
|
||||
function _dirCheck($p_dir)
|
||||
{
|
||||
if ((is_dir($p_dir)) || ($p_dir == ""))
|
||||
return true;
|
||||
|
||||
$p_parent_dir = dirname($p_dir);
|
||||
|
||||
if (($p_parent_dir != $p_dir) &&
|
||||
($p_parent_dir != "") &&
|
||||
(!$this->_dirCheck($p_parent_dir)))
|
||||
return false;
|
||||
|
||||
if (!@mkdir($p_dir, 0777)) {
|
||||
$this->_error("Unable to create directory '$p_dir'");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
// }}}
|
||||
|
||||
// {{{ _pathReduction()
|
||||
function _pathReduction($p_dir)
|
||||
{
|
||||
$v_result = "";
|
||||
|
||||
// ----- Look for not empty path
|
||||
if ($p_dir != "") {
|
||||
// ----- Explode path by directory names
|
||||
$v_list = explode("/", $p_dir);
|
||||
|
||||
// ----- Study directories from last to first
|
||||
for ($i=sizeof($v_list)-1; $i>=0; $i--) {
|
||||
// ----- Look for current path
|
||||
if ($v_list[$i] == ".") {
|
||||
// ----- Ignore this directory
|
||||
// Should be the first $i=0, but no check is done
|
||||
}
|
||||
else if ($v_list[$i] == "..") {
|
||||
// ----- Ignore it and ignore the $i-1
|
||||
$i--;
|
||||
}
|
||||
else if (($v_list[$i] == "") && ($i!=(sizeof($v_list)-1)) && ($i!=0)) {
|
||||
// ----- Ignore only the double '//' in path,
|
||||
// but not the first and last '/'
|
||||
} else {
|
||||
$v_result = $v_list[$i].($i!=(sizeof($v_list)-1)?"/".$v_result:"");
|
||||
}
|
||||
}
|
||||
}
|
||||
return $v_result;
|
||||
}
|
||||
// }}}
|
||||
|
||||
}
|
||||
?>
|
||||
+2
-248
@@ -4,251 +4,5 @@
|
||||
|
||||
$Id$
|
||||
|
||||
-------------
|
||||
[1] Indenting
|
||||
=============
|
||||
|
||||
Use an indent of 4 spaces, with no tabs. If you use Emacs to edit PEAR
|
||||
code, you should set indent-tabs-mode to nil. Here is an example mode
|
||||
hook that will set up Emacs according to these guidelines (you will
|
||||
need to ensure that it is called when you are editing php files):
|
||||
|
||||
(defun php-mode-hook ()
|
||||
(setq tab-width 4
|
||||
c-basic-offset 4
|
||||
c-hanging-comment-ender-p nil
|
||||
indent-tabs-mode
|
||||
(not
|
||||
(and (string-match "/\\(PEAR\\|pear\\)/" (buffer-file-name))
|
||||
(string-match "\.php$" (buffer-file-name))))))
|
||||
|
||||
Here are vim rules for the same thing:
|
||||
|
||||
set expandtab
|
||||
set shiftwidth=4
|
||||
set tabstop=4
|
||||
|
||||
|
||||
----------------------
|
||||
[2] Control Structures
|
||||
======================
|
||||
|
||||
These include if, for, while, switch, etc. Here is an example if statement,
|
||||
since it is the most complicated of them:
|
||||
|
||||
if ((condition1) || (condition2)) {
|
||||
action1;
|
||||
} elseif ((condition3) && (condition4)) {
|
||||
action2;
|
||||
} else {
|
||||
defaultaction;
|
||||
}
|
||||
|
||||
Control statements should have one space between the control keyword
|
||||
and opening parenthesis, to distinguish them from function calls.
|
||||
|
||||
You are strongly encouraged to always use curly braces even in
|
||||
situations where they are technically optional. Having them increases
|
||||
readability and decreases the likelihood of logic errors being
|
||||
introduced when new lines are added.
|
||||
|
||||
For switch statements:
|
||||
|
||||
switch (condition) {
|
||||
case 1:
|
||||
action1;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
action2;
|
||||
break;
|
||||
|
||||
default:
|
||||
defaultaction;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
|
||||
------------------
|
||||
[3] Function Calls
|
||||
==================
|
||||
|
||||
Functions should be called with no spaces between the function name,
|
||||
the opening parenthesis, and the first parameter; spaces between commas
|
||||
and each parameter, and no space between the last parameter, the
|
||||
closing parenthesis, and the semicolon. Here's an example:
|
||||
|
||||
$var = foo($bar, $baz, $quux);
|
||||
|
||||
As displayed above, there should be one space on either side of an
|
||||
equals sign used to assign the return value of a function to a
|
||||
variable. In the case of a block of related assignments, more space
|
||||
may be inserted to promote readability:
|
||||
|
||||
$short = foo($bar);
|
||||
$long_variable = foo($baz);
|
||||
|
||||
|
||||
------------------------
|
||||
[4] Function Definitions
|
||||
========================
|
||||
|
||||
Function declaractions follow the "one true brace" convention:
|
||||
|
||||
function fooFunction($arg1, $arg2 = '')
|
||||
{
|
||||
if (condition) {
|
||||
statement;
|
||||
}
|
||||
return $val;
|
||||
}
|
||||
|
||||
Arguments with default values go at the end of the argument list.
|
||||
Always attempt to return a meaningful value from a function if one is
|
||||
appropriate. Here is a slightly longer example:
|
||||
|
||||
function connect(&$dsn, $persistent = false)
|
||||
{
|
||||
if (is_array($dsn)) {
|
||||
$dsninfo = &$dsn;
|
||||
} else {
|
||||
$dsninfo = DB::parseDSN($dsn);
|
||||
}
|
||||
|
||||
if (!$dsninfo || !$dsninfo['phptype']) {
|
||||
return $this->raiseError();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Functions should be named using the "studly caps" style (also referred to as
|
||||
"bumpy case" or "camel caps"). The initial letter of the name is lowercase,
|
||||
and each letter that starts a new "word" is capitalized. Some examples:
|
||||
|
||||
connect() getData() buildSomeWidget()
|
||||
|
||||
Private class members (meaning class members that an intented to be used
|
||||
only from within the same class in which they are declared; PHP does not yet
|
||||
support truly-enforceable private namespaces) are preceeded by a single
|
||||
underscore. For example:
|
||||
|
||||
_sort() _initTree() $_status
|
||||
|
||||
|
||||
------------
|
||||
[5] Comments
|
||||
============
|
||||
|
||||
Inline documentation for classes should follow the PHPDoc convention, similar
|
||||
to Javadoc. More information about PHPDoc can be found here:
|
||||
|
||||
http://www.phpdoc.de/
|
||||
|
||||
Non-documentation comments are strongly encouraged. A general rule of
|
||||
thumb is that if you look at a section of code and think "Wow, I don't
|
||||
want to try and describe that", you need to comment it before you
|
||||
forget how it works.
|
||||
|
||||
C++ style comments (/* */) and standard C comments (// ) are both
|
||||
fine. Use of perl/shell style comments (# ) is discouraged.
|
||||
|
||||
|
||||
------------------
|
||||
[6] Including Code
|
||||
==================
|
||||
|
||||
Anywhere you are unconditionally including a class file, use
|
||||
require_once. Anywhere you are conditionally including a class file
|
||||
(for example, factory methods), use include_once. Either of these will
|
||||
ensure that class files are included only once. They share the same
|
||||
file list, so you don't need to worry about mixing them - a file
|
||||
included with require_once will not be included again by include_once.
|
||||
|
||||
Note: include_once and require_once are statements, not functions. You
|
||||
don't need parentheses around the filename to be included.
|
||||
|
||||
|
||||
-----------------
|
||||
[7] PHP Code Tags
|
||||
=================
|
||||
|
||||
ALWAYS use <?php ?> to delimit PHP code, not the <? ?> shorthand.
|
||||
This is required for PEAR compliance and is also the most portable way
|
||||
to include PHP code on differing operating systems and setups.
|
||||
|
||||
|
||||
-------------------------
|
||||
[8] Header Comment Blocks
|
||||
=========================
|
||||
|
||||
All source code files in the core PEAR distribution should contain the
|
||||
following comment block as the header:
|
||||
|
||||
/* vim: set expandtab tabstop=4 shiftwidth=4: */
|
||||
// +----------------------------------------------------------------------+
|
||||
// | PHP version 4.0 |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | This source file is subject to version 2.0 of the PHP license, |
|
||||
// | that is bundled with this package in the file LICENSE, and is |
|
||||
// | available at through the world-wide-web at |
|
||||
// | http://www.php.net/license/2_02.txt. |
|
||||
// | If you did not receive a copy of the PHP license and are unable to |
|
||||
// | obtain it through the world-wide-web, please send a note to |
|
||||
// | license@php.net so we can mail you a copy immediately. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Authors: Original Author <author@example.com> |
|
||||
// | Your Name <you@example.com> |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id$
|
||||
|
||||
There's no hard rule to determine when a new code contributer should be
|
||||
added to the list of authors for a given source file. In general, their
|
||||
changes should fall into the "substantial" category (meaning somewhere
|
||||
around 10% to 20% of code changes). Exceptions could be made for rewriting
|
||||
functions or contributing new logic.
|
||||
|
||||
Simple code reorganization or bug fixes would not justify the addition of a
|
||||
new individual to the list of authors.
|
||||
|
||||
Files not in the core PEAR repository should have a similar block
|
||||
stating the copyright, the license, and the authors. All files should
|
||||
include the modeline comments to encourage consistency.
|
||||
|
||||
|
||||
------------
|
||||
[9] CVS Tags
|
||||
============
|
||||
|
||||
Include the <dollar>Id CVS vendor tag in each file. As each
|
||||
file is edited, add this tag if it's not yet present (or replace existing
|
||||
forms such as "Last Modified:", etc.).
|
||||
|
||||
[NOTE: we have a custom $Horde tag in Horde cvs to track our versions
|
||||
seperately; we could do the same and make a $PEAR tag, that would remain even
|
||||
if PEAR files were put into another source control system, etc...]
|
||||
|
||||
|
||||
-----------------
|
||||
[10] Example URLs
|
||||
=================
|
||||
|
||||
Use "example.com" for all example URLs, per RFC 2606.
|
||||
|
||||
|
||||
---------------------
|
||||
[11] Naming Constants
|
||||
=====================
|
||||
|
||||
Constants should always be uppercase, with underscores to seperate
|
||||
words. Prefix constant names with the name of the class/package they
|
||||
are used in. For example, the constants used by the DB:: package all
|
||||
begin with "DB_".
|
||||
|
||||
True and false are built in to the php language and behave like
|
||||
constants, but should be written in lowercase to distinguish them from
|
||||
user-defined constants.
|
||||
This document is no longer maintained, see
|
||||
http://php.net/manual/en/pear.standards.php instead.
|
||||
+15
-12
@@ -10,6 +10,7 @@ include $(top_srcdir)/build/rules.mk
|
||||
peardir=$(PEAR_INSTALLDIR)
|
||||
|
||||
PEAR_SUBDIRS = \
|
||||
Archive \
|
||||
Benchmark \
|
||||
Cache \
|
||||
Cache/Container \
|
||||
@@ -29,24 +30,25 @@ PEAR_SUBDIRS = \
|
||||
Payment \
|
||||
PEAR \
|
||||
Schedule \
|
||||
XML \
|
||||
XML/RPC
|
||||
XML
|
||||
|
||||
PEAR_FILES = \
|
||||
Archive/Tar.php \
|
||||
Benchmark/Iterate.php \
|
||||
Benchmark/Timer.php \
|
||||
Cache.php \
|
||||
Cache/Container.php \
|
||||
Cache/Function.php \
|
||||
Cache/Graphics.php \
|
||||
Cache/Output.php \
|
||||
Cache/Error.php \
|
||||
Cache/OutputCompression.php \
|
||||
Cache/Container.php \
|
||||
Cache/Container/db.php \
|
||||
Cache/Container/dbx.php \
|
||||
Cache/Container/file.php \
|
||||
Cache/Container/phplib.php \
|
||||
Cache/Container/shm.php \
|
||||
Cache/DB.php \
|
||||
Cache/Function.php \
|
||||
Cache/Graphics.php \
|
||||
Cache/Output.php \
|
||||
Cache/OutputCompression.php \
|
||||
Console/Getopt.php \
|
||||
Crypt/CBC.php \
|
||||
Crypt/HCEMD5.php \
|
||||
@@ -83,7 +85,7 @@ PEAR_FILES = \
|
||||
Log/composite.php \
|
||||
Log/file.php \
|
||||
Log/mcal.php \
|
||||
Log/observer.php \
|
||||
Log/Observer.php \
|
||||
Log/sql.php \
|
||||
Log/syslog.php \
|
||||
Mail.php \
|
||||
@@ -104,9 +106,7 @@ PEAR_FILES = \
|
||||
PEAR/Uploader.php \
|
||||
Payment/Verisign.php \
|
||||
Schedule/At.php \
|
||||
XML/Parser.php \
|
||||
XML/RPC.php \
|
||||
XML/RPC/Server.php
|
||||
XML/Parser.php
|
||||
|
||||
install-data-local:
|
||||
@if $(mkinstalldirs) $(INSTALL_ROOT)$(peardir); then \
|
||||
@@ -140,7 +140,7 @@ BUILD_FILES = \
|
||||
dynlib.m4 \
|
||||
acinclude.m4
|
||||
|
||||
bin_SCRIPTS = phpize php-config pear pearize
|
||||
bin_SCRIPTS = phpize php-config pear pearize phptar
|
||||
|
||||
install-build:
|
||||
$(mkinstalldirs) $(INSTALL_ROOT)$(phpbuilddir) $(INSTALL_ROOT)$(bindir) && \
|
||||
@@ -185,6 +185,9 @@ scripts/pear: scripts/pear.in $(top_builddir)/config.status
|
||||
scripts/phpize: scripts/phpize.in $(top_builddir)/config.status
|
||||
(cd ..;CONFIG_FILES=pear/scripts/phpize CONFIG_HEADERS= $(top_builddir)/config.status)
|
||||
|
||||
scripts/phptar: scripts/phptar.in $(top_builddir)/config.status
|
||||
(cd ..;CONFIG_FILES=pear/scripts/phptar CONFIG_HEADERS= $(top_builddir)/config.status)
|
||||
|
||||
scripts/pearize: scripts/pearize.in $(top_builddir)/config.status
|
||||
(cd ..;CONFIG_FILES=pear/scripts/pearize CONFIG_HEADERS= $(top_builddir)/config.status)
|
||||
|
||||
|
||||
+1
-1
@@ -366,7 +366,7 @@ class PEAR
|
||||
$message = $message->getMessage();
|
||||
}
|
||||
|
||||
if (sizeof($this->_expected_errors) > 0 && in_array($code, end($this->_expected_errors))) {
|
||||
if (isset($this) && isset($this->_expected_errors) && sizeof($this->_expected_errors) > 0 && in_array($code, end($this->_expected_errors))) {
|
||||
$mode = PEAR_ERROR_RETURN;
|
||||
}
|
||||
|
||||
|
||||
+135
-53
@@ -14,6 +14,7 @@
|
||||
// | license@php.net so we can mail you a copy immediately. |
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Authors: Stig Bakken <ssb@fast.no> |
|
||||
// | Tomas V.V.Cox <cox@idecnet.com> |
|
||||
// | |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
@@ -26,7 +27,7 @@ require_once 'PEAR.php';
|
||||
* - check in inforFromDescFile that the minimal data needed is present
|
||||
* (pack name, version, files, others?)
|
||||
* - perhaps use parser folding to be less restrictive with the format
|
||||
of the package.xml file
|
||||
* of the package.xml file
|
||||
*/
|
||||
class PEAR_Common extends PEAR
|
||||
{
|
||||
@@ -47,6 +48,16 @@ class PEAR_Common extends PEAR
|
||||
/** assoc with information about a package */
|
||||
var $pkginfo = array();
|
||||
|
||||
/**
|
||||
* Permitted maintainer roles
|
||||
* @var array
|
||||
*/
|
||||
var $maintainer_roles = array('lead','developer','contributor','helper');
|
||||
/**
|
||||
* Permitted release states
|
||||
* @var array
|
||||
*/
|
||||
var $releases_states = array('alpha','beta','stable','snapshot');
|
||||
// }}}
|
||||
|
||||
// {{{ constructor
|
||||
@@ -119,25 +130,50 @@ class PEAR_Common extends PEAR
|
||||
{
|
||||
array_push($this->element_stack, $name);
|
||||
$this->current_element = $name;
|
||||
$this->prev_element = $this->element_stack[sizeof($this->element_stack)-2];
|
||||
$this->current_attributes = $attribs;
|
||||
switch ($name) {
|
||||
case 'Dir':
|
||||
case 'DIR':
|
||||
if (isset($this->dir_names)) {
|
||||
$this->dir_names[] = $attribs['Name'];
|
||||
$this->dir_names[] = $attribs['NAME'];
|
||||
} else {
|
||||
// Don't add the root dir
|
||||
$this->dir_names = array();
|
||||
}
|
||||
if (isset($attribs['BaseInstallDir'])) {
|
||||
$this->dir_install = $attribs['BaseInstallDir'];
|
||||
if (isset($attribs['BASEINSTALLDIR'])) {
|
||||
$this->dir_install = $attribs['BASEINSTALLDIR'];
|
||||
}
|
||||
if (isset($attribs['Role'])) {
|
||||
$this->dir_role = $attribs['Role'];
|
||||
if (isset($attribs['ROLE'])) {
|
||||
$this->dir_role = $attribs['ROLE'];
|
||||
}
|
||||
break;
|
||||
case 'LibFile':
|
||||
case 'LIBFILE':
|
||||
$this->lib_atts = $attribs;
|
||||
$this->lib_atts['Role'] = 'extension';
|
||||
$this->lib_atts['ROLE'] = 'extension';
|
||||
break;
|
||||
case 'MAINTAINERS':
|
||||
$this->pkginfo['maintainers'] = array();
|
||||
$this->m_i = 0; // maintainers array index
|
||||
break;
|
||||
case 'MAINTAINER':
|
||||
// compatibility check
|
||||
if (!isset($this->pkginfo['maintainers'])) {
|
||||
$this->pkginfo['maintainers'] = array();
|
||||
$this->m_i = 0;
|
||||
}
|
||||
$this->pkginfo['maintainers'][$this->m_i] = array();
|
||||
$this->current_maintainer =& $this->pkginfo['maintainers'][$this->m_i];
|
||||
break;
|
||||
case 'CHANGELOG':
|
||||
$this->pkginfo['changelog'] = array();
|
||||
$this->c_i = 0; // changelog array index
|
||||
$this->in_changelog = true;
|
||||
break;
|
||||
case 'RELEASE':
|
||||
if ($this->in_changelog) {
|
||||
$this->pkginfo['changelog'][$this->c_i] = array();
|
||||
$this->current_release =& $this->pkginfo['changelog'][$this->c_i];
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -148,12 +184,12 @@ class PEAR_Common extends PEAR
|
||||
function _element_end($xp, $name)
|
||||
{
|
||||
switch ($name) {
|
||||
case 'Dir':
|
||||
case 'DIR':
|
||||
array_pop($this->dir_names);
|
||||
unset($this->dir_install);
|
||||
unset($this->dir_role);
|
||||
break;
|
||||
case 'File':
|
||||
case 'FILE':
|
||||
$path = '';
|
||||
foreach ($this->dir_names as $dir) {
|
||||
$path .= $dir . DIRECTORY_SEPARATOR;
|
||||
@@ -161,17 +197,17 @@ class PEAR_Common extends PEAR
|
||||
$path .= $this->current_file;
|
||||
$this->filelist[$path] = $this->current_attributes;
|
||||
// Set the baseinstalldir only if the file don't have this attrib
|
||||
if (!isset($this->filelist[$path]['BaseInstallDir']) &&
|
||||
if (!isset($this->filelist[$path]['BASEINSTALLDIR']) &&
|
||||
isset($this->dir_install))
|
||||
{
|
||||
$this->filelist[$path]['BaseInstallDir'] = $this->dir_install;
|
||||
$this->filelist[$path]['BASEINSTALLDIR'] = $this->dir_install;
|
||||
}
|
||||
// Set the Role
|
||||
if (!isset($this->filelist[$path]['Role']) && isset($this->dir_role)) {
|
||||
$this->filelist[$path]['Role'] = $this->dir_role;
|
||||
if (!isset($this->filelist[$path]['ROLE']) && isset($this->dir_role)) {
|
||||
$this->filelist[$path]['ROLE'] = $this->dir_role;
|
||||
}
|
||||
break;
|
||||
case 'LibFile':
|
||||
case 'LIBFILE':
|
||||
$path = '';
|
||||
foreach ($this->dir_names as $dir) {
|
||||
$path .= $dir . DIRECTORY_SEPARATOR;
|
||||
@@ -179,10 +215,10 @@ class PEAR_Common extends PEAR
|
||||
$path .= $this->lib_name;
|
||||
$this->filelist[$path] = $this->lib_atts;
|
||||
// Set the baseinstalldir only if the file don't have this attrib
|
||||
if (!isset($this->filelist[$path]['BaseInstallDir']) &&
|
||||
if (!isset($this->filelist[$path]['BASEINSTALLDIR']) &&
|
||||
isset($this->dir_install))
|
||||
{
|
||||
$this->filelist[$path]['BaseInstallDir'] = $this->dir_install;
|
||||
$this->filelist[$path]['BASEINSTALLDIR'] = $this->dir_install;
|
||||
}
|
||||
if (isset($this->lib_sources)) {
|
||||
$this->filelist[$path]['sources'] = $this->lib_sources;
|
||||
@@ -190,6 +226,16 @@ class PEAR_Common extends PEAR
|
||||
unset($this->lib_atts);
|
||||
unset($this->lib_sources);
|
||||
break;
|
||||
case 'MAINTAINER':
|
||||
$this->m_i++;
|
||||
break;
|
||||
case 'RELEASE':
|
||||
if ($this->in_changelog) {
|
||||
$this->c_i++;
|
||||
}
|
||||
break;
|
||||
case 'CHANGELOG':
|
||||
$this->in_changelog = false;
|
||||
}
|
||||
array_pop($this->element_stack);
|
||||
$this->current_element = $this->element_stack[sizeof($this->element_stack)-1];
|
||||
@@ -200,51 +246,73 @@ class PEAR_Common extends PEAR
|
||||
|
||||
function _pkginfo_cdata($xp, $data)
|
||||
{
|
||||
$prev = $this->element_stack[sizeof($this->element_stack)-2];
|
||||
switch ($this->current_element) {
|
||||
case 'Name':
|
||||
switch ($prev) {
|
||||
case 'Package':
|
||||
case 'NAME':
|
||||
switch ($this->prev_element) {
|
||||
case 'PACKAGE':
|
||||
$this->pkginfo['package'] .= $data;
|
||||
break;
|
||||
case 'Maintainer':
|
||||
$this->pkginfo['maintainer_name'] .= $data;
|
||||
case 'MAINTAINER':
|
||||
$this->current_maintainer['name'] .= $data;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'Summary':
|
||||
case 'SUMMARY':
|
||||
$this->pkginfo['summary'] .= $data;
|
||||
break;
|
||||
case 'Initials':
|
||||
$this->pkginfo['maintainer_handle'] .= $data;
|
||||
case 'INITIALS':
|
||||
$this->current_maintainer['handle'] .= $data;
|
||||
break;
|
||||
case 'Email':
|
||||
$this->pkginfo['maintainer_email'] .= $data;
|
||||
case 'EMAIL':
|
||||
$this->current_maintainer['email'] .= $data;
|
||||
break;
|
||||
case 'Version':
|
||||
$this->pkginfo['version'] .= $data;
|
||||
break;
|
||||
case 'Date':
|
||||
$this->pkginfo['release_date'] .= $data;
|
||||
break;
|
||||
case 'Notes':
|
||||
$this->pkginfo['release_notes'] .= $data;
|
||||
break;
|
||||
case 'Dir':
|
||||
if (!$this->phpdir) {
|
||||
break;
|
||||
case 'ROLE':
|
||||
if (!in_array($data, $this->maintainer_roles)) {
|
||||
trigger_error("The maintainer role: '$data' is not valid", E_USER_WARNING);
|
||||
} else {
|
||||
$this->current_maintainer['role'] .= $data;
|
||||
}
|
||||
$dir = trim($data);
|
||||
// XXX add to file list
|
||||
break;
|
||||
case 'File':
|
||||
$role = strtolower($this->current_attributes['Role']);
|
||||
case 'VERSION':
|
||||
if ($this->in_changelog) {
|
||||
$this->current_release['version'] .= $data;
|
||||
} else {
|
||||
$this->pkginfo['version'] .= $data;
|
||||
}
|
||||
break;
|
||||
case 'DATE':
|
||||
if ($this->in_changelog) {
|
||||
$this->current_release['release_date'] .= $data;
|
||||
} else {
|
||||
$this->pkginfo['release_date'] .= $data;
|
||||
}
|
||||
break;
|
||||
case 'NOTES':
|
||||
if ($this->in_changelog) {
|
||||
$this->current_release['release_notes'] .= $data;
|
||||
} else {
|
||||
$this->pkginfo['release_notes'] .= $data;
|
||||
}
|
||||
break;
|
||||
case 'STATE':
|
||||
if (!in_array($data, $this->releases_states)) {
|
||||
trigger_error("The release state: '$data' is not valid", E_USER_WARNING);
|
||||
} elseif ($this->in_changelog) {
|
||||
$this->current_release['release_state'] = $data;
|
||||
} else {
|
||||
$this->pkginfo['release_state'] .= $data;
|
||||
}
|
||||
break;
|
||||
case 'DIR':
|
||||
break;
|
||||
case 'FILE':
|
||||
$role = strtolower($this->current_attributes['ROLE']);
|
||||
$this->current_file = trim($data);
|
||||
break;
|
||||
case 'LibName':
|
||||
case 'LIBNAME':
|
||||
$this->lib_name = trim($data);
|
||||
break;
|
||||
case 'Sources':
|
||||
case 'SOURCES':
|
||||
$this->lib_sources[] = trim($data);
|
||||
break;
|
||||
}
|
||||
@@ -266,18 +334,20 @@ class PEAR_Common extends PEAR
|
||||
xml_set_object($xp, $this);
|
||||
xml_set_element_handler($xp, '_element_start', '_element_end');
|
||||
xml_set_character_data_handler($xp, '_pkginfo_cdata');
|
||||
xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, false);
|
||||
xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, true);
|
||||
|
||||
$this->element_stack = array();
|
||||
$this->pkginfo = array();
|
||||
$this->current_element = false;
|
||||
$this->destdir = '';
|
||||
$this->filelist = array();
|
||||
$this->pkginfo['filelist'] = array();
|
||||
$this->filelist =& $this->pkginfo['filelist'];
|
||||
$this->in_changelog = false;
|
||||
|
||||
// read the whole thing so we only get one cdata callback
|
||||
// for each block of cdata
|
||||
$data = fread($fp, filesize($descfile));
|
||||
if (!@xml_parse($xp, $data, 1)) {
|
||||
if (!xml_parse($xp, $data, 1)) {
|
||||
$msg = sprintf("XML error: %s at line %d",
|
||||
xml_error_string(xml_get_error_code($xp)),
|
||||
xml_get_current_line_number($xp));
|
||||
@@ -288,12 +358,24 @@ class PEAR_Common extends PEAR
|
||||
xml_parser_free($xp);
|
||||
|
||||
foreach ($this->pkginfo as $k => $v) {
|
||||
$this->pkginfo[$k] = trim($v);
|
||||
if (!is_array($v)) {
|
||||
$this->pkginfo[$k] = trim($v);
|
||||
}
|
||||
}
|
||||
$this->pkginfo['filelist'] = &$this->filelist;
|
||||
return $this->pkginfo;
|
||||
}
|
||||
|
||||
// }}}
|
||||
|
||||
/**
|
||||
* Returns info from a tgz pear package
|
||||
* (experimental)
|
||||
*/
|
||||
function infoFromTgzFile($file)
|
||||
{
|
||||
// untar in temp
|
||||
// chdir($tmp);
|
||||
//return $this->infoFromDescriptionFile('package.xml');
|
||||
// clean temp
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -193,8 +193,8 @@ class PEAR_Installer extends PEAR_Common
|
||||
$tmp_path = dirname($descfile);
|
||||
foreach ($pkginfo['filelist'] as $fname => $atts) {
|
||||
$dest_dir = $this->phpdir . DIRECTORY_SEPARATOR;
|
||||
if (isset($atts['BaseInstallDir'])) {
|
||||
$dest_dir .= $atts['BaseInstallDir'] . DIRECTORY_SEPARATOR;
|
||||
if (isset($atts['BASEINSTALLDIR'])) {
|
||||
$dest_dir .= $atts['BASEINSTALLDIR'] . DIRECTORY_SEPARATOR;
|
||||
}
|
||||
if (dirname($fname) != '.') {
|
||||
$dest_dir .= dirname($fname) . DIRECTORY_SEPARATOR;
|
||||
@@ -205,9 +205,13 @@ class PEAR_Installer extends PEAR_Common
|
||||
return true;
|
||||
}
|
||||
|
||||
// }}}
|
||||
|
||||
// {{{ _installFile()
|
||||
|
||||
function _installFile($file, $dest_dir, $atts)
|
||||
{
|
||||
$type = strtolower($atts['Role']);
|
||||
$type = strtolower($atts['ROLE']);
|
||||
switch ($type) {
|
||||
case "test":
|
||||
// don't install test files for now
|
||||
@@ -227,10 +231,12 @@ class PEAR_Installer extends PEAR_Common
|
||||
}
|
||||
$this->log(2, "+ created dir $dest_dir");
|
||||
}
|
||||
$orig_perms = fileperms($file);
|
||||
if (!@copy($file, $dest_file)) {
|
||||
$this->log(0, "failed to copy $file to $dest_file");
|
||||
return false;
|
||||
}
|
||||
chmod($dest_file, $orig_perms);
|
||||
$this->log(2, "+ copy $file to $dest_file");
|
||||
// FIXME Update Package database here
|
||||
//$this->updatePackageListFrom("$d/$file");
|
||||
|
||||
+13
-4
@@ -15,6 +15,7 @@
|
||||
// +----------------------------------------------------------------------+
|
||||
// | Authors: Stig Bakken <ssb@fast.no> |
|
||||
// | Tomas V.V.Cox <cox@idecnet.com> |
|
||||
// | |
|
||||
// +----------------------------------------------------------------------+
|
||||
//
|
||||
// $Id$
|
||||
@@ -114,8 +115,11 @@ class PEAR_Packager extends PEAR_Common
|
||||
|
||||
// {{{ package()
|
||||
|
||||
function package($pkgfile = 'package.xml')
|
||||
function package($pkgfile = null)
|
||||
{
|
||||
if (empty($pkgfile)) {
|
||||
$pkgfile = 'package.xml';
|
||||
}
|
||||
$pkginfo = $this->infoFromDescriptionFile($pkgfile);
|
||||
if (PEAR::isError($pkginfo)) {
|
||||
return $pkginfo;
|
||||
@@ -154,19 +158,24 @@ class PEAR_Packager extends PEAR_Common
|
||||
return $this->raiseError("could not mkdir $dir");
|
||||
}
|
||||
}
|
||||
//Maintain original file perms
|
||||
$orig_perms = @fileperms($fname);
|
||||
if (!@copy($fname, $file)) {
|
||||
$this->log(0, "could not copy $fname to $file");
|
||||
} else {
|
||||
$this->log(2, "+ copying from $fname to $file");
|
||||
@chmod($file, $orig_perms);
|
||||
}
|
||||
}
|
||||
// XXX TODO: Rebuild the package file as the old method did?
|
||||
|
||||
// This allows build packages from different pear pack def files
|
||||
if (!@copy($pkgfile, $this->tmpdir . DIRECTORY_SEPARATOR . 'package.xml')) {
|
||||
return $this->raiseError("could not copy $pkgfile to " . $this->tmpdir);
|
||||
$dest_pkgfile = $this->tmpdir . DIRECTORY_SEPARATOR . 'package.xml';
|
||||
$this->log(2, "+ copying package $pkgfile to $dest_pkgfile");
|
||||
if (!@copy($pkgfile, $dest_pkgfile)) {
|
||||
return $this->raiseError("could not copy $pkgfile to $dest_pkgfile");
|
||||
}
|
||||
$this->log(2, "+ copying package $pkgfile to " . $this->tmpdir);
|
||||
chmod($dest_pkgfile, 0644);
|
||||
|
||||
// TAR the Package -------------------------------------------
|
||||
chdir(dirname($this->tmpdir));
|
||||
|
||||
+16
-19
@@ -25,15 +25,12 @@
|
||||
*
|
||||
* <?php
|
||||
* require("PEAR/WebInstaller.php");
|
||||
* $installer = new PEAR_WebInstaller("/path/to/your/install/dir","http://php.chregu.tv/pear/");
|
||||
* $installer = new PEAR_WebInstaller("/path/to/your/install/dir","http://pear.php.net/download/");
|
||||
* $installer->start();
|
||||
* ?>
|
||||
*
|
||||
* and put PEAR/WebInstaller.php (this script) anywhere in your include_path.
|
||||
*
|
||||
* (http://php.chregu.tv/pear/ is just for testing purposes until this
|
||||
* system runs on pear.php.net, but feel free to use it till then)
|
||||
*
|
||||
* Both parameters are optional. If the install dir is ommitted, the
|
||||
* installer takes either the system wide pear-directory (mostly
|
||||
* /usr/local/lib/php on unix), if it's writeable, or else the directory
|
||||
@@ -42,7 +39,7 @@
|
||||
*
|
||||
* The second parameter points to the server/directory where all the
|
||||
* packages and especially Packages.xml is located. If not given, the
|
||||
* standard PEAR-Repository is taken (http://pear.php.net/whatever..)
|
||||
* standard PEAR-Repository is taken (http://pear.php.net/download/)
|
||||
*
|
||||
* After installation, just add the install-dir to your include_path and
|
||||
* the packages should work.
|
||||
@@ -88,7 +85,7 @@ class PEAR_WebInstaller extends PEAR
|
||||
var $AllPackages;
|
||||
|
||||
/** URL to the server containing all packages in tgz-Format and the Package.xml */
|
||||
var $remotedir = "http://php.chregu.tv/pear/";
|
||||
var $remotedir = "http://pear.php.net/download/";
|
||||
|
||||
/* Directory where the to be installed files should be put
|
||||
per default PEAR_INSTALL_DIR (/usr/local/lib/php) if it's writeable for the webserver,
|
||||
@@ -432,7 +429,7 @@ class PEAR_WebInstaller extends PEAR
|
||||
function _element_end($xp, $name)
|
||||
{
|
||||
array_pop($this->element_stack);
|
||||
if ($name == "Package")
|
||||
if ($name == "PACKAGE")
|
||||
{
|
||||
$this->AllPackages[$this->pkginfo["name"]] = $this->pkginfo;
|
||||
$this->pkginfo = array();
|
||||
@@ -449,36 +446,36 @@ class PEAR_WebInstaller extends PEAR
|
||||
{
|
||||
$next = $this->element_stack[sizeof($this->element_stack)-1];
|
||||
switch ($this->current_element) {
|
||||
case "Name":
|
||||
case "NAME":
|
||||
$this->pkginfo["name"] .= $data;
|
||||
break;
|
||||
case "Summary":
|
||||
case "SUMMARY":
|
||||
$this->pkginfo["summary"] .= $data;
|
||||
break;
|
||||
case "Initials":
|
||||
case "INITIALS":
|
||||
$this->pkginfo["maintainer_handle"] .= $data;
|
||||
break;
|
||||
case "Email":
|
||||
case "EMAIL":
|
||||
$this->pkginfo["maintainer_email"] .= $data;
|
||||
break;
|
||||
case "Version":
|
||||
case "VERSION":
|
||||
$this->pkginfo["version"] .= $data;
|
||||
break;
|
||||
case "Date":
|
||||
case "DATE":
|
||||
$this->pkginfo["release_date"] .= $data;
|
||||
break;
|
||||
case "Notes":
|
||||
case "NOTES":
|
||||
$this->pkginfo["release_notes"] .= $data;
|
||||
break;
|
||||
case "Dir":
|
||||
case "DIR":
|
||||
if (!$this->installdir) {
|
||||
break;
|
||||
}
|
||||
$dir = trim($data);
|
||||
// XXX add to file list
|
||||
break;
|
||||
case "File":
|
||||
$role = strtolower($this->current_attributes["Role"]);
|
||||
case "FILE":
|
||||
$role = strtolower($this->current_attributes["ROLE"]);
|
||||
$file = trim($data);
|
||||
// XXX add to file list
|
||||
break;
|
||||
@@ -504,7 +501,7 @@ class PEAR_WebInstaller extends PEAR
|
||||
|
||||
xml_set_element_handler($xp, "_element_start", "_element_end");
|
||||
xml_set_character_data_handler($xp, "_pkginfo_cdata");
|
||||
xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, false);
|
||||
xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, true);
|
||||
|
||||
$this->element_stack = array();
|
||||
$this->pkginfo = array();
|
||||
@@ -600,7 +597,7 @@ class PEAR_WebInstaller extends PEAR
|
||||
}
|
||||
}
|
||||
function help ($Full = False) {
|
||||
global $PHP_SELF;
|
||||
global $PHP_SELF;
|
||||
$this->loggerEnd();
|
||||
print "From the WebInstaller.php introduction: <p>";
|
||||
|
||||
|
||||
+56
-55
@@ -1,5 +1,5 @@
|
||||
<!--
|
||||
$Id: package.dtd,v 1.6 2001-05-28 11:14:47 ssb Exp $
|
||||
$Id: package.dtd,v 1.6.2.1 2001-08-28 11:40:56 ssb Exp $
|
||||
|
||||
This is the PEAR package description, version 1.1b1.
|
||||
It should be used with the informal public identifier:
|
||||
@@ -28,98 +28,99 @@
|
||||
ThreadSafe (on|off) 'off'">
|
||||
<!ENTITY % format.atts "Format CDATA #IMPLIED">
|
||||
<!--=============== ELEMENT: Package =======================================-->
|
||||
<!ELEMENT Package (Name, Summary, Maintainer, Release, FileList)>
|
||||
<!ATTLIST Package
|
||||
<!ELEMENT package (name, summary, maintainer, release, filelist)>
|
||||
<!ATTLIST package
|
||||
%global.atts;
|
||||
Type (Source | Binary | Empty) "Empty"
|
||||
type (source | binary | empty) "empty"
|
||||
>
|
||||
<!--=============== ELEMENT: Name ==========================================-->
|
||||
<!ELEMENT Name (#PCDATA)>
|
||||
<!ATTLIST Name
|
||||
<!--=============== ELEMENT: name ==========================================-->
|
||||
<!ELEMENT name (#PCDATA)>
|
||||
<!ATTLIST name
|
||||
%global.atts;
|
||||
>
|
||||
<!--=============== ELEMENT: Summary =======================================-->
|
||||
<!ELEMENT Summary (#PCDATA)>
|
||||
<!ATTLIST Summary
|
||||
<!--=============== ELEMENT: summary =======================================-->
|
||||
<!ELEMENT summary (#PCDATA)>
|
||||
<!ATTLIST summary
|
||||
%global.atts;
|
||||
>
|
||||
<!--=============== ELEMENT: Maintainer ====================================-->
|
||||
<!ELEMENT Maintainer (Initials, Name, Email)>
|
||||
<!ATTLIST Maintainer
|
||||
<!--=============== ELEMENT: maintainer ====================================-->
|
||||
<!ELEMENT maintainer (initials, name, email)>
|
||||
<!ATTLIST maintainer
|
||||
%global.atts;
|
||||
>
|
||||
<!--=============== ELEMENT: Initials ======================================-->
|
||||
<!ELEMENT Initials (#PCDATA)>
|
||||
<!ATTLIST Initials
|
||||
<!--=============== ELEMENT: initials ======================================-->
|
||||
<!ELEMENT initials (#PCDATA)>
|
||||
<!ATTLIST initials
|
||||
%global.atts;
|
||||
>
|
||||
<!--=============== ELEMENT: Email =========================================-->
|
||||
<!ELEMENT Email (#PCDATA)>
|
||||
<!ATTLIST Email
|
||||
<!--=============== ELEMENT: email =========================================-->
|
||||
<!ELEMENT email (#PCDATA)>
|
||||
<!ATTLIST email
|
||||
%global.atts;
|
||||
>
|
||||
<!--=============== ELEMENT: Release =======================================-->
|
||||
<!ELEMENT Release (Version, Date, Notes?)>
|
||||
<!ATTLIST Release
|
||||
<!--=============== ELEMENT: release =======================================-->
|
||||
<!ELEMENT release (version, date, notes?)>
|
||||
<!ATTLIST release
|
||||
%global.atts;
|
||||
>
|
||||
<!--=============== ELEMENT: Version =======================================-->
|
||||
<!ELEMENT Version (#PCDATA)>
|
||||
<!ATTLIST Version
|
||||
<!--=============== ELEMENT: version =======================================-->
|
||||
<!ELEMENT version (#PCDATA)>
|
||||
<!ATTLIST version
|
||||
%global.atts;
|
||||
>
|
||||
<!--=============== ELEMENT: Date =========================================-->
|
||||
<!ELEMENT Date (#PCDATA)>
|
||||
<!ATTLIST Date
|
||||
<!--=============== ELEMENT: date =========================================-->
|
||||
<!ELEMENT date (#PCDATA)>
|
||||
<!ATTLIST date
|
||||
%global.atts;
|
||||
>
|
||||
<!--=============== ELEMENT: Notes =========================================-->
|
||||
<!ELEMENT Notes (#PCDATA)>
|
||||
<!ATTLIST Notes
|
||||
<!--=============== ELEMENT: notes =========================================-->
|
||||
<!ELEMENT notes (#PCDATA)>
|
||||
<!ATTLIST notes
|
||||
%global.atts;
|
||||
>
|
||||
<!--=============== ELEMENT: FileList ======================================-->
|
||||
<!ELEMENT FileList (Dir | File | LibFile)*>
|
||||
<!ATTLIST FileList
|
||||
<!--=============== ELEMENT: filelist ======================================-->
|
||||
<!ELEMENT filelist (dir | file | libfile)*>
|
||||
<!ATTLIST filelist
|
||||
%global.atts;
|
||||
>
|
||||
<!--=============== ELEMENT: Dir ===========================================-->
|
||||
<!ELEMENT Dir (#PCDATA)>
|
||||
<!ATTLIST Dir
|
||||
<!--=============== ELEMENT: dir ===========================================-->
|
||||
<!ELEMENT dir (#PCDATA)>
|
||||
<!ATTLIST dir
|
||||
baseinstalldir CDATA #IMPLIED
|
||||
%global.atts;
|
||||
>
|
||||
<!--=============== ELEMENT: File ==========================================-->
|
||||
<!ELEMENT File (#PCDATA)>
|
||||
<!ATTLIST File
|
||||
<!--=============== ELEMENT: file ==========================================-->
|
||||
<!ELEMENT file (#PCDATA)>
|
||||
<!ATTLIST file
|
||||
%global.atts;
|
||||
%role.atts;
|
||||
%extension.atts;
|
||||
%format.atts;
|
||||
>
|
||||
<!--=============== ELEMENT: LibFile =======================================-->
|
||||
<!ELEMENT LibFile (LibName,Sources,Includes?,LibAdd?)>
|
||||
<!ATTLIST LibFile
|
||||
<!--=============== ELEMENT: libfile =======================================-->
|
||||
<!ELEMENT libfile (libname,sources,includes?,libadd?)>
|
||||
<!ATTLIST libfile
|
||||
%global.atts;
|
||||
%role.atts;
|
||||
>
|
||||
<!--=============== ELEMENT: LibFile =======================================-->
|
||||
<!ELEMENT LibFile (LibName,Sources,Includes?,LibAdd?)>
|
||||
<!ATTLIST LibFile
|
||||
<!--=============== ELEMENT: libfile =======================================-->
|
||||
<!ELEMENT libfile (libname,sources,includes?,libadd?)>
|
||||
<!ATTLIST libfile
|
||||
%global.atts;
|
||||
%role.atts;
|
||||
>
|
||||
<!--=============== ELEMENT: LibName =======================================-->
|
||||
<!ELEMENT LibName (#PCDATA)>
|
||||
<!ATTLIST LibName
|
||||
<!--=============== ELEMENT: libname =======================================-->
|
||||
<!ELEMENT libname (#PCDATA)>
|
||||
<!ATTLIST libname
|
||||
%global.atts;
|
||||
>
|
||||
<!--=============== ELEMENT: Sources =======================================-->
|
||||
<!ELEMENT Sources (#PCDATA)>
|
||||
<!ATTLIST Sources
|
||||
<!--=============== ELEMENT: sources =======================================-->
|
||||
<!ELEMENT sources (#PCDATA)>
|
||||
<!ATTLIST sources
|
||||
%global.atts;
|
||||
>
|
||||
<!--=============== ELEMENT: LibAdd ========================================-->
|
||||
<!ELEMENT LibAdd (#PCDATA)>
|
||||
<!ATTLIST LibAdd
|
||||
<!--=============== ELEMENT: libadd ========================================-->
|
||||
<!ELEMENT libadd (#PCDATA)>
|
||||
<!ATTLIST libadd
|
||||
%global.atts;
|
||||
>
|
||||
+84
-31
@@ -1,12 +1,14 @@
|
||||
#!@prefix@/bin/php -Cq
|
||||
<?php // -*- PHP -*-
|
||||
|
||||
main($argc, $argv, $HTTP_ENV_VARS);
|
||||
main($argc, $argv, $_ENV);
|
||||
|
||||
// {{{ main()
|
||||
|
||||
function main(&$argc, &$argv, &$env)
|
||||
{
|
||||
global $debug;
|
||||
$debug = false;
|
||||
$file = check_options($argc, $argv, $env);
|
||||
parse_package_file($file);
|
||||
make_makefile_in($env);
|
||||
@@ -15,11 +17,30 @@ function main(&$argc, &$argv, &$env)
|
||||
// }}}
|
||||
// {{{ check_options()
|
||||
|
||||
function check_options(&$argc, &$argv, &$env)
|
||||
function check_options($argc, $argv, $env)
|
||||
{
|
||||
$file = $argv[1];
|
||||
global $debug;
|
||||
array_shift($argv);
|
||||
while ($argv[0]{0} == '-' && $argv[0] != '-') {
|
||||
$opt = array_shift($argv);
|
||||
switch ($opt) {
|
||||
case '--': {
|
||||
break 2;
|
||||
}
|
||||
case '-d': {
|
||||
$debug = true;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
die("pearize: unrecognized option `$opt'\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
$file = array_shift($argv);
|
||||
if (empty($file)) {
|
||||
$file = "package.xml";
|
||||
} elseif ($file == '-') {
|
||||
$file = "php://stdin";
|
||||
}
|
||||
return $file;
|
||||
}
|
||||
@@ -29,14 +50,16 @@ function check_options(&$argc, &$argv, &$env)
|
||||
|
||||
function make_makefile_in(&$env)
|
||||
{
|
||||
global $libdata;
|
||||
if (sizeof($libdata) == 0) {
|
||||
exit;
|
||||
} elseif (sizeof($libdata) > 1) {
|
||||
global $libdata, $debug;
|
||||
if (sizeof($libdata) > 1) {
|
||||
die("No support yet for multiple libraries in one package.\n");
|
||||
}
|
||||
|
||||
$wp = @fopen("Makefile.in", "w");
|
||||
if ($debug) {
|
||||
$wp = fopen("php://stdout", "w");
|
||||
} else {
|
||||
$wp = @fopen("Makefile.in", "w");
|
||||
}
|
||||
if (is_resource($wp)) {
|
||||
print "Creating Makefile.in...";
|
||||
flush();
|
||||
@@ -44,21 +67,24 @@ function make_makefile_in(&$env)
|
||||
die("Could not create Makefile.in in current directory.\n");
|
||||
}
|
||||
|
||||
$who = $env["USER"];
|
||||
$when = gmdate('Y-m-d h:i');
|
||||
fwrite($wp, "# This file was generated by `pearize' by $who at $when GMT\n\n");
|
||||
|
||||
foreach ($libdata as $lib => $info) {
|
||||
extract($info);
|
||||
$_who = $env["USER"];
|
||||
$_when = gmdate('Y-m-d h:i');
|
||||
fwrite($wp, "\
|
||||
# This file was generated by `pearize' by $_who at $_when GMT
|
||||
INCLUDES = $includes
|
||||
LTLIBRARY_NAME = lib{$lib}.la
|
||||
LTLIBRARY_SOURCES = $sources
|
||||
LTLIBRARY_SHARED_NAME = {$lib}.la
|
||||
LTLIBRARY_SHARED_LIBADD = $libadd
|
||||
|
||||
include \$(top_srcdir)/build/dynlib.mk
|
||||
");
|
||||
}
|
||||
|
||||
if (sizeof($libdata) > 0) {
|
||||
fwrite($wp, "include \$(top_srcdir)/build/dynlib.mk\n");
|
||||
}
|
||||
fclose($wp);
|
||||
print "done.\n";
|
||||
}
|
||||
@@ -69,17 +95,20 @@ include \$(top_srcdir)/build/dynlib.mk
|
||||
function parse_package_file($file)
|
||||
{
|
||||
global $in_file, $curlib, $curelem, $libdata, $cdata;
|
||||
global $currinstalldir, $baseinstalldir;
|
||||
|
||||
$in_file = false;
|
||||
$curlib = '';
|
||||
$curelem = '';
|
||||
$libdata = array();
|
||||
$cdata = array();
|
||||
$baseinstalldir = array();
|
||||
$currinstalldir = array();
|
||||
|
||||
$xp = xml_parser_create();
|
||||
xml_set_element_handler($xp, "start_handler", "end_handler");
|
||||
xml_set_character_data_handler($xp, "cdata_handler");
|
||||
xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, false);
|
||||
xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, true);
|
||||
|
||||
$fp = @fopen($file, "r");
|
||||
if (!is_resource($fp)) {
|
||||
@@ -96,10 +125,13 @@ function parse_package_file($file)
|
||||
|
||||
function start_handler($xp, $elem, $attrs)
|
||||
{
|
||||
global $cdata, $in_file, $curelem;
|
||||
global $cdata, $in_file, $curelem, $curfile, $filerole;
|
||||
global $baseinstalldir, $currinstalldir;
|
||||
switch ($elem) {
|
||||
case "File": {
|
||||
switch ($attrs['Role']) {
|
||||
case "FILE": {
|
||||
$curfile = '';
|
||||
$filerole = $attrs['ROLE'];
|
||||
switch ($filerole) {
|
||||
case "ext": {
|
||||
$in_file = true;
|
||||
$cdata = array();
|
||||
@@ -111,10 +143,21 @@ function start_handler($xp, $elem, $attrs)
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "Includes":
|
||||
case "LibName":
|
||||
case "LibAdd":
|
||||
case "Sources": {
|
||||
case "DIR": {
|
||||
$cdir = $currinstalldir[sizeof($currinstalldir)-1];
|
||||
$bdir = $baseinstalldir[sizeof($baseinstalldir)-1];
|
||||
array_push($currinstalldir, "$cdir/{$attrs[NAME]}");
|
||||
if (isset($attrs["BASEINSTALLDIR"])) {
|
||||
array_push($baseinstalldir, "$bdir/{$attrs[BASEINSTALLDIR]}");
|
||||
} else {
|
||||
array_push($baseinstalldir, $bdir);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "INCLUDES":
|
||||
case "LIBNAME":
|
||||
case "LIBADD":
|
||||
case "SOURCES": {
|
||||
$curelem = $elem;
|
||||
break;
|
||||
}
|
||||
@@ -127,19 +170,25 @@ function start_handler($xp, $elem, $attrs)
|
||||
function end_handler($xp, $elem)
|
||||
{
|
||||
global $in_file, $curlib, $curelem, $libdata, $cdata;
|
||||
global $baseinstalldir, $currinstalldir;
|
||||
switch ($elem) {
|
||||
case "File": {
|
||||
case "FILE": {
|
||||
if ($in_file === true) {
|
||||
$libname = trim($cdata['LibName']);
|
||||
$libname = trim($cdata['LIBNAME']);
|
||||
$libdata[$libname] = array(
|
||||
"sources" => trim($cdata['Sources']),
|
||||
"includes" => trim($cdata['Includes']),
|
||||
"libadd" => trim($cdata['LibAdd']),
|
||||
"sources" => trim($cdata['SOURCES']),
|
||||
"includes" => trim($cdata['INCLUDES']),
|
||||
"libadd" => trim($cdata['LIBADD']),
|
||||
);
|
||||
$in_file = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "DIR": {
|
||||
array_pop($currinstalldir);
|
||||
array_pop($baseinstalldir);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,12 +197,16 @@ function end_handler($xp, $elem)
|
||||
|
||||
function cdata_handler($xp, $data)
|
||||
{
|
||||
global $curelem, $cdata;
|
||||
global $curelem, $cdata, $curfile;
|
||||
switch ($curelem) {
|
||||
case "Includes":
|
||||
case "LibAdd":
|
||||
case "LibName":
|
||||
case "Sources": {
|
||||
case "FILE": {
|
||||
$curfile .= $data;
|
||||
break;
|
||||
}
|
||||
case "INCLUDES":
|
||||
case "LIBADD":
|
||||
case "LIBNAME":
|
||||
case "SOURCES": {
|
||||
$cdata[$curelem] .= $data;
|
||||
break;
|
||||
}
|
||||
|
||||
Executable
+236
@@ -0,0 +1,236 @@
|
||||
#!@prefix@/bin/php -Cq
|
||||
<?php // -*- PHP -*-
|
||||
|
||||
// {{{ setup
|
||||
|
||||
define('S_IFDIR', 0040000); // Directory
|
||||
define('S_IFCHR', 0020000); // Character device
|
||||
define('S_IFBLK', 0060000); // Block device
|
||||
define('S_IFREG', 0100000); // Regular file
|
||||
define('S_IFIFO', 0010000); // FIFO
|
||||
define('S_IFLNK', 0120000); // Symbolic link
|
||||
define('S_IFSOCK', 0140000); // Socket
|
||||
|
||||
require_once "PEAR.php";
|
||||
require_once "Archive/Tar.php";
|
||||
require_once "Console/Getopt.php";
|
||||
|
||||
// }}}
|
||||
// {{{ options
|
||||
|
||||
$verbose = false;
|
||||
$op_create = false;
|
||||
$op_list = false;
|
||||
$op_extract = false;
|
||||
$use_gzip = false;
|
||||
$file = '';
|
||||
|
||||
$progname = basename(array_shift($argv));
|
||||
|
||||
$options = Console_Getopt::getopt($argv, "h?ctxvzf:");
|
||||
if (PEAR::isError($options)) {
|
||||
usage($options);
|
||||
}
|
||||
|
||||
$opts = $options[0];
|
||||
foreach ($opts as $opt) {
|
||||
switch ($opt[0]) {
|
||||
case 'v': {
|
||||
$verbose = true;
|
||||
break;
|
||||
}
|
||||
case 'c': {
|
||||
$op_create = true;
|
||||
break;
|
||||
}
|
||||
case 't': {
|
||||
$op_list = true;
|
||||
break;
|
||||
}
|
||||
case 'x': {
|
||||
$op_extract = true;
|
||||
break;
|
||||
}
|
||||
case 'z': {
|
||||
$use_gzip = true;
|
||||
break;
|
||||
}
|
||||
case 'f': {
|
||||
$file = $opt[1];
|
||||
break;
|
||||
}
|
||||
case 'h':
|
||||
case '?': {
|
||||
usage();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($op_create + $op_list + $op_extract > 1) {
|
||||
usage("Only one of -c, -t and -x can be specified at once!");
|
||||
}
|
||||
|
||||
if ($op_create + $op_list + $op_extract == 0) {
|
||||
usage("Please specify either -c, -t or -x!");
|
||||
}
|
||||
|
||||
if (empty($file)) {
|
||||
if ($op_create) {
|
||||
$file = "php://stdout";
|
||||
} else {
|
||||
$file = "php://stdin";
|
||||
}
|
||||
}
|
||||
|
||||
// }}}
|
||||
|
||||
$tar = new Archive_Tar($file, $use_gzip);
|
||||
$tar->setErrorHandling(PEAR_ERROR_DIE, "$progname error: %s\n");
|
||||
|
||||
if ($op_create) {
|
||||
do_create($tar, $options[1]);
|
||||
$tar->create($options[1]);
|
||||
} elseif ($op_list) {
|
||||
do_list($tar, $verbose);
|
||||
} elseif ($op_extract) {
|
||||
do_extract($tar);
|
||||
}
|
||||
|
||||
// {{{ getrwx()
|
||||
|
||||
function getrwx($bits) {
|
||||
$str = '';
|
||||
$str .= ($bits & 4) ? 'r' : '-';
|
||||
$str .= ($bits & 2) ? 'w' : '-';
|
||||
$str .= ($bits & 1) ? 'x' : '-';
|
||||
return $str;
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ getfiletype()
|
||||
|
||||
function getfiletype($bits) {
|
||||
static $map = array(
|
||||
'-' => S_IFREG,
|
||||
'd' => S_IFDIR,
|
||||
'l' => S_IFLNK,
|
||||
'c' => S_IFCHR,
|
||||
'b' => S_IFBLK,
|
||||
'p' => S_IFIFO,
|
||||
's' => S_IFSOCK,
|
||||
);
|
||||
foreach ($map as $char => $mask) {
|
||||
if ($bits & $mask) {
|
||||
return $char;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ getuser()
|
||||
|
||||
function getuser($uid) {
|
||||
static $cache = array();
|
||||
if (isset($cache[$uid])) {
|
||||
return $cache[$uid];
|
||||
}
|
||||
if (function_exists("posix_getpwuid")) {
|
||||
if (is_array($user = @posix_getpwuid($uid))) {
|
||||
$cache[$uid] = $user['name'];
|
||||
return $user['name'];
|
||||
}
|
||||
}
|
||||
$cache[$uid] = $uid;
|
||||
return $uid;
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ getgroup()
|
||||
|
||||
function getgroup($gid) {
|
||||
static $cache = array();
|
||||
if (isset($cache[$gid])) {
|
||||
return $cache[$gid];
|
||||
}
|
||||
if (function_exists("posix_getgrgid")) {
|
||||
if (is_array($group = @posix_getgrgid($gid))) {
|
||||
$cache[$gid] = $group['name'];
|
||||
return $group['name'];
|
||||
}
|
||||
}
|
||||
$cache[$gid] = $gid;
|
||||
return $gid;
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ do_create()
|
||||
|
||||
function do_create(&$tar, &$files)
|
||||
{
|
||||
$tar->create($files);
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ do_list()
|
||||
|
||||
function do_list(&$tar, $verbose)
|
||||
{
|
||||
static $rwx = array(4 => 'r', 2 => 'w', 1 => 'x');
|
||||
$files = $tar->listContent();
|
||||
if (is_array($files) && sizeof($files) > 0) {
|
||||
foreach ($files as $file) {
|
||||
if ($verbose) {
|
||||
$fm = (int)$file['mode'];
|
||||
$mode = sprintf('%s%s%s%s', getfiletype($fm),
|
||||
getrwx(($fm >> 6) & 7), getrwx(($fm >> 3) & 7),
|
||||
getrwx($fm & 7));
|
||||
$owner = getuser($file['uid']) . '/' . getgroup($file['gid']);
|
||||
printf("%10s %-11s %7d %s %s\n", $mode, $owner, $file['size'],
|
||||
date('Y-m-d H:i:s', $file['mtime']), $file['filename']);
|
||||
} else {
|
||||
printf("%s\n", $file['filename']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ do_extract()
|
||||
|
||||
function do_extract(&$tar, $destdir = ".")
|
||||
{
|
||||
$tar->extract($destdir);
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ usage()
|
||||
|
||||
function usage($errormsg = '')
|
||||
{
|
||||
global $progname;
|
||||
$fp = fopen("php://stderr", "w");
|
||||
if ($errormsg) {
|
||||
if (PEAR::isError($errormsg)) {
|
||||
fwrite($fp, $errormsg->getMessage() . "\n");
|
||||
} else {
|
||||
fwrite($fp, "$errormsg\n");
|
||||
}
|
||||
}
|
||||
fwrite($fp, "$progname [-h|-?] {-c|-t|-x} [-z] [-v] [-f file] [file(s)...]
|
||||
Options:
|
||||
-h, -? Show this screen
|
||||
-c Create archive
|
||||
-t List archive
|
||||
-x Extract archive
|
||||
-z Run input/output through gzip
|
||||
-f file Use <file> as input or output (default is stdin/stdout)
|
||||
|
||||
");
|
||||
fclose($fp);
|
||||
exit;
|
||||
}
|
||||
|
||||
// }}}
|
||||
|
||||
?>
|
||||
+12
-3
@@ -5,9 +5,13 @@
|
||||
;;;;;;;;;;;;;;;;;;;
|
||||
;
|
||||
; This is the recommended, PHP 4-style version of the php.ini-dist file. It
|
||||
; sets some non standard settings, that make PHP more efficient and more secure.
|
||||
; sets some non standard settings, that make PHP more efficient, more secure,
|
||||
; and encourage cleaner coding.
|
||||
; The price is that with these settings, PHP may be incompatible with some
|
||||
; applications. Using this file is warmly recommended for production sites.
|
||||
; applications, and sometimes, more difficult to develop with. Using this
|
||||
; file is warmly recommended for production sites. As all of the changes from
|
||||
; the standard settings are thoroughly documented, you can go over each one,
|
||||
; and decide whether you want to use it or not.
|
||||
;
|
||||
; For general information about the php.ini file, please consult the php.ini-dist
|
||||
; file, included in your PHP distribution.
|
||||
@@ -58,6 +62,11 @@
|
||||
; - variables_order = "GPCS" [Performance]
|
||||
; The environment variables are not hashed into the $HTTP_ENV_VARS[]. To access
|
||||
; environment variables, you can use getenv() instead.
|
||||
; - error_reporting = E_ALL [Code Cleanliness, Security(?)]
|
||||
; By default, PHP surpresses errors of type E_NOTICE. These error messages
|
||||
; are emitted for non-critical errors, but that could be a symptom of a bigger
|
||||
; problem. Most notably, this will cause error messages about the use
|
||||
; of uninitialized variables to be displayed.
|
||||
; - allow_call_time_pass_reference = Off [Code cleanliness]
|
||||
; It's not possible to decide to force a variable to be passed by reference
|
||||
; when calling a function. The PHP 4 style to do this is by making the
|
||||
@@ -232,7 +241,7 @@ memory_limit = 8M ; Maximum amount of memory a script may consume (8MB)
|
||||
;
|
||||
; - Show all errors except for notices
|
||||
;
|
||||
error_reporting = E_ALL & ~E_NOTICE
|
||||
error_reporting = E_ALL
|
||||
|
||||
; Print out errors (as a part of the output). For production web sites,
|
||||
; you're strongly encouraged to turn this feature off, and use error logging
|
||||
|
||||
+50
-25
@@ -102,6 +102,28 @@ function create_modules_2_test_list() {
|
||||
|
||||
|
||||
|
||||
function in_path($program)
|
||||
{
|
||||
global $HTTP_ENV_VARS;
|
||||
if (substr(PHP_OS, 0, 3) == "WIN") {
|
||||
$delim = ";";
|
||||
$ext = ".exe";
|
||||
} else {
|
||||
$delim = ":";
|
||||
$ext = "";
|
||||
}
|
||||
$slash = DIRECTORY_SEPARATOR;
|
||||
$path_components = explode($delim, $HTTP_ENV_VARS['PATH']);
|
||||
foreach ($path_components as $path) {
|
||||
$test = "{$path}{$slash}php{$ext}";
|
||||
if (@is_executable($test)) {
|
||||
return $test;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
function initialize()
|
||||
{
|
||||
global $term, $windows_p, $php, $skip, $testdirs, $tmpfile,
|
||||
@@ -109,39 +131,42 @@ function initialize()
|
||||
$tests_in_dir;
|
||||
|
||||
// XXX Should support HTML output as well.
|
||||
$term = getenv("TERM");
|
||||
if (ereg('^(xterm|vt220)', $term)) {
|
||||
$term_bold = sprintf("%c%c%c%c", 27, 91, 49, 109);
|
||||
$term_norm = sprintf("%c%c%c", 27, 91, 109);
|
||||
} elseif (ereg('^vt100', $term)) {
|
||||
$term_bold = sprintf("%c%c%c%c", 27, 91, 49, 109);
|
||||
$term_norm = sprintf("%c%c%c", 27, 91, 109);
|
||||
$php = "";
|
||||
if((substr(PHP_OS, 0, 3) == "WIN")) {
|
||||
$ext = ".exe";
|
||||
$windows_p = true;
|
||||
$term = getenv("COMSPEC");
|
||||
} else {
|
||||
$term_bold = $term_norm = "";
|
||||
}
|
||||
|
||||
if((substr(PHP_OS, 0, 3) == "WIN")) {
|
||||
$windows_p = true;
|
||||
$term = getenv("COMSPEC");
|
||||
$null = getenv("TOP_BUILDDIR");
|
||||
$php = ($null ? $null : getcwd()) . "/php.exe";
|
||||
unset($null);
|
||||
} else {
|
||||
if (isset($GLOBALS["TOP_BUILDDIR"])) {
|
||||
$php = $GLOBALS["TOP_BUILDDIR"]."/php";
|
||||
$ext = "";
|
||||
$term = getenv("TERM");
|
||||
if (ereg('^(xterm|vt220)', $term)) {
|
||||
$term_bold = sprintf("%c%c%c%c", 27, 91, 49, 109);
|
||||
$term_norm = sprintf("%c%c%c", 27, 91, 109);
|
||||
} elseif (ereg('^vt100', $term)) {
|
||||
$term_bold = sprintf("%c%c%c%c", 27, 91, 49, 109);
|
||||
$term_norm = sprintf("%c%c%c", 27, 91, 109);
|
||||
} else {
|
||||
$php = getcwd() . '/php';
|
||||
$term_bold = $term_norm = "";
|
||||
}
|
||||
}
|
||||
|
||||
create_compiled_in_modules_list();
|
||||
|
||||
if (!is_executable($php) && !$windows_p) {
|
||||
dowriteln("PHP CGI binary ($php) is not executable.");
|
||||
dowriteln("Please compile PHP as a CGI executable and try again.");
|
||||
if (isset($GLOBALS["TOP_BUILDDIR"]) && @is_executable($GLOBALS["TOP_BUILDDIR"]."/php{$ext}")) {
|
||||
$php = $GLOBALS["TOP_BUILDDIR"]."/php{$ext}";
|
||||
} elseif (@is_executable("./php{$ext}")) {
|
||||
$php = getcwd() . "/php{$ext}";
|
||||
}
|
||||
if (empty($php)) {
|
||||
$php = in_path("php");
|
||||
}
|
||||
if (empty($php)) {
|
||||
dowriteln("Unable to find PHP executable (php{$ext}).");
|
||||
dowriteln("Please build PHP as a CGI executable or make sure it is");
|
||||
dowriteln("available in the PATH environment variable.");
|
||||
exit;
|
||||
}
|
||||
|
||||
create_compiled_in_modules_list();
|
||||
|
||||
$skip = array(
|
||||
"CVS" => 1
|
||||
);
|
||||
|
||||
Loaded 100 of 103 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user