Skip to content

Is escaping advisable when setting a value for an attribute? #686

Closed Answered by stevebauman
andsal asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @andsal,

It's not possible to escape LDAP attributes in LdapRecord. LdapRecord uses PHP's standard ldap_* methods when performing creates and updates. Attributes will always be sent in a structured format as strings to your LDAP server. Ex:

$changes = [
    [
        "attrib"  => "telephoneNumber",
        "modtype" => LDAP_MODIFY_BATCH_ADD,
        "values"  => ["+1 555 555 1717"], // Value cannot be escaped, its passed as its true PHP value.
    ],
];

ldap_modify_batch($connection, $dn, $modifs);

This is different for LDAP search filters. Input supplied in LDAP search filters must always be escaped, as search filters are constructed similarly to SQL queries, in the sense that the s…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by andsal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants