@@ -695,6 +695,7 @@ static char *TWIG_GET_CLASS_NAME(zval *object TSRMLS_DC)
695695
696696static int twig_add_method_to_class (void * pDest APPLY_TSRMLS_DC , int num_args , va_list args , zend_hash_key * hash_key )
697697{
698+ int from ;
698699 zval * retval ;
699700 char * method , * lMethod ;
700701 size_t method_len ;
@@ -715,11 +716,13 @@ static int twig_add_method_to_class(void *pDest APPLY_TSRMLS_DC, int num_args, v
715716 add_assoc_string (retval , TWIG_DECAMELIZE (method ), method , 1 );
716717
717718 if (method_len > 3 && 0 == strncmp ("get" , lMethod , 3 )) {
718- add_assoc_string (retval , estrndup (lMethod + 3 , method_len - 3 ), method , 1 );
719- add_assoc_string (retval , TWIG_DECAMELIZE (estrndup (method + 3 , method_len - 3 )), method , 1 );
719+ from = lMethod [3 ] == '_' ? 4 : 3 ;
720+ add_assoc_string (retval , estrndup (lMethod + from , method_len - from ), method , 1 );
721+ add_assoc_string (retval , TWIG_DECAMELIZE (estrndup (method + from , method_len - from )), method , 1 );
720722 } else if (method_len > 2 && 0 == strncmp ("is" , lMethod , 2 )) {
721- add_assoc_string (retval , estrndup (lMethod + 2 , method_len - 2 ), method , 1 );
722- add_assoc_string (retval , TWIG_DECAMELIZE (estrndup (method + 2 , method_len - 2 )), method , 1 );
723+ from = lMethod [2 ] == '_' ? 3 : 2 ;
724+ add_assoc_string (retval , estrndup (lMethod + from , method_len - from ), method , 1 );
725+ add_assoc_string (retval , TWIG_DECAMELIZE (estrndup (method + from , method_len - from )), method , 1 );
723726 }
724727
725728 return 0 ;
0 commit comments