| | 1281 | |
|---|
| | 1282 | zend_hash_init_ex(&tmp_function_table, 100, NULL, ZEND_FUNCTION_DTOR, 1, 0); |
|---|
| | 1283 | zend_hash_copy(&tmp_function_table, &eaccelerator_global_function_table, NULL, &tmp_func, sizeof(zend_function)); |
|---|
| | 1284 | orig_function_table = CG(function_table); |
|---|
| | 1285 | CG(function_table) = &tmp_function_table; |
|---|
| | 1286 | |
|---|
| | 1287 | zend_hash_init_ex(&tmp_class_table, 10, NULL, ZEND_CLASS_DTOR, 1, 0); |
|---|
| | 1288 | zend_hash_copy(&tmp_class_table, &eaccelerator_global_class_table, NULL, &tmp_class, sizeof(zend_class_entry)); |
|---|
| | 1289 | |
|---|
| | 1290 | orig_class_table = CG(class_table);; |
|---|
| | 1291 | CG(class_table) = &tmp_class_table; |
|---|
| | 1292 | #ifdef ZEND_ENGINE_2 |
|---|
| | 1293 | orig_eg_class_table = EG(class_table);; |
|---|
| | 1294 | EG(class_table) = &tmp_class_table; |
|---|
| | 1295 | #endif |
|---|
| | 1296 | |
|---|
| | 1348 | CG(function_table) = orig_function_table; |
|---|
| | 1349 | CG(class_table) = orig_class_table; |
|---|
| | 1350 | #ifdef ZEND_ENGINE_2 |
|---|
| | 1351 | EG(class_table) = orig_eg_class_table; |
|---|
| | 1352 | DBG(ea_debug_printf, (EA_DEBUG, "\t[%d] restoring CG(class_table)[%08x] != EG(class_table)[%08x]\n", |
|---|
| | 1353 | getpid(), CG(class_table), EG(class_table))); |
|---|
| | 1354 | #endif |
|---|
| | 1355 | while (function_table_tail != NULL) { |
|---|
| | 1356 | zend_op_array *op_array = (zend_op_array*)function_table_tail->pData; |
|---|
| | 1357 | if (op_array->type == ZEND_USER_FUNCTION) { |
|---|
| | 1358 | if (zend_hash_add(CG(function_table), function_table_tail->arKey, function_table_tail->nKeyLength, op_array, |
|---|
| | 1359 | sizeof(zend_op_array), NULL) == FAILURE && function_table_tail->arKey[0] != '\000') { |
|---|
| | 1360 | CG(in_compilation) = 1; |
|---|
| | 1361 | CG(compiled_filename) = file_handle->opened_path; |
|---|
| | 1362 | #ifdef ZEND_ENGINE_2 |
|---|
| | 1363 | CG(zend_lineno) = op_array->line_start; |
|---|
| | 1364 | #else |
|---|
| | 1365 | CG(zend_lineno) = op_array->opcodes[0].lineno; |
|---|
| | 1366 | #endif |
|---|
| | 1367 | zend_error(E_ERROR, "Cannot redeclare %s()", function_table_tail->arKey); |
|---|
| | 1368 | } |
|---|
| | 1369 | } |
|---|
| | 1370 | function_table_tail = function_table_tail->pListNext; |
|---|
| | 1371 | } |
|---|
| | 1372 | while (class_table_tail != NULL) { |
|---|
| | 1373 | #ifdef ZEND_ENGINE_2 |
|---|
| | 1374 | zend_class_entry **ce = (zend_class_entry**)class_table_tail->pData; |
|---|
| | 1375 | if ((*ce)->type == ZEND_USER_CLASS) { |
|---|
| | 1376 | if (zend_hash_add(CG(class_table), class_table_tail->arKey, class_table_tail->nKeyLength, |
|---|
| | 1377 | ce, sizeof(zend_class_entry*), NULL) == FAILURE && class_table_tail->arKey[0] != '\000') { |
|---|
| | 1378 | CG(in_compilation) = 1; |
|---|
| | 1379 | CG(compiled_filename) = file_handle->opened_path; |
|---|
| | 1380 | CG(zend_lineno) = (*ce)->line_start; |
|---|
| | 1381 | #else |
|---|
| | 1382 | zend_class_entry *ce = (zend_class_entry*)class_table_tail->pData; |
|---|
| | 1383 | if (ce->type == ZEND_USER_CLASS) { |
|---|
| | 1384 | if (ce->parent != NULL) { |
|---|
| | 1385 | if (zend_hash_find(CG(class_table), (void*)ce->parent->name, ce->parent->name_length+1, (void **)&ce->parent) != SUCCESS) { |
|---|
| | 1386 | ce->parent = NULL; |
|---|
| | 1387 | } |
|---|
| | 1388 | } |
|---|
| | 1389 | if (zend_hash_add(CG(class_table), class_table_tail->arKey, class_table_tail->nKeyLength, ce, |
|---|
| | 1390 | sizeof(zend_class_entry), NULL) == FAILURE && class_table_tail->arKey[0] != '\000') { |
|---|
| | 1391 | CG(in_compilation) = 1; |
|---|
| | 1392 | CG(compiled_filename) = file_handle->opened_path; |
|---|
| | 1393 | CG(zend_lineno) = 0; |
|---|
| | 1394 | #endif |
|---|
| | 1395 | zend_error(E_ERROR, "Cannot redeclare class %s", class_table_tail->arKey); |
|---|
| | 1396 | } |
|---|
| | 1397 | } |
|---|
| | 1398 | class_table_tail = class_table_tail->pListNext; |
|---|
| | 1399 | } |
|---|
| | 1400 | tmp_function_table.pDestructor = NULL; |
|---|
| | 1401 | tmp_class_table.pDestructor = NULL; |
|---|
| | 1402 | zend_hash_destroy(&tmp_function_table); |
|---|
| | 1403 | zend_hash_destroy(&tmp_class_table); |
|---|