Skip to content

Commit 4fcecfb

Browse files
petknikic
authored andcommitted
Remove old apache_hooks occurrence
The apache_hooks SAPI has been removed since PHP >= 7.0 and there is no need to have two different php_request_startup definitions. Also php_request_startup_for_hook() and php_request_shutdown_for_hook() functions are not used in the PHP source code directly anymore. They are out of sync and are not touched when making changes to the shutdown sequence. The php_start_sapi() function was therefore not used anymore and is removed.
1 parent 3644cc6 commit 4fcecfb

File tree

2 files changed

+0
-142
lines changed

2 files changed

+0
-142
lines changed

main/main.c

Lines changed: 0 additions & 140 deletions
Original file line numberDiff line numberDiff line change
@@ -1590,39 +1590,8 @@ static void sigchld_handler(int apar)
15901590
/* }}} */
15911591
#endif
15921592

1593-
/* {{{ php_start_sapi()
1594-
*/
1595-
static int php_start_sapi(void)
1596-
{
1597-
int retval = SUCCESS;
1598-
1599-
if(!SG(sapi_started)) {
1600-
zend_try {
1601-
PG(during_request_startup) = 1;
1602-
1603-
/* initialize global variables */
1604-
PG(modules_activated) = 0;
1605-
PG(header_is_being_sent) = 0;
1606-
PG(connection_status) = PHP_CONNECTION_NORMAL;
1607-
1608-
zend_activate();
1609-
zend_set_timeout(EG(timeout_seconds), 1);
1610-
zend_activate_modules();
1611-
PG(modules_activated)=1;
1612-
} zend_catch {
1613-
retval = FAILURE;
1614-
} zend_end_try();
1615-
1616-
SG(sapi_started) = 1;
1617-
}
1618-
return retval;
1619-
}
1620-
1621-
/* }}} */
1622-
16231593
/* {{{ php_request_startup
16241594
*/
1625-
#ifndef APACHE_HOOKS
16261595
int php_request_startup(void)
16271596
{
16281597
int retval = SUCCESS;
@@ -1702,61 +1671,6 @@ int php_request_startup(void)
17021671

17031672
return retval;
17041673
}
1705-
# else
1706-
int php_request_startup(void)
1707-
{
1708-
int retval = SUCCESS;
1709-
1710-
zend_interned_strings_activate();
1711-
1712-
#if PHP_SIGCHILD
1713-
signal(SIGCHLD, sigchld_handler);
1714-
#endif
1715-
1716-
if (php_start_sapi() == FAILURE) {
1717-
return FAILURE;
1718-
}
1719-
1720-
php_output_activate();
1721-
sapi_activate();
1722-
php_hash_environment();
1723-
1724-
zend_try {
1725-
PG(during_request_startup) = 1;
1726-
if (PG(expose_php)) {
1727-
sapi_add_header(SAPI_PHP_VERSION_HEADER, sizeof(SAPI_PHP_VERSION_HEADER)-1, 1);
1728-
}
1729-
} zend_catch {
1730-
retval = FAILURE;
1731-
} zend_end_try();
1732-
1733-
return retval;
1734-
}
1735-
# endif
1736-
/* }}} */
1737-
1738-
/* {{{ php_request_startup_for_hook
1739-
*/
1740-
int php_request_startup_for_hook(void)
1741-
{
1742-
int retval = SUCCESS;
1743-
1744-
zend_interned_strings_activate();
1745-
1746-
#if PHP_SIGCHLD
1747-
signal(SIGCHLD, sigchld_handler);
1748-
#endif
1749-
1750-
if (php_start_sapi() == FAILURE) {
1751-
return FAILURE;
1752-
}
1753-
1754-
php_output_activate();
1755-
sapi_activate_headers_only();
1756-
php_hash_environment();
1757-
1758-
return retval;
1759-
}
17601674
/* }}} */
17611675

17621676
/* {{{ php_request_shutdown_for_exec
@@ -1771,60 +1685,6 @@ void php_request_shutdown_for_exec(void *dummy)
17711685
}
17721686
/* }}} */
17731687

1774-
/* {{{ php_request_shutdown_for_hook
1775-
*/
1776-
void php_request_shutdown_for_hook(void *dummy)
1777-
{
1778-
1779-
if (PG(modules_activated)) zend_try {
1780-
php_call_shutdown_functions();
1781-
} zend_end_try();
1782-
1783-
if (PG(modules_activated)) {
1784-
zend_deactivate_modules();
1785-
}
1786-
1787-
if (PG(modules_activated)) {
1788-
php_free_shutdown_functions();
1789-
}
1790-
1791-
zend_try {
1792-
zend_unset_timeout();
1793-
} zend_end_try();
1794-
1795-
zend_try {
1796-
int i;
1797-
1798-
for (i = 0; i < NUM_TRACK_VARS; i++) {
1799-
zval_ptr_dtor(&PG(http_globals)[i]);
1800-
}
1801-
} zend_end_try();
1802-
1803-
zend_deactivate();
1804-
1805-
zend_try {
1806-
sapi_deactivate();
1807-
} zend_end_try();
1808-
1809-
zend_try {
1810-
php_shutdown_stream_hashes();
1811-
} zend_end_try();
1812-
1813-
zend_interned_strings_deactivate();
1814-
1815-
zend_try {
1816-
shutdown_memory_manager(CG(unclean_shutdown), 0);
1817-
} zend_end_try();
1818-
1819-
#ifdef ZEND_SIGNALS
1820-
zend_try {
1821-
zend_signal_deactivate();
1822-
} zend_end_try();
1823-
#endif
1824-
}
1825-
1826-
/* }}} */
1827-
18281688
/* {{{ php_request_shutdown
18291689
*/
18301690
void php_request_shutdown(void *dummy)

main/php_main.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ PHPAPI int php_module_startup(sapi_module_struct *sf, zend_module_entry *additio
3434
PHPAPI void php_module_shutdown(void);
3535
PHPAPI void php_module_shutdown_for_exec(void);
3636
PHPAPI int php_module_shutdown_wrapper(sapi_module_struct *sapi_globals);
37-
PHPAPI int php_request_startup_for_hook(void);
38-
PHPAPI void php_request_shutdown_for_hook(void *dummy);
3937

4038
PHPAPI int php_register_extensions(zend_module_entry **ptr, int count);
4139

0 commit comments

Comments
 (0)