PHP中json_encode()返回的神秘错误代码

时间:2019-12-19 14:48:39

标签: php json ldap

我目前正在尝试调试json_encode无法对我的LDAP服务器中的大型多层数组进行编码的情况。好吧,它可能并不大,但是它包含数字索引和非数字索引,部分深度约为3个级别,并且总体上可能包含约300个元素。

但是,我无法按照手册中的描述使json_last_error()正常工作: https://www.php.net/manual/de/function.json-last-error.php

我没有在那里列出任何错误代码,而只是隐晦的响应“ 5”。 我已经发现了另一个stackoverflow问题,有人在处理响应“ 4”,这是json_decode抛出错误的情况: PHP json_decode return error code 4

但是,我无法在Internet上找到任何将这些数字响应解析为任何其他有意义的错误代码或消息的来源,因此我无法解密我的代码xD

有人可以帮我吗?^^

编辑: 因此,我发现由于有了nigelRen和aynber,我们有了JSON_SYNTAX_ERROR。

我检查了一个在线编码器,以了解发生了什么。奇怪的事情: 数组可以被编码! 然后,我将JSON字符串输入到JSONLint中以对其进行验证,然后它起作用了! 我什至将其输入到在线解码器中,而且可以正常工作!

那么为什么它在我的程序中不起作用? 我在最新的XAMPP环境中使用了lumen(laravel 6.2)和最新的php(7.3.1ish)。

EDIT2: 这是匿名数据:

