Changeset 23921
- Timestamp:
- 11/05/09 14:43:28 (10 months ago)
- Files:
-
- trunk/midgard/apis/php5/midgard.c (modified) (7 diffs)
- trunk/midgard/apis/php5/php_midgard.h (modified) (1 diff)
- trunk/midgard/apis/php5/php_midgard__helpers.h (modified) (1 diff)
- trunk/midgard/apis/php5/tests/021a-superglobals_on.phpt (added)
- trunk/midgard/apis/php5/tests/021b-superglobals_off.phpt (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/midgard/apis/php5/midgard.c
r23884 r23921 252 252 NULL, 253 253 midgard2_deps, 254 "midgard2",254 MIDGARD_PACKAGE_NAME, 255 255 midgard2_functions, 256 256 PHP_MINIT(midgard2), … … 268 268 269 269 PHP_INI_BEGIN() 270 STD_PHP_INI_ENTRY("midgard.configuration", "", PHP_INI_SYSTEM, OnUpdateString, midgard_configuration, zend_midgard2_globals, midgard2_globals) 271 STD_PHP_INI_ENTRY("midgard.configuration_file", "", PHP_INI_SYSTEM, OnUpdateString, midgard_configuration_file, zend_midgard2_globals, midgard2_globals) 272 STD_PHP_INI_BOOLEAN("midgard.http", "0", PHP_INI_SYSTEM, OnUpdateBool, midgard_http, zend_midgard2_globals, midgard2_globals) 273 STD_PHP_INI_BOOLEAN("midgard.engine", "1", PHP_INI_ALL, OnUpdateBool, midgard_engine, zend_midgard2_globals, midgard2_globals) 274 STD_PHP_INI_BOOLEAN("midgard.memory_debug", "0", PHP_INI_ALL, OnUpdateBool, midgard_memory_debug, zend_midgard2_globals, midgard2_globals) 270 STD_PHP_INI_ENTRY("midgard.configuration", "", PHP_INI_SYSTEM, OnUpdateString, midgard_configuration, zend_midgard2_globals, midgard2_globals) 271 STD_PHP_INI_ENTRY("midgard.configuration_file", "", PHP_INI_SYSTEM, OnUpdateString, midgard_configuration_file, zend_midgard2_globals, midgard2_globals) 272 STD_PHP_INI_BOOLEAN("midgard.http", "0", PHP_INI_SYSTEM, OnUpdateBool, midgard_http, zend_midgard2_globals, midgard2_globals) 273 STD_PHP_INI_BOOLEAN("midgard.engine", "1", PHP_INI_ALL, OnUpdateBool, midgard_engine, zend_midgard2_globals, midgard2_globals) 274 STD_PHP_INI_BOOLEAN("midgard.memory_debug", "0", PHP_INI_ALL, OnUpdateBool, midgard_memory_debug, zend_midgard2_globals, midgard2_globals) 275 STD_PHP_INI_BOOLEAN("midgard.superglobals_compat", "0", PHP_INI_SYSTEM, OnUpdateBool, superglobals_compat, zend_midgard2_globals, midgard2_globals) 275 276 // quota isn't used? 276 277 // STD_PHP_INI_BOOLEAN("midgard.quota", "0", PHP_INI_ALL, OnUpdateBool, midgard_quota, midgard2_globals *, midgard2_globals) … … 336 337 337 338 ze = zend_get_extension(MIDGARD_PACKAGE_NAME); 339 338 340 if (ze != NULL) { 339 php_error(E_NOTICE, "Module midgard2 already loaded. It's recommended to load it via php.ini");341 php_error(E_NOTICE, "Module %s already loaded. It's recommended to load it via php.ini", MIDGARD_PACKAGE_NAME); 340 342 return SUCCESS; 341 343 } 342 344 343 zend_register_auto_global("_MIDGARD", sizeof("_MIDGARD")-1, NULL TSRMLS_CC);344 zend_register_auto_global("_MIDCOM", sizeof("_MIDCOM")-1, NULL TSRMLS_CC);345 zend_register_auto_global("_MIDGARD_CONNECTION", sizeof("_MIDGARD_CONNECTION")-1, NULL TSRMLS_CC);346 347 /*348 zend_module_entry *module;349 int rv = zend_hash_find(&module_registry, "midgard2", strlen("midgard2")+1, (void**)&module);350 if (rv == SUCCESS)351 return SUCCESS;352 */353 354 345 global_loghandler = g_log_set_handler(G_LOG_DOMAIN, G_LOG_LEVEL_MASK, midgard_error_default_log, NULL); 355 346 356 347 //g_log_set_always_fatal(G_LOG_LEVEL_CRITICAL); 357 //g_log_set_fatal_mask("GLib-GObject", G_LOG_LEVEL_CRITICAL); 348 //g_log_set_fatal_mask("GLib-GObject", G_LOG_LEVEL_CRITICAL); 358 349 359 350 /* Get DateTime class pointer and set global */ … … 386 377 ce_midgard_error_exception = zend_register_internal_class_ex(&ce, zend_exception_get_default(TSRMLS_C), NULL TSRMLS_CC); 387 378 379 // Init various classes 388 380 php_reflection_workaround_init(module_number); 389 381 php_midgard_reflection_property_init(module_number); … … 463 455 REGISTER_INI_ENTRIES(); 464 456 457 if (MGDG(superglobals_compat)) { 458 php_error(E_DEPRECATED, "midgard.superglobals_compat option is deprecated and might be removed in next release"); 459 460 zend_register_auto_global("_MIDGARD", sizeof("_MIDGARD")-1, NULL TSRMLS_CC); 461 zend_register_auto_global("_MIDCOM", sizeof("_MIDCOM")-1, NULL TSRMLS_CC); 462 zend_register_auto_global("_MIDGARD_CONNECTION", sizeof("_MIDGARD_CONNECTION")-1, NULL TSRMLS_CC); 463 } 464 465 465 /* midgard.http is on so we populate list of all available configs */ 466 466 if (php_midgard_is_http_env()) { … … 487 487 php_midgard_log_enabled = TRUE; 488 488 489 // php_error(E_NOTICE, "MODULE INIT - PID IS %d", getpid()); 489 if (MGDG(midgard_memory_debug)) { 490 php_printf("MINIT done (pid = %d)\n", getpid()); 491 } 490 492 491 493 return SUCCESS; … … 598 600 * It simply forces Zend to not unload midgard module */ 599 601 zend_module_entry *module; 600 int rv = zend_hash_find(&module_registry, "midgard2", strlen("midgard2")+1, (void**)&module);602 int rv = zend_hash_find(&module_registry, MIDGARD_PACKAGE_NAME, strlen(MIDGARD_PACKAGE_NAME) + 1, (void**)&module); 601 603 if (rv == SUCCESS) { 602 604 php_printf("---> disable module handle\n"); trunk/midgard/apis/php5/php_midgard.h
r23912 r23921 108 108 zend_bool midgard_http; 109 109 zend_bool midgard_memory_debug; 110 zend_bool superglobals_compat; 110 111 ZEND_END_MODULE_GLOBALS(midgard2) 111 112 trunk/midgard/apis/php5/php_midgard__helpers.h
r23879 r23921 13 13 /* These macros are available since 5.3, so we add them in 5.2 */ 14 14 #if PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION == 2 15 # define E_DEPRECATED E_NOTICE 15 16 # define Z_SET_ISREF_P(ptr) (ptr)->is_ref = 1 16 17 # define Z_REFCOUNT_P(ptr) (ptr)->refcount
