On a UCS system there are actually two LDAP servers running: one on port 7389 with the OpenLDAP schema and one on the default LDAP port 389 with the ActiveDirectory schema (provided by Samba). There’s a component called the univention-s4connector which synchronizes entries bidirectionally between the two instances. However, not all objects and attributes are present in both.
The command univention-ldapsearch automatically uses the one on port 7389. You likely used the default settings when connecting from PHP, and therefore ended up on the ActiveDirectory one. Therefore the results are different. The univentionFreeAttribute* attributes are ones that aren’t synchronized between the two instances; they’re only present in the OpenLDAP server on port 7389.
I’ve written more about this in this article if you want more information about it (in German only).