mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-11 19:20:50 +00:00
Compare commits
39
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8328c68940 | ||
|
|
fb1b7c9060 | ||
|
|
f39b4a8582 | ||
|
|
06ceb7da90 | ||
|
|
934b4388cb | ||
|
|
055710e95a | ||
|
|
12e6c6d95f | ||
|
|
cd11446263 | ||
|
|
844c90a395 | ||
|
|
f9ee6d3d9e | ||
|
|
2d73699721 | ||
|
|
4caca1d6eb | ||
|
|
64595cc959 | ||
|
|
fb49473192 | ||
|
|
5c6ec3c7bf | ||
|
|
a86833cc06 | ||
|
|
dc1ff44e37 | ||
|
|
ed235cf8b7 | ||
|
|
adb0cb5c01 | ||
|
|
964d412062 | ||
|
|
3cb5d4790a | ||
|
|
a6faca14b7 | ||
|
|
4bbf5a04ed | ||
|
|
99a15a90c7 | ||
|
|
b7e1d6a196 | ||
|
|
7d884d8e7b | ||
|
|
106d6a77ce | ||
|
|
d10a337f00 | ||
|
|
43b21ea95f | ||
|
|
42bb3ed035 | ||
|
|
e88d05b9a5 | ||
|
|
5771743122 | ||
|
|
dbe6bdca91 | ||
|
|
ed101fb57d | ||
|
|
d689414621 | ||
|
|
05729165c3 | ||
|
|
192c93ce8e | ||
|
|
1fbcdd2102 | ||
|
|
474aa9fbdf |
No files matched your search
@@ -1,6 +1,21 @@
|
||||
PHP 4 NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
05 May 2002, Version 4.2.1
|
||||
13 May 2002, Version 4.2.1
|
||||
- Added safe-mode checks to show_source(), parse_ini_file() and rmdir(). Also
|
||||
fixed security problems with safe_mode_include_dir directive. (Rasmus)
|
||||
- Changed HTTP upload code to accept 0 byte file uploads. (Zeev)
|
||||
- Major update of domxml. New functions, better DOM compliance and bug fixes:
|
||||
* Changed the old $node->append_child() to $node->append_sibling() since
|
||||
the new append_child() behaves correctly (= W3C standard).
|
||||
* Added domxml functions:
|
||||
. domxml_elem_get_elements_by_tagname()
|
||||
. domxml_doc_get_elements_by_tagname()
|
||||
. domxml_doc_get_element_by_id()
|
||||
. domxml_elem_remove_attribute()
|
||||
. domxml_elem_get_attribute_node()
|
||||
* Fixed a segfault in domxml_unlink().
|
||||
* Added formatting option to domxml_dump_mem().
|
||||
(Uwe, jtate, Chregu)
|
||||
- Fixed a bug in socket_select() that could cause unexpected behavior when
|
||||
using a statement like $w = $e = array($sock); This change unfortunately
|
||||
prevents the use of constant values (e.g. NULL) for the socket array
|
||||
|
||||
+13
-1
@@ -36,7 +36,7 @@ for arg in $0 "$@"; do
|
||||
done
|
||||
|
||||
AC_CANONICAL_HOST
|
||||
AM_INIT_AUTOMAKE(php, 4.2.1RC1, nodefine)
|
||||
AM_INIT_AUTOMAKE(php, 4.2.1, nodefine)
|
||||
AM_CONFIG_HEADER(main/php_config.h)
|
||||
AM_MAINTAINER_MODE
|
||||
|
||||
@@ -1250,6 +1250,18 @@ cat<<X
|
||||
| If you do not agree with the terms of this license, you must abort |
|
||||
| the installation process at this point. |
|
||||
+--------------------------------------------------------------------+
|
||||
| *** NOTE *** |
|
||||
| The default for register_globals is now OFF! |
|
||||
| |
|
||||
| If your application relies on register_globals being ON, you |
|
||||
| should explicitly set it to on in your php.ini file. |
|
||||
| Note that you are strongly encouraged to read |
|
||||
| http://www.php.net/manual/en/security.registerglobals.php |
|
||||
| about the implications of having register_globals set to on, and |
|
||||
| avoid using it if possible. |
|
||||
+--------------------------------------------------------------------+
|
||||
|
||||
|
||||
|
||||
Thank you for using PHP.
|
||||
|
||||
|
||||
+22
-17
@@ -1439,34 +1439,38 @@ PHPAPI void php_COM_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_pro
|
||||
pval *object_handle;
|
||||
|
||||
PHP_FN(com_load)(INTERNAL_FUNCTION_PARAM_PASSTHRU);
|
||||
if (!zend_is_true(return_value)) {
|
||||
ZVAL_FALSE(object);
|
||||
return;
|
||||
if (zend_is_true(return_value)) {
|
||||
ALLOC_ZVAL(object_handle);
|
||||
*object_handle = *return_value;
|
||||
pval_copy_constructor(object_handle);
|
||||
INIT_PZVAL(object_handle);
|
||||
zend_hash_index_update(Z_OBJPROP_P(object), 0, &object_handle, sizeof(pval *), NULL);
|
||||
pval_destructor(&function_name->element);
|
||||
} else {
|
||||
ZVAL_NULL(object);
|
||||
}
|
||||
ALLOC_ZVAL(object_handle);
|
||||
*object_handle = *return_value;
|
||||
pval_copy_constructor(object_handle);
|
||||
INIT_PZVAL(object_handle);
|
||||
zend_hash_index_update(Z_OBJPROP_P(object), 0, &object_handle, sizeof(pval *), NULL);
|
||||
pval_destructor(&function_name->element);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
RETVAL_NULL();
|
||||
property = php_COM_get_property_handler(property_reference);
|
||||
if (Z_TYPE(property) == IS_NULL) {
|
||||
if (property.refcount == 1) {
|
||||
pval_destructor(&property);
|
||||
}
|
||||
|
||||
if (Z_TYPE(property) != IS_OBJECT) {
|
||||
pval_destructor(&property);
|
||||
pval_destructor(&function_name->element);
|
||||
|
||||
/* error message - function call on a non-object */
|
||||
return;
|
||||
}
|
||||
|
||||
zend_hash_index_find(Z_OBJPROP(property), 0, (void **) &handle);
|
||||
obj = (comval *)zend_list_find(Z_LVAL_PP(handle), &type);
|
||||
|
||||
if (!obj || (type != IS_COM)) {
|
||||
pval_destructor(&property);
|
||||
pval_destructor(&function_name->element);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1486,9 +1490,7 @@ PHPAPI void php_COM_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_pro
|
||||
arguments = (pval **) emalloc(sizeof(pval *)*arg_count);
|
||||
zend_get_parameters_array(ht, arg_count, arguments);
|
||||
|
||||
if (do_COM_invoke(obj , &function_name->element, var_result, arguments, arg_count TSRMLS_CC) == FAILURE) {
|
||||
RETVAL_FALSE;
|
||||
} else {
|
||||
if (do_COM_invoke(obj , &function_name->element, var_result, arguments, arg_count TSRMLS_CC) == SUCCESS) {
|
||||
php_variant_to_pval(var_result, return_value, codepage TSRMLS_CC);
|
||||
}
|
||||
|
||||
@@ -1496,9 +1498,12 @@ PHPAPI void php_COM_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_pro
|
||||
efree(arguments);
|
||||
}
|
||||
|
||||
if (property.refcount == 1) {
|
||||
if (zend_llist_count(property_reference->elements_list) > 1) {
|
||||
/* destruct temporary object */
|
||||
zend_list_delete(Z_LVAL_PP(handle));
|
||||
pval_destructor(&property);
|
||||
}
|
||||
|
||||
pval_destructor(&function_name->element);
|
||||
}
|
||||
|
||||
|
||||
+903
-203
File diff suppressed because it is too large.
Load diff
+15
-4
@@ -61,7 +61,7 @@ PHP_FUNCTION(xmldocfile);
|
||||
PHP_FUNCTION(html_doc);
|
||||
PHP_FUNCTION(html_doc_file);
|
||||
#endif
|
||||
PHP_FUNCTION(xmltree);
|
||||
PHP_FUNCTION(domxml_xmltree);
|
||||
PHP_FUNCTION(domxml_new_xmldoc);
|
||||
PHP_FUNCTION(domxml_substitute_entities_default);
|
||||
|
||||
@@ -79,6 +79,7 @@ PHP_FUNCTION(domxml_doc_create_entity_reference);
|
||||
PHP_FUNCTION(domxml_doc_imported_node);
|
||||
PHP_FUNCTION(domxml_add_root);
|
||||
PHP_FUNCTION(domxml_intdtd);
|
||||
PHP_FUNCTION(domxml_doc_ids);
|
||||
PHP_FUNCTION(domxml_dump_mem);
|
||||
PHP_FUNCTION(domxml_dump_mem_file);
|
||||
PHP_FUNCTION(domxml_dump_node);
|
||||
@@ -108,8 +109,10 @@ PHP_FUNCTION(domxml_node_next_sibling);
|
||||
PHP_FUNCTION(domxml_node_previous_sibling);
|
||||
PHP_FUNCTION(domxml_node_owner_document);
|
||||
PHP_FUNCTION(domxml_node_insert_before);
|
||||
PHP_FUNCTION(domxml_node_append_sibling);
|
||||
PHP_FUNCTION(domxml_node_append_child);
|
||||
PHP_FUNCTION(domxml_node_add_child);
|
||||
PHP_FUNCTION(domxml_node_remove_child);
|
||||
PHP_FUNCTION(domxml_node_replace_child);
|
||||
PHP_FUNCTION(domxml_node_has_attributes);
|
||||
PHP_FUNCTION(domxml_node_has_child_nodes);
|
||||
PHP_FUNCTION(domxml_node_parent);
|
||||
@@ -141,8 +144,8 @@ PHP_FUNCTION(domxml_elem_set_attribute);
|
||||
PHP_FUNCTION(domxml_elem_remove_attribute);
|
||||
PHP_FUNCTION(domxml_elem_get_attribute_node);
|
||||
PHP_FUNCTION(domxml_elem_set_attribute_node);
|
||||
PHP_FUNCTION(domxml_elem_get_element_by_tagname);
|
||||
|
||||
PHP_FUNCTION(domxml_elem_get_elements_by_tagname);
|
||||
PHP_FUNCTION(domxml_elem_has_attribute);
|
||||
/* Class CData methods */
|
||||
PHP_FUNCTION(domxml_cdata_length);
|
||||
|
||||
@@ -159,6 +162,12 @@ PHP_FUNCTION(domxml_entity_notation_name);
|
||||
PHP_FUNCTION(domxml_pi_target);
|
||||
PHP_FUNCTION(domxml_pi_data);
|
||||
|
||||
/* Class Parser methods */
|
||||
PHP_FUNCTION(domxml_parser);
|
||||
PHP_FUNCTION(domxml_parser_add_chunk);
|
||||
PHP_FUNCTION(domxml_parser_end);
|
||||
PHP_FUNCTION(domxml_parser_set_keep_blanks);
|
||||
|
||||
/* Class XPathContext methods */
|
||||
#if defined(LIBXML_XPATH_ENABLED)
|
||||
PHP_FUNCTION(xpath_init);
|
||||
@@ -166,6 +175,8 @@ PHP_FUNCTION(xpath_new_context);
|
||||
PHP_FUNCTION(xpath_eval);
|
||||
PHP_FUNCTION(xpath_eval_expression);
|
||||
PHP_FUNCTION(xpath_register_ns);
|
||||
PHP_FUNCTION(domxml_doc_get_elements_by_tagname);
|
||||
PHP_FUNCTION(domxml_doc_get_element_by_id);
|
||||
#endif
|
||||
#if defined(LIBXML_XPTR_ENABLED)
|
||||
PHP_FUNCTION(xptr_new_context);
|
||||
|
||||
+1
-1
@@ -371,7 +371,7 @@ PHPAPI char *php_reg_replace(const char *pattern, const char *replace, const cha
|
||||
&& subs[walk[1] - '0'].rm_so > -1
|
||||
&& subs[walk[1] - '0'].rm_eo > -1
|
||||
/* this next case shouldn't happen. it does. */
|
||||
&& subs[walk[1] - '0'].rm_so < subs[walk[1] - '0'].rm_eo) {
|
||||
&& subs[walk[1] - '0'].rm_so <= subs[walk[1] - '0'].rm_eo) {
|
||||
tmp = subs[walk[1] - '0'].rm_eo
|
||||
- subs[walk[1] - '0'].rm_so;
|
||||
memcpy (walkbuf,
|
||||
|
||||
@@ -434,7 +434,7 @@ static void _php_ibase_free_query(ibase_query *ib_query)
|
||||
}
|
||||
isc_transaction_info(IB_STATUS, &ib_query->trans,sizeof(tr_items), tr_items, sizeof(tmp), tmp );
|
||||
/* we have the trans still open and a statement to drop? */
|
||||
if ( !(IB_STATUS[0] && IB_STATUS[0]) && ib_query->stmt) {
|
||||
if ( !(IB_STATUS[0] && IB_STATUS[1]) && ib_query->stmt) {
|
||||
IBDEBUG("Dropping statement handle (free_query)...");
|
||||
if (isc_dsql_free_statement(IB_STATUS, &ib_query->stmt, DSQL_drop)){
|
||||
_php_ibase_error();
|
||||
@@ -465,7 +465,7 @@ static void _php_ibase_free_blob(zend_rsrc_list_entry *rsrc TSRMLS_DC)
|
||||
|
||||
if (ib_blob->bl_handle != NULL) { /* blob open*/
|
||||
if (isc_cancel_blob(IB_STATUS, &ib_blob->bl_handle)) {
|
||||
_php_ibase_error();
|
||||
php_error(E_ERROR, "You can lose data. Close any blob after reading of writing it. Use ibase_blob_close() before calling ibase_close()");
|
||||
}
|
||||
}
|
||||
efree(ib_blob);
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* Common definition and Settings
|
||||
*/
|
||||
|
||||
// Custom Error Hanlder for testing
|
||||
function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
|
||||
global $debug;
|
||||
|
||||
$err_type = array (
|
||||
1 => "Error", // E_ERROR
|
||||
2 => "Warning", // E_WARINING
|
||||
4 => "Parsing Error", // E_PARSE
|
||||
8 => "Notice", // E_NOTICE
|
||||
16 => "Core Error", // E_CORE_ERROR
|
||||
32 => "Core Warning", // E_CORE_WARNING
|
||||
64 => "Compile Error", // E_COMPILE_ERROR
|
||||
128 => "Compile Warning", // E_COMPILE_WARNING
|
||||
256 => "User Error", // E_USER_ERROR
|
||||
512 => "User Warning", // E_USER_WARMING
|
||||
1024=> "User Notice" // E_USER_NOTICE
|
||||
);
|
||||
|
||||
if (!empty($debug)) {
|
||||
printf("%s: %s (%d)\n", $err_type[$err_no], $err_msg, $linenum);
|
||||
}
|
||||
else {
|
||||
printf("ERR: %s\n",$err_type[$err_no]);
|
||||
}
|
||||
}
|
||||
|
||||
set_error_handler('test_error_handler');
|
||||
|
||||
|
||||
// Var def for testing
|
||||
$t_ary = array(
|
||||
's1' => '日本語EUC-JPの文字列',
|
||||
's2' => 'English Text'
|
||||
);
|
||||
|
||||
class tc
|
||||
{
|
||||
var $s1 = '日本語EUC-JPの文字列';
|
||||
var $s2 = 'English Text';
|
||||
|
||||
function tc()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
$t_obj = new tc;
|
||||
|
||||
?>
|
||||
+143
-139
@@ -23,7 +23,7 @@
|
||||
#if PCNTL_DEBUG
|
||||
#define DEBUG_OUT printf("DEBUG: ");printf
|
||||
#else
|
||||
#define DEBUG_OUT
|
||||
#define DEBUG_OUT
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@@ -32,8 +32,8 @@
|
||||
|
||||
#include "php.h"
|
||||
#include "php_ini.h"
|
||||
#include "ext/standard/info.h"
|
||||
#include "php_pcntl.h"
|
||||
#include "zend_extensions.h"
|
||||
|
||||
ZEND_DECLARE_MODULE_GLOBALS(pcntl)
|
||||
|
||||
@@ -41,16 +41,16 @@ static int le_pcntl;
|
||||
static int pcntl_zend_extension_active;
|
||||
|
||||
function_entry pcntl_functions[] = {
|
||||
PHP_FE(pcntl_fork, NULL)
|
||||
PHP_FE(pcntl_waitpid, second_arg_force_ref)
|
||||
PHP_FE(pcntl_signal, NULL)
|
||||
PHP_FE(pcntl_wifexited, NULL)
|
||||
PHP_FE(pcntl_wifstopped, NULL)
|
||||
PHP_FE(pcntl_wifsignaled, NULL)
|
||||
PHP_FE(pcntl_wexitstatus, NULL)
|
||||
PHP_FE(pcntl_wtermsig, NULL)
|
||||
PHP_FE(pcntl_wstopsig, NULL)
|
||||
PHP_FE(pcntl_exec, NULL)
|
||||
PHP_FE(pcntl_fork, NULL)
|
||||
PHP_FE(pcntl_waitpid, second_arg_force_ref)
|
||||
PHP_FE(pcntl_signal, NULL)
|
||||
PHP_FE(pcntl_wifexited, NULL)
|
||||
PHP_FE(pcntl_wifstopped, NULL)
|
||||
PHP_FE(pcntl_wifsignaled, NULL)
|
||||
PHP_FE(pcntl_wexitstatus, NULL)
|
||||
PHP_FE(pcntl_wtermsig, NULL)
|
||||
PHP_FE(pcntl_wstopsig, NULL)
|
||||
PHP_FE(pcntl_exec, NULL)
|
||||
{NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
@@ -77,28 +77,27 @@ ZEND_GET_MODULE(pcntl)
|
||||
PCNTL_ZEND_EXT zend_extension pcntl_extension_entry = {
|
||||
"pcntl",
|
||||
"1.0",
|
||||
"Jason Greene",
|
||||
"Jason Greene",
|
||||
"http://www.php.net",
|
||||
"2001",
|
||||
pcntl_zend_extension_startup,
|
||||
pcntl_zend_extension_shutdown,
|
||||
pcntl_zend_extension_startup,
|
||||
pcntl_zend_extension_shutdown,
|
||||
pcntl_zend_extension_activate,
|
||||
pcntl_zend_extension_deactivate,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
pcntl_zend_extension_statement_handler,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
|
||||
void php_register_signal_constants(INIT_FUNC_ARGS)
|
||||
{
|
||||
|
||||
|
||||
/* Wait Constants */
|
||||
#ifdef WNOHANG
|
||||
REGISTER_LONG_CONSTANT("WNOHANG", (long) WNOHANG, CONST_CS | CONST_PERSISTENT);
|
||||
@@ -117,9 +116,9 @@ void php_register_signal_constants(INIT_FUNC_ARGS)
|
||||
REGISTER_LONG_CONSTANT("SIGILL", (long) SIGILL, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("SIGTRAP", (long) SIGTRAP, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("SIGABRT", (long) SIGABRT, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("SIGIOT", (long) SIGIOT, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("SIGBUS", (long) SIGBUS, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("SIGFPE", (long) SIGFPE, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("SIGIOT", (long) SIGIOT, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("SIGBUS", (long) SIGBUS, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("SIGFPE", (long) SIGFPE, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("SIGKILL", (long) SIGKILL, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("SIGUSR1", (long) SIGUSR1, CONST_CS | CONST_PERSISTENT);
|
||||
REGISTER_LONG_CONSTANT("SIGSEGV", (long) SIGSEGV, CONST_CS | CONST_PERSISTENT);
|
||||
@@ -158,7 +157,7 @@ void php_register_signal_constants(INIT_FUNC_ARGS)
|
||||
REGISTER_LONG_CONSTANT("SIGBABY", (long) SIGSYS, CONST_CS | CONST_PERSISTENT);
|
||||
}
|
||||
|
||||
static void php_pcntl_init_globals(zend_pcntl_globals *pcntl_globals)
|
||||
static void php_pcntl_init_globals(zend_pcntl_globals *pcntl_globals)
|
||||
{
|
||||
zend_hash_init(&pcntl_globals->php_signal_table, 16, NULL, NULL, 1);
|
||||
|
||||
@@ -166,11 +165,11 @@ static void php_pcntl_init_globals(zend_pcntl_globals *pcntl_globals)
|
||||
memset(&pcntl_globals->php_signal_queue,0,sizeof(pcntl_globals->php_signal_queue));
|
||||
|
||||
zend_llist_init(&pcntl_globals->php_signal_queue, sizeof (long), NULL, 1);
|
||||
pcntl_globals->signal_queue_ready=0;
|
||||
pcntl_globals->processing_signal_queue=0;
|
||||
pcntl_globals->signal_queue_ready = 0;
|
||||
pcntl_globals->processing_signal_queue = 0;
|
||||
}
|
||||
|
||||
static void php_pcntl_shutdown_globals(zend_pcntl_globals *pcntl_globals)
|
||||
static void php_pcntl_shutdown_globals(zend_pcntl_globals *pcntl_globals)
|
||||
{
|
||||
zend_hash_destroy(&pcntl_globals->php_signal_table);
|
||||
zend_llist_destroy(&pcntl_globals->php_signal_queue);
|
||||
@@ -178,16 +177,15 @@ static void php_pcntl_shutdown_globals(zend_pcntl_globals *pcntl_globals)
|
||||
|
||||
PHP_MINIT_FUNCTION(pcntl)
|
||||
{
|
||||
php_register_signal_constants(INIT_FUNC_ARGS_PASSTHRU);
|
||||
php_register_signal_constants(INIT_FUNC_ARGS_PASSTHRU);
|
||||
ZEND_INIT_MODULE_GLOBALS(pcntl, php_pcntl_init_globals, php_pcntl_shutdown_globals);
|
||||
if (zend_register_extension(&pcntl_extension_entry, 0)==FAILURE)
|
||||
if (zend_register_extension(&pcntl_extension_entry, 0)==FAILURE)
|
||||
return FAILURE;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
PHP_MSHUTDOWN_FUNCTION(pcntl)
|
||||
{
|
||||
|
||||
zend_hash_destroy(&PCNTL_G(php_signal_table));
|
||||
zend_llist_destroy(&PCNTL_G(php_signal_queue));
|
||||
return SUCCESS;
|
||||
@@ -209,7 +207,7 @@ PHP_FUNCTION(pcntl_fork)
|
||||
{
|
||||
pid_t id;
|
||||
|
||||
id=fork();
|
||||
id = fork();
|
||||
if (id == -1) {
|
||||
php_error(E_ERROR, "Error %d in %s", errno, get_active_function_name(TSRMLS_C));
|
||||
}
|
||||
@@ -229,6 +227,8 @@ PHP_FUNCTION(pcntl_waitpid)
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lz|l", &pid, &z_status, &options) == FAILURE)
|
||||
return;
|
||||
|
||||
convert_to_long_ex(&z_status);
|
||||
|
||||
status = Z_LVAL_P(z_status);
|
||||
|
||||
@@ -247,14 +247,14 @@ PHP_FUNCTION(pcntl_wifexited)
|
||||
#ifdef WIFEXITED
|
||||
zval **status;
|
||||
int status_word;
|
||||
|
||||
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(ZEND_NUM_ARGS(), &status) == FAILURE){
|
||||
|
||||
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(ZEND_NUM_ARGS(), &status) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
|
||||
status_word = (int) Z_LVAL_PP(status);
|
||||
|
||||
if (WIFEXITED(status_word)) RETURN_TRUE;
|
||||
if (WIFEXITED(status_word)) RETURN_TRUE;
|
||||
#endif
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -267,14 +267,14 @@ PHP_FUNCTION(pcntl_wifstopped)
|
||||
#ifdef WIFSTOPPED
|
||||
zval **status;
|
||||
int status_word;
|
||||
|
||||
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(ZEND_NUM_ARGS(), &status) == FAILURE){
|
||||
|
||||
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(ZEND_NUM_ARGS(), &status) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
|
||||
status_word = (int) Z_LVAL_PP(status);
|
||||
|
||||
if (WIFSTOPPED(status_word)) RETURN_TRUE;
|
||||
if (WIFSTOPPED(status_word)) RETURN_TRUE;
|
||||
#endif
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -287,14 +287,14 @@ PHP_FUNCTION(pcntl_wifsignaled)
|
||||
#ifdef WIFSIGNALED
|
||||
zval **status;
|
||||
int status_word;
|
||||
|
||||
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(ZEND_NUM_ARGS(), &status) == FAILURE){
|
||||
|
||||
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(ZEND_NUM_ARGS(), &status) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
|
||||
status_word = (int) Z_LVAL_PP(status);
|
||||
|
||||
if (WIFSIGNALED(status_word)) RETURN_TRUE;
|
||||
if (WIFSIGNALED(status_word)) RETURN_TRUE;
|
||||
#endif
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -307,16 +307,16 @@ PHP_FUNCTION(pcntl_wexitstatus)
|
||||
#ifdef WEXITSTATUS
|
||||
zval **status;
|
||||
int status_word;
|
||||
|
||||
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(ZEND_NUM_ARGS(), &status) == FAILURE){
|
||||
|
||||
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(ZEND_NUM_ARGS(), &status) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
|
||||
status_word = (int) Z_LVAL_PP(status);
|
||||
|
||||
/* WEXITSTATUS only returns 8 bits so we *MUST* cast this to signed char
|
||||
if you want to have valid negative exit codes */
|
||||
RETURN_LONG((signed char) WEXITSTATUS(status_word));
|
||||
RETURN_LONG((signed char) WEXITSTATUS(status_word));
|
||||
#else
|
||||
RETURN_FALSE;
|
||||
#endif
|
||||
@@ -330,14 +330,14 @@ PHP_FUNCTION(pcntl_wtermsig)
|
||||
#ifdef WTERMSIG
|
||||
zval **status;
|
||||
int status_word;
|
||||
|
||||
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(ZEND_NUM_ARGS(), &status) == FAILURE){
|
||||
|
||||
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(ZEND_NUM_ARGS(), &status) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
|
||||
status_word = (int) Z_LVAL_PP(status);
|
||||
|
||||
RETURN_LONG(WTERMSIG(status_word));
|
||||
|
||||
RETURN_LONG(WTERMSIG(status_word));
|
||||
#else
|
||||
RETURN_FALSE;
|
||||
#endif
|
||||
@@ -352,7 +352,7 @@ PHP_FUNCTION(pcntl_wstopsig)
|
||||
zval **status;
|
||||
int status_word;
|
||||
|
||||
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(ZEND_NUM_ARGS(), &status) == FAILURE){
|
||||
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(ZEND_NUM_ARGS(), &status) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
}
|
||||
|
||||
@@ -372,85 +372,91 @@ PHP_FUNCTION(pcntl_exec)
|
||||
zval *args, *envs;
|
||||
zval **element;
|
||||
HashTable *args_hash, *envs_hash;
|
||||
int argc=0, argi=0;
|
||||
int envc=0, envi=0;
|
||||
int return_val=0;
|
||||
char **argv=NULL, **envp=NULL;
|
||||
char **current_arg, **pair;
|
||||
int argc = 0, argi = 0;
|
||||
int envc = 0, envi = 0;
|
||||
int return_val = 0;
|
||||
char **argv = NULL, **envp = NULL;
|
||||
char **current_arg, **pair;
|
||||
int pair_length;
|
||||
char *key;
|
||||
char *key;
|
||||
int key_length;
|
||||
char *path;
|
||||
int path_len;
|
||||
long key_num;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|aa", &path, &path_len, &args, &envs) == FAILURE) {
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|aa", &path, &path_len, &args, &envs) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ZEND_NUM_ARGS() > 1) {
|
||||
if (ZEND_NUM_ARGS() > 1) {
|
||||
/* Build argumnent list */
|
||||
args_hash=HASH_OF(args);
|
||||
argc=zend_hash_num_elements(args_hash);
|
||||
|
||||
argv=alloca((argc+2) * sizeof(char *));
|
||||
*argv=path;
|
||||
for ( zend_hash_internal_pointer_reset(args_hash), current_arg=argv+1;
|
||||
(argi < argc && (zend_hash_get_current_data(args_hash, (void **) &element) == SUCCESS));
|
||||
(argi++, current_arg++, zend_hash_move_forward(args_hash)) ) {
|
||||
*current_arg=Z_STRVAL_PP(element);
|
||||
args_hash = HASH_OF(args);
|
||||
argc = zend_hash_num_elements(args_hash);
|
||||
|
||||
argv = alloca((argc+2) * sizeof(char *));
|
||||
*argv = path;
|
||||
for ( zend_hash_internal_pointer_reset(args_hash), current_arg = argv+1;
|
||||
(argi < argc && (zend_hash_get_current_data(args_hash, (void **) &element) == SUCCESS));
|
||||
(argi++, current_arg++, zend_hash_move_forward(args_hash)) ) {
|
||||
|
||||
convert_to_string_ex(element);
|
||||
*current_arg = Z_STRVAL_PP(element);
|
||||
}
|
||||
*(current_arg)=NULL;
|
||||
*(current_arg) = NULL;
|
||||
} else {
|
||||
argv=alloca(2 * sizeof(char *));
|
||||
*argv=path;
|
||||
*(argv+1)=NULL;
|
||||
argv = alloca(2 * sizeof(char *));
|
||||
*argv = path;
|
||||
*(argv+1) = NULL;
|
||||
}
|
||||
|
||||
if ( ZEND_NUM_ARGS() == 3 ) {
|
||||
|
||||
if ( ZEND_NUM_ARGS() == 3 ) {
|
||||
/* Build environment pair list */
|
||||
envs_hash=HASH_OF(envs);
|
||||
envc=zend_hash_num_elements(envs_hash);
|
||||
|
||||
envp=alloca((envc+1) * sizeof(char *));
|
||||
for ( zend_hash_internal_pointer_reset(envs_hash), pair=envp;
|
||||
(envi < envc && (zend_hash_get_current_data(envs_hash, (void **) &element) == SUCCESS));
|
||||
(envi++, pair++, zend_hash_move_forward(envs_hash)) ) {
|
||||
switch (return_val=zend_hash_get_current_key_ex(envs_hash, &key, &key_length, &key_num, 0, NULL)) {
|
||||
envs_hash = HASH_OF(envs);
|
||||
envc = zend_hash_num_elements(envs_hash);
|
||||
|
||||
envp = alloca((envc+1) * sizeof(char *));
|
||||
for ( zend_hash_internal_pointer_reset(envs_hash), pair = envp;
|
||||
(envi < envc && (zend_hash_get_current_data(envs_hash, (void **) &element) == SUCCESS));
|
||||
(envi++, pair++, zend_hash_move_forward(envs_hash)) ) {
|
||||
switch (return_val = zend_hash_get_current_key_ex(envs_hash, &key, &key_length, &key_num, 0, NULL)) {
|
||||
case HASH_KEY_IS_LONG:
|
||||
key=alloca(101);
|
||||
key = alloca(101);
|
||||
snprintf(key, 100, "%ld", key_num);
|
||||
key_length=strlen(key);
|
||||
break;
|
||||
key_length = strlen(key);
|
||||
break;
|
||||
case HASH_KEY_NON_EXISTANT:
|
||||
pair--;
|
||||
continue;
|
||||
}
|
||||
|
||||
convert_to_string_ex(element);
|
||||
|
||||
/* Length of element + equal sign + length of key + null */
|
||||
pair_length=Z_STRLEN_PP(element) + key_length + 2;
|
||||
*pair=emalloc(pair_length);
|
||||
strlcpy(*pair, key, key_length);
|
||||
pair_length = Z_STRLEN_PP(element) + key_length + 2;
|
||||
*pair = emalloc(pair_length);
|
||||
strlcpy(*pair, key, key_length);
|
||||
strlcat(*pair, "=", pair_length);
|
||||
strlcat(*pair, Z_STRVAL_PP(element), pair_length);
|
||||
|
||||
|
||||
/* Cleanup */
|
||||
if (return_val == HASH_KEY_IS_LONG) free_alloca(key);
|
||||
}
|
||||
*(pair)=NULL;
|
||||
*(pair) = NULL;
|
||||
}
|
||||
|
||||
|
||||
if (execve(path, argv, envp) == -1) {
|
||||
php_error(E_WARNING, "Error has occured in %s: (errno %d) %s", get_active_function_name(TSRMLS_CC),
|
||||
errno, strerror(errno));
|
||||
|
||||
php_error(E_WARNING, "Error has occured in %s: (errno %d) %s",
|
||||
get_active_function_name(TSRMLS_C), errno, strerror(errno));
|
||||
}
|
||||
|
||||
|
||||
/* Cleanup */
|
||||
for (pair=envp; *pair!=NULL; pair++) efree(*pair);
|
||||
|
||||
if (envp != NULL) {
|
||||
for (pair = envp; *pair != NULL; pair++) efree(*pair);
|
||||
free_alloca(envp);
|
||||
}
|
||||
|
||||
free_alloca(argv);
|
||||
free_alloca(envp);
|
||||
|
||||
|
||||
RETURN_FALSE;
|
||||
}
|
||||
/* }}} */
|
||||
@@ -460,7 +466,7 @@ PHP_FUNCTION(pcntl_exec)
|
||||
PHP_FUNCTION(pcntl_signal)
|
||||
{
|
||||
zval **signo, **handle;
|
||||
char *func_name;
|
||||
char *func_name;
|
||||
|
||||
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &signo, &handle) == FAILURE) {
|
||||
WRONG_PARAM_COUNT;
|
||||
@@ -470,17 +476,17 @@ PHP_FUNCTION(pcntl_signal)
|
||||
|
||||
/* Special long value case for SIG_DFL and SIG_IGN */
|
||||
if (Z_TYPE_PP(handle)==IS_LONG) {
|
||||
if (Z_LVAL_PP(handle)!= (long) SIG_DFL && Z_LVAL_PP(handle) != (long) SIG_IGN) {
|
||||
php_error(E_WARNING, "Invalid value for handle argument specifEied in %s", get_active_function_name(TSRMLS_C));
|
||||
if (Z_LVAL_PP(handle)!= (long) SIG_DFL && Z_LVAL_PP(handle) != (long) SIG_IGN) {
|
||||
php_error(E_WARNING, "Invalid value for handle argument specifEied in %s", get_active_function_name(TSRMLS_C));
|
||||
}
|
||||
if (php_signal(Z_LVAL_PP(signo), (Sigfunc *) Z_LVAL_PP(handle))==SIG_ERR) {
|
||||
php_error(E_WARNING, "Error assigning singal in %s", get_active_function_name(TSRMLS_C));
|
||||
RETURN_FALSE;
|
||||
RETURN_FALSE;
|
||||
}
|
||||
RETURN_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (Z_TYPE_PP(handle)!=IS_STRING) {
|
||||
if (Z_TYPE_PP(handle) != IS_STRING) {
|
||||
php_error(E_WARNING, "Invalid type specified for handle argument in %s", get_active_function_name(TSRMLS_C));
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@@ -488,19 +494,19 @@ PHP_FUNCTION(pcntl_signal)
|
||||
convert_to_string_ex(handle); /* Just in case */
|
||||
if (!zend_is_callable(*handle, 0, &func_name)) {
|
||||
php_error(E_WARNING, "%s: %s is not a callable function name error", get_active_function_name(TSRMLS_C), func_name);
|
||||
efree(func_name);
|
||||
efree(func_name);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
efree(func_name);
|
||||
efree(func_name);
|
||||
|
||||
/* Add the function name to our signal table */
|
||||
zend_hash_index_update(&PCNTL_G(php_signal_table), Z_LVAL_PP(signo), Z_STRVAL_PP(handle), (Z_STRLEN_PP(handle) + 1) * sizeof(char), NULL);
|
||||
|
||||
if (php_signal(Z_LVAL_PP(signo), pcntl_signal_handler)==SIG_ERR) {
|
||||
php_error(E_WARNING, "Error assigning singal in %s", get_active_function_name(TSRMLS_C));
|
||||
RETURN_FALSE;
|
||||
php_error(E_WARNING, "Error assigning singal in %s", get_active_function_name(TSRMLS_C));
|
||||
RETURN_FALSE;
|
||||
}
|
||||
RETURN_TRUE;
|
||||
RETURN_TRUE;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -516,19 +522,19 @@ static void old_pcntl_signal_handler(int signo)
|
||||
DEBUG_OUT("Signl handler not fount");
|
||||
return;
|
||||
}
|
||||
/* DEBUG_OUT("Signal handler found, Calling %s\n", func_name); */
|
||||
/* DEBUG_OUT("Signal handler found, Calling %s\n", func_name); */
|
||||
MAKE_STD_ZVAL(param);
|
||||
MAKE_STD_ZVAL(call_name);
|
||||
MAKE_STD_ZVAL(retval);
|
||||
ZVAL_LONG(param, signo);
|
||||
ZVAL_STRING(call_name, func_name, 1);
|
||||
ZVAL_STRING(call_name, func_name, 1);
|
||||
|
||||
/* Call php singal handler - Note that we do not report errors, and we ignore the return value */
|
||||
call_user_function(EG(function_table), NULL, call_name, retval, 1, ¶m TSRMLS_CC);
|
||||
|
||||
zval_dtor(call_name);
|
||||
zval_dtor(call_name);
|
||||
efree(call_name);
|
||||
efree(param);
|
||||
efree(param);
|
||||
efree(retval);
|
||||
|
||||
return;
|
||||
@@ -537,27 +543,26 @@ static void old_pcntl_signal_handler(int signo)
|
||||
/* Our custom signal handler that calls the appropriate php_function */
|
||||
static void pcntl_signal_handler(int signo)
|
||||
{
|
||||
long signal_num=signo;
|
||||
long signal_num = signo;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
|
||||
DEBUG_OUT("Caught signo %d\n", signo);
|
||||
if (! PCNTL_G(processing_signal_queue) && pcntl_zend_extension_active ) {
|
||||
zend_llist_add_element(&PCNTL_G(php_signal_queue), &signal_num);
|
||||
PCNTL_G(signal_queue_ready)=1;
|
||||
PCNTL_G(signal_queue_ready) = 1;
|
||||
DEBUG_OUT("Added queue entry\n");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* Pcntl Zend Extension Hooks */
|
||||
|
||||
int pcntl_zend_extension_startup(zend_extension *extension)
|
||||
{
|
||||
TSRMLS_FETCH();
|
||||
|
||||
|
||||
DEBUG_OUT("Statup Called\n");
|
||||
pcntl_zend_extension_active=1;
|
||||
pcntl_zend_extension_active = 1;
|
||||
CG(extended_info) = 1;
|
||||
return SUCCESS;
|
||||
}
|
||||
@@ -571,9 +576,9 @@ void pcntl_zend_extension_shutdown(zend_extension *extension)
|
||||
void pcntl_zend_extension_activate(void)
|
||||
{
|
||||
TSRMLS_FETCH();
|
||||
|
||||
|
||||
DEBUG_OUT("Activate Called\n");
|
||||
pcntl_zend_extension_active=1;
|
||||
pcntl_zend_extension_active = 1;
|
||||
CG(extended_info) = 1;
|
||||
return;
|
||||
}
|
||||
@@ -581,7 +586,7 @@ void pcntl_zend_extension_activate(void)
|
||||
void pcntl_zend_extension_deactivate(void)
|
||||
{
|
||||
DEBUG_OUT("Deactivate Called\n");
|
||||
pcntl_zend_extension_active=0;
|
||||
pcntl_zend_extension_active = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -597,33 +602,32 @@ void pcntl_zend_extension_statement_handler(zend_op_array *op_array)
|
||||
if (! PCNTL_G(signal_queue_ready) || PCNTL_G(processing_signal_queue))
|
||||
return;
|
||||
|
||||
/* Mark our queue empty */
|
||||
PCNTL_G(signal_queue_ready)=0;
|
||||
|
||||
/* Mark our queue empty */
|
||||
PCNTL_G(signal_queue_ready) = 0;
|
||||
|
||||
/* If for some reason our signal queue is empty then return */
|
||||
if (zend_llist_count(&PCNTL_G(php_signal_queue)) <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* Disable queue so this function is not infinate */
|
||||
PCNTL_G(processing_signal_queue)=1;
|
||||
|
||||
PCNTL_G(processing_signal_queue) = 1;
|
||||
|
||||
/* Allocate */
|
||||
MAKE_STD_ZVAL(param);
|
||||
MAKE_STD_ZVAL(call_name);
|
||||
MAKE_STD_ZVAL(retval);
|
||||
|
||||
/* Traverse through our signal queue and call the appropriate php functions */
|
||||
for (element=(&PCNTL_G(php_signal_queue))->head; element; element=element->next) {
|
||||
long *signal_num=(long *)&element->data;
|
||||
for (element = (&PCNTL_G(php_signal_queue))->head; element; element = element->next) {
|
||||
long *signal_num = (long *)&element->data;
|
||||
if (zend_hash_index_find(&PCNTL_G(php_signal_table), *signal_num, (void *) &func_name)==FAILURE) {
|
||||
continue;
|
||||
}
|
||||
convert_to_long_ex(¶m);
|
||||
convert_to_string_ex(&call_name);
|
||||
|
||||
ZVAL_LONG(param, *signal_num);
|
||||
ZVAL_STRING(call_name, func_name, 0);
|
||||
|
||||
|
||||
/* Call php singal handler - Note that we do not report errors, and we ignore the return value */
|
||||
call_user_function(EG(function_table), NULL, call_name, retval, 1, ¶m TSRMLS_CC);
|
||||
}
|
||||
@@ -631,7 +635,7 @@ void pcntl_zend_extension_statement_handler(zend_op_array *op_array)
|
||||
zend_llist_clean(&PCNTL_G(php_signal_queue));
|
||||
|
||||
/* Re-enable queue */
|
||||
PCNTL_G(processing_signal_queue)=0;
|
||||
PCNTL_G(processing_signal_queue) = 0;
|
||||
|
||||
/* Clean up */
|
||||
efree(param);
|
||||
|
||||
+22
-17
@@ -1439,34 +1439,38 @@ PHPAPI void php_COM_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_pro
|
||||
pval *object_handle;
|
||||
|
||||
PHP_FN(com_load)(INTERNAL_FUNCTION_PARAM_PASSTHRU);
|
||||
if (!zend_is_true(return_value)) {
|
||||
ZVAL_FALSE(object);
|
||||
return;
|
||||
if (zend_is_true(return_value)) {
|
||||
ALLOC_ZVAL(object_handle);
|
||||
*object_handle = *return_value;
|
||||
pval_copy_constructor(object_handle);
|
||||
INIT_PZVAL(object_handle);
|
||||
zend_hash_index_update(Z_OBJPROP_P(object), 0, &object_handle, sizeof(pval *), NULL);
|
||||
pval_destructor(&function_name->element);
|
||||
} else {
|
||||
ZVAL_NULL(object);
|
||||
}
|
||||
ALLOC_ZVAL(object_handle);
|
||||
*object_handle = *return_value;
|
||||
pval_copy_constructor(object_handle);
|
||||
INIT_PZVAL(object_handle);
|
||||
zend_hash_index_update(Z_OBJPROP_P(object), 0, &object_handle, sizeof(pval *), NULL);
|
||||
pval_destructor(&function_name->element);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
RETVAL_NULL();
|
||||
property = php_COM_get_property_handler(property_reference);
|
||||
if (Z_TYPE(property) == IS_NULL) {
|
||||
if (property.refcount == 1) {
|
||||
pval_destructor(&property);
|
||||
}
|
||||
|
||||
if (Z_TYPE(property) != IS_OBJECT) {
|
||||
pval_destructor(&property);
|
||||
pval_destructor(&function_name->element);
|
||||
|
||||
/* error message - function call on a non-object */
|
||||
return;
|
||||
}
|
||||
|
||||
zend_hash_index_find(Z_OBJPROP(property), 0, (void **) &handle);
|
||||
obj = (comval *)zend_list_find(Z_LVAL_PP(handle), &type);
|
||||
|
||||
if (!obj || (type != IS_COM)) {
|
||||
pval_destructor(&property);
|
||||
pval_destructor(&function_name->element);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1486,9 +1490,7 @@ PHPAPI void php_COM_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_pro
|
||||
arguments = (pval **) emalloc(sizeof(pval *)*arg_count);
|
||||
zend_get_parameters_array(ht, arg_count, arguments);
|
||||
|
||||
if (do_COM_invoke(obj , &function_name->element, var_result, arguments, arg_count TSRMLS_CC) == FAILURE) {
|
||||
RETVAL_FALSE;
|
||||
} else {
|
||||
if (do_COM_invoke(obj , &function_name->element, var_result, arguments, arg_count TSRMLS_CC) == SUCCESS) {
|
||||
php_variant_to_pval(var_result, return_value, codepage TSRMLS_CC);
|
||||
}
|
||||
|
||||
@@ -1496,9 +1498,12 @@ PHPAPI void php_COM_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_pro
|
||||
efree(arguments);
|
||||
}
|
||||
|
||||
if (property.refcount == 1) {
|
||||
if (zend_llist_count(property_reference->elements_list) > 1) {
|
||||
/* destruct temporary object */
|
||||
zend_list_delete(Z_LVAL_PP(handle));
|
||||
pval_destructor(&property);
|
||||
}
|
||||
|
||||
pval_destructor(&function_name->element);
|
||||
}
|
||||
|
||||
|
||||
@@ -1002,7 +1002,7 @@ PHP_FUNCTION(socket_bind)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
retval = bind(php_sock->bsd_socket, (struct sockaddr *)sa, sizeof(sa_storage));
|
||||
retval = bind(php_sock->bsd_socket, (struct sockaddr *)sa, sizeof(struct sockaddr_in));
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1263,7 +1263,7 @@ PHP_FUNCTION(socket_recv)
|
||||
zval_dtor(buf);
|
||||
Z_TYPE_P(buf)=IS_NULL;
|
||||
} else {
|
||||
recv_buf[retval+1] = '\0';
|
||||
recv_buf[retval] = '\0';
|
||||
|
||||
/* Rebuild buffer zval */
|
||||
zval_dtor(buf);
|
||||
|
||||
@@ -145,7 +145,7 @@ unsigned char *php_base64_decode(const unsigned char *str, int length, int *ret_
|
||||
if(ret_length) {
|
||||
*ret_length = j;
|
||||
}
|
||||
result[k] = '\0';
|
||||
result[j] = '\0';
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -1889,6 +1889,14 @@ PHP_FUNCTION(highlight_file)
|
||||
}
|
||||
convert_to_string(filename);
|
||||
|
||||
if (PG(safe_mode) && (!php_checkuid(Z_STRVAL_P(filename), NULL, CHECKUID_ALLOW_ONLY_FILE))) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (php_check_open_basedir(Z_STRVAL_P(filename) TSRMLS_CC)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (i) {
|
||||
php_start_ob_buffer (NULL, 0, 1 TSRMLS_CC);
|
||||
}
|
||||
@@ -2493,6 +2501,15 @@ PHP_FUNCTION(parse_ini_file)
|
||||
}
|
||||
|
||||
convert_to_string_ex(filename);
|
||||
|
||||
if (PG(safe_mode) && (!php_checkuid(Z_STRVAL_PP(filename), NULL, CHECKUID_ALLOW_ONLY_FILE))) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (php_check_open_basedir(Z_STRVAL_PP(filename) TSRMLS_CC)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
fh.handle.fp = VCWD_FOPEN(Z_STRVAL_PP(filename), "r");
|
||||
if (!fh.handle.fp) {
|
||||
php_error(E_WARNING, "Cannot open '%s' for reading", Z_STRVAL_PP(filename));
|
||||
|
||||
+3
-3
@@ -1453,7 +1453,7 @@ PHP_FUNCTION(fseek)
|
||||
PHP_FUNCTION(mkdir)
|
||||
{
|
||||
int dir_len, ret;
|
||||
mode_t mode = 0777;
|
||||
long mode = 0777;
|
||||
char *dir;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &dir, &dir_len, &mode) == FAILURE) {
|
||||
@@ -1468,7 +1468,7 @@ PHP_FUNCTION(mkdir)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
ret = VCWD_MKDIR(dir, mode);
|
||||
ret = VCWD_MKDIR(dir, (mode_t)mode);
|
||||
if (ret < 0) {
|
||||
php_error(E_WARNING, "mkdir() failed (%s)", strerror(errno));
|
||||
RETURN_FALSE;
|
||||
@@ -1490,7 +1490,7 @@ PHP_FUNCTION(rmdir)
|
||||
|
||||
convert_to_string_ex(arg1);
|
||||
|
||||
if (PG(safe_mode) &&(!php_checkuid(Z_STRVAL_PP(arg1), NULL, CHECKUID_ALLOW_FILE_NOT_EXISTS))) {
|
||||
if (PG(safe_mode) &&(!php_checkuid(Z_STRVAL_PP(arg1), NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -371,7 +371,7 @@ PHPAPI char *php_reg_replace(const char *pattern, const char *replace, const cha
|
||||
&& subs[walk[1] - '0'].rm_so > -1
|
||||
&& subs[walk[1] - '0'].rm_eo > -1
|
||||
/* this next case shouldn't happen. it does. */
|
||||
&& subs[walk[1] - '0'].rm_so < subs[walk[1] - '0'].rm_eo) {
|
||||
&& subs[walk[1] - '0'].rm_so <= subs[walk[1] - '0'].rm_eo) {
|
||||
tmp = subs[walk[1] - '0'].rm_eo
|
||||
- subs[walk[1] - '0'].rm_so;
|
||||
memcpy (walkbuf,
|
||||
|
||||
+4
-3
@@ -55,23 +55,24 @@ if test "$PHP_XSLT" != "no"; then
|
||||
|
||||
if test "$PHP_XSLT_SABLOT" != "no"; then
|
||||
found_expat=no
|
||||
for i in $PHP_EXPAT_DIR $XSLT_DIR; do
|
||||
for i in $PHP_EXPAT_DIR $XSLT_DIR /usr/local /usr; do
|
||||
if test -f $i/lib/libexpat.a -o -f $i/lib/libexpat.$SHLIB_SUFFIX_NAME; then
|
||||
AC_DEFINE(HAVE_LIBEXPAT2, 1, [ ])
|
||||
PHP_ADD_INCLUDE($i/include)
|
||||
PHP_ADD_LIBRARY_WITH_PATH(expat, $i/lib, XSLT_SHARED_LIBADD)
|
||||
found_expat=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if test "$found_expat" = "no"; then
|
||||
PHP_ADD_LIBRARY(xmlparse)
|
||||
PHP_ADD_LIBRARY(xmltok)
|
||||
AC_MSG_ERROR([expat not found. To build sablotron you need the expat library.])
|
||||
fi
|
||||
|
||||
if test "$PHP_ICONV" = "no"; then
|
||||
PHP_ICONV=yes
|
||||
fi
|
||||
|
||||
PHP_SETUP_ICONV(XSLT_SHARED_LIBADD, [], [
|
||||
AC_MSG_ERROR([iconv not found, in order to build sablotron you need the iconv library])
|
||||
])
|
||||
|
||||
@@ -268,7 +268,7 @@ PHPAPI int php_check_safe_mode_include_dir(char *path TSRMLS_DC)
|
||||
}
|
||||
|
||||
/* Nothing to check... */
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@@ -441,7 +441,7 @@ PHPAPI FILE *php_fopen_with_path(char *filename, char *mode, char *path, char **
|
||||
}
|
||||
|
||||
filename_length = strlen(filename);
|
||||
|
||||
|
||||
/* Relative path open */
|
||||
if (*filename == '.') {
|
||||
if (PG(safe_mode) && (!php_checkuid(filename, mode, CHECKUID_CHECK_MODE_PARAM))) {
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
/* automatically generated by configure */
|
||||
/* edit configure.in to change version number */
|
||||
#define PHP_VERSION "4.2.1RC1"
|
||||
#define PHP_VERSION "4.2.1"
|
||||
+5
-3
@@ -33,6 +33,8 @@
|
||||
#include "rfc1867.h"
|
||||
|
||||
|
||||
#undef DEBUG_FILE_UPLOAD
|
||||
|
||||
#define SAFE_RETURN { \
|
||||
if (lbuf) efree(lbuf); \
|
||||
if (abuf) efree(abuf); \
|
||||
@@ -752,19 +754,19 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler)
|
||||
}
|
||||
fclose(fp);
|
||||
|
||||
#ifdef DEBUG_FILE_UPLOAD
|
||||
if(strlen(filename) > 0 && total_bytes == 0) {
|
||||
sapi_module.sapi_error(E_WARNING, "Uploaded file size 0 - file [%s=%s] not saved", param, filename);
|
||||
cancel_upload = UPLOAD_ERROR_E;
|
||||
}
|
||||
|
||||
if (cancel_upload || total_bytes == 0) {
|
||||
#endif
|
||||
|
||||
if (cancel_upload) {
|
||||
if (temp_filename) {
|
||||
unlink(temp_filename);
|
||||
efree(temp_filename);
|
||||
}
|
||||
temp_filename="";
|
||||
|
||||
} else {
|
||||
zend_hash_add(SG(rfc1867_uploaded_files), temp_filename, strlen(temp_filename) + 1, &temp_filename, sizeof(char *), NULL);
|
||||
}
|
||||
|
||||
@@ -90,7 +90,9 @@ PHP_FUNCTION(apache_lookup_uri)
|
||||
ADD_STRING(method);
|
||||
ADD_LONG(mtime);
|
||||
ADD_LONG(clength);
|
||||
#if !MODULE_MAGIC_AT_LEAST(20020506,0)
|
||||
ADD_STRING(boundary);
|
||||
#endif
|
||||
ADD_STRING(range);
|
||||
ADD_LONG(chunked);
|
||||
ADD_STRING(content_type);
|
||||
|
||||
@@ -437,6 +437,23 @@ static int
|
||||
php_apache_server_startup(apr_pool_t *pconf, apr_pool_t *plog,
|
||||
apr_pool_t *ptemp, server_rec *s)
|
||||
{
|
||||
void *data = NULL;
|
||||
const char *userdata_key = "apache2filter_post_config";
|
||||
|
||||
/* Apache will load, unload and then reload a DSO module. This
|
||||
* prevents us from starting PHP until the second load. */
|
||||
apr_pool_userdata_get(&data, userdata_key, s->process->pool);
|
||||
if (data == NULL) {
|
||||
/* We must use set() here and *not* setn(), otherwise the
|
||||
* static string pointed to by userdata_key will be mapped
|
||||
* to a different location when the DSO is reloaded and the
|
||||
* pointers won't match, causing get() to return NULL when
|
||||
* we expected it to return non-NULL. */
|
||||
apr_pool_userdata_set((const void *)1, userdata_key,
|
||||
apr_pool_cleanup_null, s->process->pool);
|
||||
return OK;
|
||||
}
|
||||
|
||||
tsrm_startup(1, 1, 0, NULL);
|
||||
sapi_startup(&apache2_sapi_module);
|
||||
apache2_sapi_module.startup(&apache2_sapi_module);
|
||||
|
||||
+8
-15
@@ -497,23 +497,16 @@ int main(int argc, char *argv[])
|
||||
in case some server does something different than above */
|
||||
&& (!redirect_status_env || !getenv(redirect_status_env))
|
||||
) {
|
||||
PUTS("<b>Security Alert!</b> PHP CGI cannot be accessed directly.\n\
|
||||
\n\
|
||||
<P>This PHP CGI binary was compiled with force-cgi-redirect enabled. This\n\
|
||||
PUTS("<b>Security Alert!</b> The PHP CGI cannot be accessed directly.\n\n\
|
||||
<p>This PHP CGI binary was compiled with force-cgi-redirect enabled. This\n\
|
||||
means that a page will only be served up if the REDIRECT_STATUS CGI variable is\n\
|
||||
set. This variable is set, for example, by Apache's Action directive redirect.\n\
|
||||
<P>You may disable this restriction by recompiling the PHP binary with the\n\
|
||||
--disable-force-cgi-redirect switch. If you do this and you have your PHP CGI\n\
|
||||
binary accessible somewhere in your web tree, people will be able to circumvent\n\
|
||||
.htaccess security by loading files through the PHP parser. A good way around\n\
|
||||
this is to define doc_root in your php.ini file to something other than your\n\
|
||||
top-level DOCUMENT_ROOT. This way you can separate the part of your web space\n\n\
|
||||
which uses PHP from the normal part using .htaccess security. If you do not have\n\
|
||||
any .htaccess restrictions anywhere on your site you can leave doc_root undefined.\n\n\n\
|
||||
If you are running IIS, you may safely set cgi.force_redirect=0 in php.ini.\n\
|
||||
\n");
|
||||
set, e.g. via an Apache Action directive.</p>\n\
|
||||
<p>For more information as to <i>why</i> this behaviour exists, see the <a href=\"http://php.net/security.cgi-bin\">\
|
||||
manual page for CGI security</a>.</p>\n\
|
||||
<p>For more information about changing this behaviour or re-enabling this webserver,\n\
|
||||
consult the installation file that came with this distribution, or visit \n\
|
||||
<a href=\"http://php.net/install.windows\">the manual page</a>.</p>\n");
|
||||
|
||||
/* remove that detailed explanation some time */
|
||||
#ifdef ZTS
|
||||
tsrm_shutdown();
|
||||
#endif
|
||||
|
||||
+2
-1
@@ -394,7 +394,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* Set some CLI defaults */
|
||||
SG(options) |= SAPI_OPTION_NO_CHDIR;
|
||||
zend_alter_ini_entry("html_errors", 12, "0", 1, PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
|
||||
zend_alter_ini_entry("register_argc_argv", 19, "1", 1, PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
|
||||
zend_alter_ini_entry("html_errors", 12, "0", 1, PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
|
||||
zend_alter_ini_entry("implicit_flush", 15, "1", 1, PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
|
||||
zend_alter_ini_entry("max_execution_time", 19, "0", 1, PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
|
||||
|
||||
|
||||
+29
-6
@@ -233,6 +233,10 @@ Web server configuration
|
||||
AddType application/x-httpd-php .php
|
||||
Action application/x-httpd-php "/php/php.exe"
|
||||
|
||||
Please note that you cannot use php-cli.exe with your webserver. You have
|
||||
to use php.exe which can be found in the sapi directory of your
|
||||
PHP distribution.
|
||||
|
||||
Note, we consider installing PHP like this suicidal.
|
||||
|
||||
As a further precaution, we recommend you change the "/php/"
|
||||
@@ -288,9 +292,12 @@ Web server configuration
|
||||
Type in the extension you wish to use for your php scripts. ex: .php
|
||||
Double click on the new string value and enter the path to
|
||||
php.exe in the value data field.
|
||||
ex: c:\php\php.exe
|
||||
ex: c:\php\sapi\php.exe
|
||||
Repeat these steps for each extension you wish to associate
|
||||
with PHP scripts.
|
||||
Please note that you cannot use php-cli.exe with your webserver, you need
|
||||
to use php.exe which can be found in the sapi directory of your PHP
|
||||
distribution.
|
||||
|
||||
The following steps do not affect the web server installation and only
|
||||
apply if you want your php scripts to be executed when they are run
|
||||
@@ -348,7 +355,11 @@ Web server configuration
|
||||
and then enter the App Mappings tab.
|
||||
|
||||
Click Add, and in the Executable box, type:
|
||||
c:\php\php.exe (assuming that you have unzipped PHP in c:\php\).
|
||||
c:\php\sapi\php.exe (assuming that you have unzipped PHP in c:\php\).
|
||||
|
||||
Please note that you cannot use php-cli.exe with your webserver, you need
|
||||
to use php.exe which can be found in the sapi directory of your PHP
|
||||
distribution.
|
||||
|
||||
In the Extension box, type the file name extension you want
|
||||
associated with PHP scripts. Leave 'Method exclusions'
|
||||
@@ -399,7 +410,7 @@ Web server configuration
|
||||
tray and select 'Properties'
|
||||
Step 3: Click on 'Web Server Global Settings'
|
||||
Step 4: On the 'External' tab, enter:
|
||||
virtual = .php | actual = c:\path-to-php-dir\php.exe
|
||||
virtual = .php | actual = c:\php\sapi\php.exe
|
||||
and use the Add button.
|
||||
Step 5: On the Mime tab, enter:
|
||||
virtual = wwwserver/stdcgi | actual = .php
|
||||
@@ -431,9 +442,13 @@ Web server configuration
|
||||
Edit the Server Properties and select the tab "Mapping".
|
||||
|
||||
From the List select "Associations" and enter the desired
|
||||
extension (".php") and the path to the CGI exe (ex. c:\php\php.exe)
|
||||
extension (".php") and the path to the CGI exe (ex. c:\php\sapi\php.exe)
|
||||
or the ISAPI dll file (ex. c:\php\sapi\php4isapi.dll).
|
||||
|
||||
Please note that you cannot use php-cli.exe with your webserver, you need
|
||||
to use php.exe which can be found in the sapi directory of your PHP
|
||||
distribution.
|
||||
|
||||
Select "Content Types" add the same extension ".php"
|
||||
and enter the content type. If you choose the CGI exe
|
||||
file, enter 'wwwserver/shellcgi', if you chose the
|
||||
@@ -458,7 +473,11 @@ Web server configuration
|
||||
into the field File extensions (.xxx).
|
||||
|
||||
In Filter command or script put the path and name
|
||||
of your php executable i.e. c:\php\php.exe.
|
||||
of your php executable i.e. c:\php\sapi\php.exe.
|
||||
|
||||
Please note that you cannot use php-cli.exe with your webserver, you need
|
||||
to use php.exe which can be found in the sapi directory of your PHP
|
||||
distribution.
|
||||
|
||||
Press the 'Save' icon.
|
||||
|
||||
@@ -473,7 +492,11 @@ Web server configuration
|
||||
|
||||
Make a file assocition from the command line (type the 2 following lines)
|
||||
assoc .php=PHPScript
|
||||
ftype PHPScript=c:\php\php.exe %1 %*
|
||||
ftype PHPScript=c:\php\sapi\php.exe %1 %*
|
||||
|
||||
Please note that you cannot use php-cli.exe with your webserver, you need
|
||||
to use php.exe which can be found in the sapi directory of your PHP
|
||||
distribution.
|
||||
|
||||
In the Netscape Enterprise Administration Server create a dummy shellcgi
|
||||
directory and remove it just after (this step creates 5 important lines in
|
||||
|
||||
Reference in new issue
Block a user