@@ -425,7 +425,7 @@ static void _php_ldap_control_to_array(LDAP *ld, LDAPControl* ctrl, zval* array,
425425static int php_ldap_control_from_array (LDAP * ld , LDAPControl * * ctrl , const HashTable * control_ht )
426426{
427427 zval * val ;
428- zend_string * control_oid ;
428+ zend_string * control_oid , * control_oid_tmp ;
429429 char * * ldap_attrs = NULL ;
430430 LDAPSortKey * * sort_keys = NULL ;
431431 zend_string * tmpstring = NULL , * * tmpstrings1 = NULL , * * tmpstrings2 = NULL ;
@@ -436,8 +436,8 @@ static int php_ldap_control_from_array(LDAP *ld, LDAPControl** ctrl, const HashT
436436 return -1 ;
437437 }
438438
439- control_oid = zval_get_string (val );
440- if (EG ( exception ) ) {
439+ control_oid = zval_try_get_tmp_string (val , & control_oid_tmp );
440+ if (! control_oid ) {
441441 return -1 ;
442442 }
443443
@@ -453,8 +453,8 @@ static int php_ldap_control_from_array(LDAP *ld, LDAPControl** ctrl, const HashT
453453
454454 if ((val = zend_hash_find (control_ht , ZSTR_KNOWN (ZEND_STR_VALUE ))) != NULL ) {
455455 if (Z_TYPE_P (val ) != IS_ARRAY ) {
456- tmpstring = zval_get_string (val );
457- if (EG ( exception ) ) {
456+ tmpstring = zval_try_get_string (val );
457+ if (! tmpstring ) {
458458 rc = -1 ;
459459 goto failure ;
460460 }
@@ -468,8 +468,8 @@ static int php_ldap_control_from_array(LDAP *ld, LDAPControl** ctrl, const HashT
468468 pagesize = zval_get_long (tmp );
469469 }
470470 if ((tmp = zend_hash_str_find (Z_ARRVAL_P (val ), "cookie" , sizeof ("cookie" ) - 1 )) != NULL ) {
471- tmpstring = zval_get_string (tmp );
472- if (EG ( exception ) ) {
471+ tmpstring = zval_try_get_string (tmp );
472+ if (! tmpstring ) {
473473 rc = -1 ;
474474 goto failure ;
475475 }
@@ -488,8 +488,8 @@ static int php_ldap_control_from_array(LDAP *ld, LDAPControl** ctrl, const HashT
488488 rc = -1 ;
489489 zend_value_error ("%s(): Control must have a \"filter\" key" , get_active_function_name ());
490490 } else {
491- zend_string * assert = zval_get_string (tmp );
492- if (EG ( exception ) ) {
491+ zend_string * assert = zval_try_get_string (tmp );
492+ if (! assert ) {
493493 rc = -1 ;
494494 goto failure ;
495495 }
@@ -516,8 +516,8 @@ static int php_ldap_control_from_array(LDAP *ld, LDAPControl** ctrl, const HashT
516516 rc = -1 ;
517517 php_error_docref (NULL , E_WARNING , "Failed to allocate control value" );
518518 } else {
519- tmpstring = zval_get_string (tmp );
520- if (EG ( exception ) ) {
519+ tmpstring = zval_try_get_string (tmp );
520+ if (! tmpstring ) {
521521 rc = -1 ;
522522 goto failure ;
523523 }
@@ -555,8 +555,8 @@ static int php_ldap_control_from_array(LDAP *ld, LDAPControl** ctrl, const HashT
555555 goto failure ;
556556 }
557557
558- tmpstrings1 [num_tmpstrings1 ] = zval_get_string (attr );
559- if (EG ( exception ) ) {
558+ tmpstrings1 [num_tmpstrings1 ] = zval_try_get_string (attr );
559+ if (! tmpstrings1 [ num_tmpstrings1 ] ) {
560560 rc = -1 ;
561561 goto failure ;
562562 }
@@ -603,17 +603,17 @@ static int php_ldap_control_from_array(LDAP *ld, LDAPControl** ctrl, const HashT
603603 goto failure ;
604604 }
605605 sort_keys [i ] = emalloc (sizeof (LDAPSortKey ));
606- tmpstrings1 [num_tmpstrings1 ] = zval_get_string (tmp );
607- if (EG ( exception ) ) {
606+ tmpstrings1 [num_tmpstrings1 ] = zval_try_get_string (tmp );
607+ if (! tmpstrings1 [ num_tmpstrings1 ] ) {
608608 rc = -1 ;
609609 goto failure ;
610610 }
611611 sort_keys [i ]-> attributeType = ZSTR_VAL (tmpstrings1 [num_tmpstrings1 ]);
612612 ++ num_tmpstrings1 ;
613613
614614 if ((tmp = zend_hash_str_find (Z_ARRVAL_P (sortkey ), "oid" , sizeof ("oid" ) - 1 )) != NULL ) {
615- tmpstrings2 [num_tmpstrings2 ] = zval_get_string (tmp );
616- if (EG ( exception ) ) {
615+ tmpstrings2 [num_tmpstrings2 ] = zval_try_get_string (tmp );
616+ if (! tmpstrings2 [ num_tmpstrings2 ] ) {
617617 rc = -1 ;
618618 goto failure ;
619619 }
@@ -659,8 +659,8 @@ static int php_ldap_control_from_array(LDAP *ld, LDAPControl** ctrl, const HashT
659659 }
660660
661661 if ((tmp = zend_hash_str_find (Z_ARRVAL_P (val ), "attrvalue" , sizeof ("attrvalue" ) - 1 )) != NULL ) {
662- tmpstring = zval_get_string (tmp );
663- if (EG ( exception ) ) {
662+ tmpstring = zval_try_get_string (tmp );
663+ if (! tmpstring ) {
664664 rc = -1 ;
665665 goto failure ;
666666 }
@@ -685,8 +685,8 @@ static int php_ldap_control_from_array(LDAP *ld, LDAPControl** ctrl, const HashT
685685 }
686686
687687 if ((tmp = zend_hash_str_find (Z_ARRVAL_P (val ), "context" , sizeof ("context" ) - 1 )) != NULL ) {
688- tmpstring = zval_get_string (tmp );
689- if (EG ( exception ) ) {
688+ tmpstring = zval_try_get_string (tmp );
689+ if (! tmpstring ) {
690690 rc = -1 ;
691691 goto failure ;
692692 }
@@ -714,7 +714,7 @@ static int php_ldap_control_from_array(LDAP *ld, LDAPControl** ctrl, const HashT
714714 }
715715
716716failure :
717- zend_string_release ( control_oid );
717+ zend_tmp_string_release ( control_oid_tmp );
718718 if (tmpstring != NULL ) {
719719 zend_string_release (tmpstring );
720720 }
@@ -2791,8 +2791,8 @@ PHP_FUNCTION(ldap_modify_batch)
27912791 zend_ulong value_index = 0 ;
27922792 zval * modification_value_zv = NULL ;
27932793 ZEND_HASH_FOREACH_VAL (Z_ARRVAL_P (modification_values ), modification_value_zv ) {
2794- zend_string * modval = zval_get_string (modification_value_zv );
2795- if (EG ( exception ) ) {
2794+ zend_string * modval = zval_try_get_string (modification_value_zv );
2795+ if (! modval ) {
27962796 RETVAL_FALSE ;
27972797 ldap_mods [modification_index ]-> mod_bvalues [value_index ] = NULL ;
27982798 num_mods = modification_index + 1 ;
0 commit comments