array (
  'count' => 1,
  0 => 
  array (
    'objectclass' => 
    array (
      'count' => 4,
      0 => 'top',
      1 => 'person',
      2 => 'organizationalPerson',
      3 => 'user',
    ),
    0 => 'objectclass',
    'cn' => 
    array (
      'count' => 1,
      0 => 'tester',
    ),
    1 => 'cn',
    'sn' => 
    array (
      'count' => 1,
      0 => 'testerr',
    ),
    2 => 'sn',
    'l' => 
    array (
      'count' => 1,
      0 => 'testerrr',
    ),
    3 => 'l',
    'title' => 
    array (
      'count' => 1,
      0 => 'testdata',
    ),
    4 => 'title',
    'description' => 
    array (
      'count' => 1,
      0 => 'hoho',
    ),
    5 => 'description',
    'postalcode' => 
    array (
      'count' => 1,
      0 => 'XXXXX',
    ),
    6 => 'postalcode',
    'physicaldeliveryofficename' => 
    array (
      'count' => 1,
      0 => 'korr',
    ),
    7 => 'physicaldeliveryofficename',
    'telephonenumber' => 
    array (
      'count' => 1,
      0 => 'numberex',
    ),
    8 => 'telephonenumber',
    'facsimiletelephonenumber' => 
    array (
      'count' => 1,
      0 => 'yarrr',
    ),
    9 => 'facsimiletelephonenumber',
    'givenname' => 
    array (
      'count' => 1,
      0 => 'test',
    ),
    10 => 'givenname',
    'initials' => 
    array (
      'count' => 1,
      0 => 'testtttt',
    ),
    11 => 'initials',
    'distinguishedname' => 
    array (
      'count' => 1,
      0 => 'CN=fr,OU=Benutzer,OU=ent,DC=entt,DC=us',
    ),
    12 => 'distinguishedname',
    'instancetype' => 
    array (
      'count' => 1,
      0 => '4',
    ),
    13 => 'instancetype',
    'whencreated' => 
    array (
      'count' => 1,
      0 => '20920828125555.0Z',
    ),
    14 => 'whencreated',
    'whenchanged' => 
    array (
      'count' => 1,
      0 => '20931216110629.0Z',
    ),
    15 => 'whenchanged',
    'displayname' => 
    array (
      'count' => 1,
      0 => 'tester test',
    ),
    16 => 'displayname',
    'usncreated' => 
    array (
      'count' => 1,
      0 => '29778728',
    ),
    17 => 'usncreated',
    'info' => 
    array (
      'count' => 1,
      0 => 'testererer',
    ),
    18 => 'info',
    'memberof' => 
    array (
      'count' => 12,
      0 => 'CN=döjfsdkmf,OU=Gruppen,OU=testent,DC=testent,DC=asdsad',
      1 => 'CN=ösmfsmfosmf,OU=Variabel,OU=Verteiler,OU=testent,DC=testent,DC=asdsad',
      2 => 'CN=sdkfnsfm (Standort),OU=Orga,OU=Verteiler,OU=testent,DC=testent,DC=asdsad',
      3 => 'CN=skfdjnsdkfm,OU=sdfsdfsdf,OU=OEs,OU=Gruppen,OU=testent,DC=testent,DC=asdsad',
      4 => 'CN=sdfsdofmsdf,CN=Users,DC=testent,DC=asdsad',
      5 => 'CN=sdfjknsfkmsdf,OU=Alte_Gruppen,OU=Gruppen,OU=testent,DC=testent,DC=asdsad',
      6 => 'CN=sfsdfsdfsdf,CN=Users,DC=testent,DC=asdsad',
      7 => 'CN=sdfsdfsdfsdfsdf,OU=Alte_Gruppen,OU=Gruppen,OU=testent,DC=testent,DC=asdsad',
      8 => 'CN=sdfsdfsdfsdf,CN=Users,DC=testent,DC=asdsad',
      9 => 'CN=weöfjsiofdjshfdjhsfd,CN=Users,DC=testent,DC=asdsad',
      10 => 'CN=sfnsifnsf,OU=Alte_Gruppen,OU=Gruppen,OU=testent,DC=testent,DC=asdsad',
      11 => 'CN=skfunsifnsifnsf,CN=Users,DC=testent,DC=asdsad',
    ),
    19 => 'memberof',
    'usnchanged' => 
    array (
      'count' => 1,
      0 => '54730333',
    ),
    20 => 'usnchanged',
    'company' => 
    array (
      'count' => 1,
      0 => 'testent AG',
    ),
    21 => 'company',
    'proxyaddresses' => 
    array (
      'count' => 4,
      0 => 'smtp:testent2@irene.testent.asdsad',
      1 => 'SMTP:testent23.41wdsadsad@testent.asdsad',
      2 => 'smtp:testent2@testent.asdsad',
      3 => 'smtp:testent2@iris.testent.asdsad',
    ),
    22 => 'proxyaddresses',
    'streetaddress' => 
    array (
      'count' => 1,
      0 => 'Kleinseebacher Str. 9',
    ),
    23 => 'streetaddress',
    'displaynameprintable' => 
    array (
      'count' => 1,
      0 => 'testent23 41wdsadsad',
    ),
    24 => 'displaynameprintable',
    'name' => 
    array (
      'count' => 1,
      0 => 'testent2',
    ),
    25 => 'name',
    'objectguid' => 
    array (
      'count' => 1,
      0 => '��tk���G�A�4�=�\\',
    ),
    26 => 'objectguid',
    'useraccountcontrol' => 
    array (
      'count' => 1,
      0 => '66048',
    ),
    27 => 'useraccountcontrol',
    'badpwdcount' => 
    array (
      'count' => 1,
      0 => '0',
    ),
    28 => 'badpwdcount',
    'codepage' => 
    array (
      'count' => 1,
      0 => '0',
    ),
    29 => 'codepage',
    'countrycode' => 
    array (
      'count' => 1,
      0 => '0',
    ),
    30 => 'countrycode',
    'badpasswordtime' => 
    array (
      'count' => 1,
      0 => '132212342228691135',
    ),
    31 => 'badpasswordtime',
    'lastlogoff' => 
    array (
      'count' => 1,
      0 => '0',
    ),
    32 => 'lastlogoff',
    'lastlogon' => 
    array (
      'count' => 1,
      0 => '132212399056122426',
    ),
    33 => 'lastlogon',
    'pwdlastset' => 
    array (
      'count' => 1,
      0 => '131921875059860861',
    ),
    34 => 'pwdlastset',
    'primarygroupid' => 
    array (
      'count' => 1,
      0 => 'sdgght2',
    ),
    35 => 'primarygroupid',
    'profilepath' => 
    array (
      'count' => 1,
      0 => '\\\\sdfsdfsdf\\users\\testent2\\_win_profil',
    ),
    36 => 'profilepath',
    'objectsid' => 
    array (
      'count' => 1,
      0 => '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '�s� ��w�o� "' . "\0" . '' . "\0" . '',
    ),
    37 => 'objectsid',
    'accountexpires' => 
    array (
      'count' => 1,
      0 => '9223372036854775807',
    ),
    38 => 'accountexpires',
    'logoncount' => 
    array (
      'count' => 1,
      0 => '4515',
    ),
    39 => 'logoncount',
    'samaccountname' => 
    array (
      'count' => 1,
      0 => 'testent2',
    ),
    40 => 'samaccountname',
    'samaccounttype' => 
    array (
      'count' => 1,
      0 => '805306368',
    ),
    41 => 'samaccounttype',
    'showinaddressbook' => 
    array (
      'count' => 5,
      0 => 'CN=Mailboxes(VLV),CN=dfgfdgfdg,CN=Address Lists Container,CN=testent,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=testent,DC=asdsad',
      1 => 'CN=All Mailboxes(VLV),CN=dfgfdgfdg,CN=Address Lists Container,CN=testent,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=testent,DC=asdsad',
      2 => 'CN=All Recipients(VLV),CN=dfgfdgfdg,CN=Address Lists Container,CN=testent,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=testent,DC=asdsad',
      3 => 'CN=Alle Benutzer,CN=dfgfdgfdg,CN=Address Lists Container,CN=testent,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=testent,DC=asdsad',
      4 => 'CN=Globale Standardadressliste,CN=All Global Address Lists,CN=Address Lists Container,CN=testent,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=testent,DC=asdsad',
    ),
    42 => 'showinaddressbook',
    'managedobjects' => 
    array (
      'count' => 1,
      0 => 'CN=JUVENTAS,CN=Computers,DC=testent,DC=asdsad',
    ),
    43 => 'managedobjects',
    'legacyexchangedn' => 
    array (
      'count' => 1,
      0 => '/o=testent/ou=Exchange Administrative Group (sfsdfsdf)/cn=Recipients/cn=testent23 41wdsadsad071',
    ),
    44 => 'legacyexchangedn',
    'userprincipalname' => 
    array (
      'count' => 1,
      0 => 'testent2@testent.asdsad',
    ),
    45 => 'userprincipalname',
    'lockouttime' => 
    array (
      'count' => 1,
      0 => '0',
    ),
    46 => 'lockouttime',
    'objectcategory' => 
    array (
      'count' => 1,
      0 => 'CN=Person,CN=Schema,CN=Configuration,DC=testent,DC=asdsad',
    ),
    47 => 'objectcategory',
    'dscorepropagationdata' => 
    array (
      'count' => 5,
      0 => '20901211120329.0Z',
      1 => '20901211120329.0Z',
      2 => '20901211120329.0Z',
      3 => '20901211120329.0Z',
      4 => '20901211120329.0Z',
    ),
    48 => 'dscorepropagationdata',
    'ms-ds-consistencyguid' => 
    array (
      'count' => 1,
      0 => '��tk���G�A�4�=�\\',
    ),
    49 => 'ms-ds-consistencyguid',
    'lastlogontimestamp' => 
    array (
      'count' => 1,
      0 => '132209679579424599',
    ),
    50 => 'lastlogontimestamp',
    'mail' => 
    array (
      'count' => 1,
      0 => 'testent23.41wdsadsad@testent.asdsad',
    ),
    51 => 'mail',
    'msexchmailboxtemplatelink' => 
    array (
      'count' => 1,
      0 => 'CN=testentRetentionPolicy,CN=Retention Policies Container,CN=testent,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=testent,DC=asdsad',
    ),
    52 => 'msexchmailboxtemplatelink',
    'msexchumdtmfmap' => 
    array (
      'count' => 5,
      0 => 'reversedPhone:sdfsdfsf',
      1 => 'reversedPhone:sdaqwdqdq',
      2 => 'emailAddress:asdsadwqdw',
      3 => 'lastNameFirstName:asdasdsad',
      4 => 'firstNameLastName:sadsadsad',
    ),
    53 => 'msexchumdtmfmap',
    'msexchblockedsendershash' => 
    array (
      'count' => 1,
      0 => 'W�G�x.�',
    ),
    54 => 'msexchblockedsendershash',
    'msexchmailboxsecuritydescriptor' => 
    array (
      'count' => 1,
      0 => '' . "\0" . '�' . "\0" . '' . "\0" . '' . "\0" . ' ' . "\0" . '' . "\0" . '' . "\0" . ',' . "\0" . '' . "\0" . '' . "\0" . '\\' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '
' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '
' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '0' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '�' . "\0" . '' . "\0" . '
' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '�' . "\0" . 'k
' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '' . "\0" . '
' . "\0" . '' . "\0" . '' . "\0" . '',
    ),
    55 => 'msexchmailboxsecuritydescriptor',
    'mdbusedefaults' => 
    array (
      'count' => 1,
      0 => 'TRUE',
    ),
    56 => 'mdbusedefaults',
    'msexchpoliciesexcluded' => 
    array (
      'count' => 1,
      0 => '{har-har}',
    ),
    57 => 'msexchpoliciesexcluded',
    'mailnickname' => 
    array (
      'count' => 1,
      0 => 'testent2',
    ),
    58 => 'mailnickname',
    'msexchshadowmailnickname' => 
    array (
      'count' => 1,
      0 => 'testent2',
    ),
    59 => 'msexchshadowmailnickname',
    'msexchversion' => 
    array (
      'count' => 1,
      0 => 'sdad',
    ),
    60 => 'msexchversion',
    'msexchuserculture' => 
    array (
      'count' => 1,
      0 => 'us-US',
    ),
    61 => 'msexchuserculture',
    'msexchthrottlingpolicydn' => 
    array (
      'count' => 1,
      0 => 'CN=fgdgg,CN=Global Settings,CN=testent,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=testent,DC=us',
    ),
    62 => 'msexchthrottlingpolicydn',
    'msexchmailboxguid' => 
    array (
      'count' => 1,
      0 => '���e��[F��N��@',
    ),
    63 => 'msexchmailboxguid',
    'msexchrecipienttypedetails' => 
    array (
      'count' => 1,
      0 => '1',
    ),
    64 => 'msexchrecipienttypedetails',
    'msexchuseraccountcontrol' => 
    array (
      'count' => 1,
      0 => '0',
    ),
    65 => 'msexchuseraccountcontrol',
    'homemdb' => 
    array (
      'count' => 1,
      0 => 'CN=Mailbox-DB_testent-A,CN=Databases,CN=sdfsdfsdf (dgdfgfdgdfg),CN=Administrative Groups,CN=testent,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=testent,DC=us',
    ),
    66 => 'homemdb',
    'msexchhomeservername' => 
    array (
      'count' => 1,
      0 => '/o=testent/ou=fsfdf sfdsdfsdf sdfsfd (sadadwd)/cn=Configuration/cn=Servers/cn=KIREI',
    ),
    67 => 'msexchhomeservername',
    'msexchaddressbookpolicylink' => 
    array (
      'count' => 1,
      0 => 'CN=testentAddressBookPolicy-2016,CN=AddressBook Mailbox Policies,CN=testent,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=testent,DC=us',
    ),
    68 => 'msexchaddressbookpolicylink',
    'msexchtextmessagingstate' => 
    array (
      'count' => 2,
      0 => 'asdsadsad',
      1 => 'sadsadadw',
    ),
    69 => 'msexchtextmessagingstate',
    'msexchsafesendershash' => 
    array (
      'count' => 1,
      0 => '�01
~' . "\0" . ';:�FhR��t�{�E����{�7��"pA�\\���v�X�ޕa�d    ��',
    ),
    70 => 'msexchsafesendershash',
    'msexchmailboxmovesourceuserbl' => 
    array (
      'count' => 1,
      0 => 'CN=bc27209faf284aac937204a02ccee4b0testent2-testent2_20191215214915,CN=MailboxExportRequests,CN=Mailbox Replication,CN=testent,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=testent,DC=asdsad',
    ),
    71 => 'msexchmailboxmovesourceuserbl',
    'msexchshadowproxyaddresses' => 
    array (
      'count' => 3,
      0 => 'SMTP:testent23.41wdsadsad@testent.asdsad',
      1 => 'smtp:testent2@testent.asdsad',
      2 => 'smtp:testent2@sdwdqd.testent.asdsad',
    ),
    72 => 'msexchshadowproxyaddresses',
    'msexchelcmailboxflags' => 
    array (
      'count' => 1,
      0 => '2',
    ),
    73 => 'msexchelcmailboxflags',
    'msexchrbacpolicylink' => 
    array (
      'count' => 1,
      0 => 'CN=Default Role Assignment Policy,CN=Policies,CN=RBAC,CN=testent,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=testent,DC=us',
    ),
    74 => 'msexchrbacpolicylink',
    'msexchwhenmailboxcreated' => 
    array (
      'count' => 1,
      0 => '20980829074612.0Z',
    ),
    75 => 'msexchwhenmailboxcreated',
    'msexchrecipientdisplaytype' => 
    array (
      'count' => 1,
      0 => 'sadsadad',
    ),
    76 => 'msexchrecipientdisplaytype',
    'count' => 77,
    'dn' => 'CN=testent2,OU=Benutzer,OU=testent,DC=testent,DC=us',
  ),
)  

0 个答案:

没有答案