File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -234,6 +234,26 @@ static void ldap_result_entry_free_obj(zend_object *obj)
234
234
} \
235
235
}
236
236
237
+ /* An LDAP value must be a string, however it defines a format for integer and
238
+ * booleans, thus we parse zvals to the corresponding string if possible
239
+ * See RFC 4517: https://datatracker.ietf.org/doc/html/rfc4517 */
240
+ static zend_string * php_ldap_try_get_ldap_value_from_zval (zval * zv ) {
241
+ switch (Z_TYPE_P (zv )) {
242
+ case IS_STRING :
243
+ case IS_LONG :
244
+ /* Object might be stringable */
245
+ case IS_OBJECT :
246
+ return zval_try_get_string (zv );
247
+ case IS_TRUE :
248
+ return ZSTR_INIT_LITERAL ("TRUE" , false);
249
+ case IS_FALSE :
250
+ return ZSTR_INIT_LITERAL ("FALSE" , false);
251
+ default :
252
+ zend_type_error ("LDAP value must be of type string|int|bool, %s given" , zend_zval_value_name (zv ));
253
+ return NULL ;
254
+ }
255
+ }
256
+
237
257
/* {{{ Parse controls from and to arrays */
238
258
static void _php_ldap_control_to_array (LDAP * ld , LDAPControl * ctrl , zval * array , int request )
239
259
{
You can’t perform that action at this time.
0 commit comments