Skip to content

Commit 6d95449

Browse files
committed
fix #27
1 parent bc7df60 commit 6d95449

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

phpdbg_bp.c

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ PHPDBG_API void phpdbg_set_breakpoint_method(const char* class_name, const char*
203203
HashTable class_breaks, *class_table;
204204
size_t class_len = strlen(class_name);
205205
size_t func_len = strlen(func_name);
206+
char *lcname = zend_str_tolower_dup(func_name, func_len);
206207

207208
if (zend_hash_find(&PHPDBG_G(bp)[PHPDBG_BREAK_METHOD], class_name,
208209
class_len, (void**)&class_table) != SUCCESS) {
@@ -224,14 +225,16 @@ PHPDBG_API void phpdbg_set_breakpoint_method(const char* class_name, const char*
224225
new_break.func_len = func_len;
225226
new_break.id = PHPDBG_G(bp_count)++;
226227

227-
zend_hash_update(class_table, func_name, func_len,
228+
zend_hash_update(class_table, lcname, func_len,
228229
&new_break, sizeof(phpdbg_breakmethod_t), NULL);
229230

230231
phpdbg_notice("Breakpoint #%d added at %s::%s",
231232
new_break.id, class_name, func_name);
232233
} else {
233234
phpdbg_notice("Breakpoint exists at %s::%s", class_name, func_name);
234235
}
236+
237+
efree(lcname);
235238
} /* }}} */
236239

237240
PHPDBG_API void phpdbg_set_breakpoint_opline(zend_ulong opline TSRMLS_DC) /* {{{ */
@@ -408,27 +411,29 @@ int phpdbg_find_breakpoint_symbol(zend_function *fbc TSRMLS_DC) /* {{{ */
408411
return FAILURE;
409412
} /* }}} */
410413

411-
/*
412-
* @TODO(anyone) this is case sensitive
413-
*/
414414
int phpdbg_find_breakpoint_method(zend_op_array *ops TSRMLS_DC) /* {{{ */
415415
{
416416
HashTable *class_table;
417417
phpdbg_breakmethod_t *bp;
418418

419419
if (zend_hash_find(&PHPDBG_G(bp)[PHPDBG_BREAK_METHOD], ops->scope->name,
420420
ops->scope->name_length, (void**)&class_table) == SUCCESS) {
421+
char *lcname = zend_str_tolower_dup(ops->function_name, strlen(ops->function_name));
422+
size_t lcname_len = strlen(lcname);
423+
421424
if (zend_hash_find(
422425
class_table,
423-
ops->function_name,
424-
strlen(ops->function_name), (void**)&bp) == SUCCESS) {
425-
426+
lcname,
427+
lcname_len, (void**)&bp) == SUCCESS) {
428+
efree(lcname);
426429
phpdbg_notice("Breakpoint #%d in %s::%s() at %s:%u",
427430
bp->id, bp->class_name, bp->func_name,
428431
zend_get_executed_filename(TSRMLS_C),
429432
zend_get_executed_lineno(TSRMLS_C));
430433
return SUCCESS;
431434
}
435+
436+
efree(lcname);
432437
}
433438

434439
return FAILURE;

0 commit comments

Comments
 (0)