Problem using Orphans plugin

Summary

The Orphans plugin is hanging up. This is on a site with 2,350 resources.

Observed behavior

After I click the Search for Orphans button, I get the endlessly spinning wheel. Javascript console show this error:

VM677:1 Uncaught SyntaxError: Unexpected token ‘%’
at doDecode (ext-all.js:21:53110)
at Object.decode (ext-all.js:21:54709)
at Orphans.grid.Snippets.onStoreException (modx.grid.js:128:21)
at h.Event.fire (ext-all.js:21:3699)
at constructor.fireEvent (ext-all.js:21:687)
at constructor. (ext-all.js:21:76523)
at h.Event.fire (ext-all.js:21:3699)
at Ext.data.HttpProxy.fireEvent (ext-all.js:21:687)
at Ext.data.HttpProxy.onRead (ext-all.js:21:335890)
at Ext.data.HttpProxy. (ext-all.js:21:335737)

There are no errors in the log.

Environment

MODX 2.8.8, Orphans 1.2.4, PHP 7.4.33 (but tried PHP 8.3 with no change)

These generic Ext.js error messages are usually not very helpful. Often it just means that an AJAX-request returned an unexpected result (e.g. an error message instead of some JSON).

Can you maybe change to the “Network” tab in the developer tools and check if a new request is created when you click the “Search for Orphans” button and what the actual result of this request is?

Yes, request for connector.php is generated (status 200).

Request URL:
/assets/components/orphans/connector.php
Request Method:
POST
Status Code:
200 OK
Remote Address:
[2606:4700:3108::ac42:2bb7]:443
Referrer Policy:
strict-origin-when-cross-origin
cache-control:
public
cf-cache-status:
DYNAMIC
cf-ray:
91e601ef38795e7a-EWR
content-disposition:
inline
content-length:
4743911
content-type:
application/pdf
date:
Mon, 10 Mar 2025 21:46:57 GMT
expires:
Thu, 19 Nov 1981 08:52:00 GMT
mc:
jN1vZ7L/YO1beXvqWrj8e/3WmyO8EpumV6AwFe0J8xo31fRMDlbfy41RusBViL6p
nel:
{“success_fraction”:0,“report_to”:“cf-nel”,“max_age”:604800}
pragma:
no-cache
report-to:
{“endpoints”:[{“url”:“https://a.nel.cloudflare.com/report/v4?s=g7A7tbuAqup04epRMQbD6hao4UO1yFVd4vJVHumRruWIyMMHng1S%2FwJYldDxhMpXzCNHz6BbvDL1jYjQAcOwK3V39jhaLW3FltBG1Wx4bOCdRMhnnjc3Gra5EersL0rvXupYh3ka4rso0jY3Cp24eyki”}],“group”:“cf-nel”,“max_age”:604800}
server:
cloudflare
server-timing:
cfL4;desc=“?proto=TCP&rtt=16238&min_rtt=12264&rtt_var=3101&sent=3831&recv=224&lost=0&retrans=62&sent_bytes=4937920&recv_bytes=10513&delivery_rate=14263533&cwnd=424&unsent_bytes=0&cid=9b79b6e1aafc0b3c&ts=155947&x=0”
set-cookie:
PHPSESSID=f4cnikls7aqk7gf3un2u07kt7o; path=/; HttpOnly
vary:
User-Agent
:authority:
[[website]]
:method:
POST
:path:
/assets/components/orphans/connector.php
:scheme:
https
accept:
/
accept-encoding:
gzip, deflate, br, zstd
accept-language:
en,fr;q=0.9
content-length:
130
content-type:
application/x-www-form-urlencoded; charset=UTF-8
cookie:
__hs_opt_out=no; _fbp=fb.1.1741376045199.115890032674674141; __adroll_fpc=851cc75fd628b1503ab9d239008b4902-1741376045619; __hstc=235828702.12f56cd194ac3808dc15f02beb538d99.1741376046305.1741376046305.1741376046305.1; hubspotutk=12f56cd194ac3808dc15f02beb538d99; _ga=GA1.2.386145928.1741376045; __ar_v4=Q67TCHXSHZDXDMTRYGUTY4%3A20250306%3A3%7CZZINS7NKLREYBAHA3P47LF%3A20250306%3A3; _ga_K59FZBNLD4=GS1.1.1741376045.1.1.1741376199.50.0.0; PHPSESSID=f4cnikls7aqk7gf3un2u07kt7o
modauth:
modx6792c65e3a5452.89282530_2067cf1d6b896283.82895124
origin:
https://[website].com
priority:
u=1, i
referer:
/manager/?a=index&namespace=orphans
sec-ch-ua:
“Not A(Brand”;v=“8”, “Chromium”;v=“132”
sec-ch-ua-mobile:
?0
sec-ch-ua-platform:
“macOS”
sec-fetch-dest:
empty
sec-fetch-mode:
cors
sec-fetch-site:
same-origin
user-agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36
x-requested-with:
XMLHttpRequest

So you copied the content of the “Headers” tab.
What’s in the “Response” tab?

It’s weird. It looks like a PDF file is returned. It starts with this:

%PDF-1.7
%����
1976 0 obj
<</Linearized 1/L 4743911/O 1979/E 401078/N 28/T 4704274/H [ 516 1258]>>
endobj

xref
1976 11
0000000016 00000 n
0000001774 00000 n
0000001924 00000 n
0000001962 00000 n
0000002955 00000 n
0000002994 00000 n
0000003180 00000 n
0000003295 00000 n
0000005945 00000 n
0000009805 00000 n
0000000516 00000 n
trailer
<</Size 1987/Root 1977 0 R/Info 1975 0 R/ID[<474730F4425942E7AA6BCF11E2AD396B><82530F4DA4A246D7BE37E251506BD5E9>]/Prev 4704261>>
startxref
0
%%EOF

1986 0 obj
<</E 1471/Filter/FlateDecode/I 1487/Length 1151/O 1455/S 1191/T 1371>>stream


On a different site where this is working, JSON is returned, and there is also “/connectors/index.php” loaded in addition to “assets/components/orphans/connector.php”.

Yes, this is weird.
I can’t reproduce any problems when I test it locally (using the same versions of MODX and Orphans).

Do you have any extras installed on this site that create PDFs? Maybe something is interfering?

No, nothing that creates PDFs. But the site does have a few static file resources that load PDFs. I can’t see the file name of the PDF anywhere in the PDF code.

If you save the return of the request in a file, can you then open it as a PDF?
If so, what is the content?

Actually, there is only one PDF static resource in here. There are other pages that load PDFs, but using a script I created instead of the MODX static resource feature. When I change that one static resource to HTML output instead of PDF, then the plugin runs properly! I’ll file a bug report for the plugin.