Technical Bug Report
ScriptCase 10.1.002 — Theme selector (multicombo) breaks on projects migrated from v9
JSON.parse receives HTML (“Unexpected token ‘<’”) due to Undefined array key “css_text_decoration”
Reported by: Cesar
Date: September 18, 2026
Component: Development IDE — Project Properties / Themes (Advanced Mode)
Severity: High — IDE functionality blocked (project themes cannot be managed)
Reproducibility: 100% (consistent) on projects migrated from SC 9.13
1. Executive summary
On projects migrated from ScriptCase 9.13 to 10.1.002, the project theme selector (multicombo) becomes unusable: when opened, the list appears empty with a permanent spinner. The cause is an AJAX response that returns HTTP 200 but with an HTML body instead of JSON, because the server emits Undefined array key "css_text_decoration" errors in the nmPageAppSchemaAdvanced.class.php class. ScriptCase’s own error handler injects <script>window.open('errorhandler.php')</script> blocks into the response, and the client runs JSON.parse() without any guard, throwing SyntaxError: Unexpected token '<'.
The error is consistent (12 occurrences per load) and independent of the theme content: re-saving a theme in the advanced editor does not change the result, which indicates it is a key read without a default value in the class code, not corrupt theme data.
2. Environment
|
|
| Product |
ScriptCase 10.1.002 (build v10.01.0002) |
| Web server |
Apache (components\apache) |
| PHP |
PHP 8.2 (components\php) |
| Operating system |
Windows |
| Installation |
C:\Program Files\NetMake\v10.1 |
| Relevant php.ini |
display_errors=Off · log_errors=On · error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
|
| Project origin |
Migrated from ScriptCase 9.13 to 10.1.002 |
| Sample project |
Acopio360 (legacy themes Sc9_SoftCloud, Sc9_SoftCloud_sm, Sc9_SoftCloud_sm_xxxxxx; default sys__NM__scriptcase) |
3. Observed symptom
In the IDE, when opening Project → Properties → THEMES tab (or Design → Themes → Advanced Mode) and expanding the “Project Themes” combo:
- The theme list appears empty (only the search box).
- The loading spinner (
.sc-theme-multicombo-loading) spins indefinitely.
- The browser console shows the following error:
Uncaught SyntaxError: Unexpected token '<', "<script> w"... is not valid JSON
at JSON.parse (<anonymous>)
at Object.success (_sc_cache_sc_theme_multicombo_10.1.002.js?v=10.01.0002:489:40)
at c (jquery.js:2:28447)
at Object.fireWith [as resolveWith] (jquery.js:2:29192)
at l (jquery.js:2:80176)
at XMLHttpRequest.<anonymous> (jquery.js:2:82630)
4. Steps to reproduce
- Migrate a project from ScriptCase 9.13 to 10.1.002 (which carries over
Sc9_* themes).
- Open the project in the development IDE.
- Menu → Project → Properties → THEMES tab.
- Click the “Project Themes” combo.
-
Result: the list stays empty + infinite spinner; the console shows the
SyntaxError.
5. Root cause analysis
5.1 Failure point on the client
The multicombo (generated file _sc_cache_sc_theme_multicombo_10.1.002.js), in the loadAjaxThemes function, processes the theme catalog response as follows (success callback, line 489):
javascript
success: function (retorno) {
var arr_schemas = JSON.parse(retorno); // <-- throws SyntaxError
mergeThemeCatalog(arr_schemas);
},
There is no try/catch: any response that is not strict JSON breaks the load and leaves the combo empty with the spinner active.
5.2 The server response is not JSON
The endpoint POST /scriptcase/devel/iface/app_schema_advanced.php (the multicombo’s config.ajaxUrl) responds HTTP 200, but the body is HTML. Literal content captured from the response (summarized):
html
<script> window.open('/scriptcase/devel/iface/errorhandler.php', 'ERROR', ...); </script>
... (the <script> block repeats 12 times) ...
OK<img src="/scriptcase/devel/conf/scriptcase/img/" .../>
... (6 <img> with empty src) ...
The 12 <script> blocks correspond to 12 errors captured by ScriptCase’s error handler (errorhandler.php). Because this HTML is prepended, JSON.parse fails on the very first '<' character.
5.3 Actual error logged by ScriptCase
The file generated by the handler (wwwroot/scriptcase/tmp/error_<hash>.html) contains the underlying error:
ERROR
Undefined array key "css_text_decoration"
Script: C:\Program Files\NetMake\v10.1\wwwroot\scriptcase\devel\class\page\
nmPageAppSchemaAdvanced.class.php linha: 0
In PHP 8, accessing a nonexistent array key is an E_WARNING (“Undefined array key”). The nmPageAppSchemaAdvanced.class.php class reads the css_text_decoration key without checking for its existence or providing a default value. This project’s themes (a legacy set from v9) do not contain that key, so the warning fires repeatedly (12 times, once per style context processed).
5.4 Why this is a code bug and not corrupt data
- The result is identical and consistent: always 12
<script> blocks + 6 <img>, on every load.
- Re-saving a project theme in the Advanced CSS Editor (Advanced Mode → Save) did not change the error count. If it depended on theme data, the count would vary.
- The GET endpoint for a single native theme (
app_schema_advanced.php?str_modo=view&str_schema=sys__NM__scriptcase) returns valid data; only the POST that builds the catalog fails. This narrows the failure down to that code path.
6. Ruled-out hypotheses
-
Not
display_errors: php.ini already has display_errors=Off and log_errors=On. The <script> does not come from PHP’s standard output, but from ScriptCase’s own error handler (errorhandler.php).
-
Not session expiration: the keepalive
top.php?ajax=nm returns 200 and the catalog POST returns 200 (no 302, no redirect to login).
-
Not an fcgid timeout issue: response times are immediate; the failure is content-related, not time-related.
7. Impact
The “Project Themes” combo is unusable in the IDE for every migrated project that carries over themes lacking the css_text_decoration key. It is not possible to select, deselect, or change the project theme from that interface, nor to use the advanced Themes Mode in that context. The read-only themes in the “ScriptCase” group (e.g., Sc9_SoftCloud, Sc9_SoftCloud_sm) are not editable from the UI, so the user has no way to “add” the missing key to them.
8. Suggested fixes
8.1 Primary fix (server)
In nmPageAppSchemaAdvanced.class.php, harden the key read (and the other schema style keys) with safe access, for compatibility with v9-migrated themes that don’t carry it:
php
// Instead of:
$valor = $arr_estilo['css_text_decoration'];
// Use:
$valor = $arr_estilo['css_text_decoration'] ?? '';
8.2 Client robustness (recommended)
In _sc_cache_sc_theme_multicombo_*.js, wrap the JSON.parse in the success callback with a try/catch and finish the load in the catch, so that a non-JSON response does not leave the IDE hung:
javascript
success: function (retorno) {
var arr_schemas;
try {
arr_schemas = JSON.parse(retorno);
} catch (e) {
finishThemeLoading();
return;
}
mergeThemeCatalog(arr_schemas);
},
8.3 Encoding of migrated schemas (secondary)
During reproduction, a jQuery selector error also appeared, caused by latin1 encoding in migrated schema keys:
Uncaught Error: Syntax error, unrecognized expression:
#div_prop_header__NM__sys__NM__cabe%E7alho
cabe%E7alho = “cabeçalho” with ç in latin1 (%E7). Schema keys should be normalized to UTF-8 when migrating from v9, to avoid invalid selectors.
9. Temporary workaround
Until the official fix exists, excluding E_WARNING (and E_NOTICE) from error_reporting in php.ini prevents ScriptCase’s handler from firing the <script> blocks over the undefined key, allowing the catalog to serialize and the combo to load. Requires restarting Apache. Downside: it silences warnings across the entire IDE, so it is a palliative, not a solution.
ini
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_WARNING & ~E_NOTICE
10. Appendix — Evidence artifacts
- Console stack trace with the
SyntaxError (section 3).
- Body of the
app_schema_advanced.php POST response showing the 12 <script> + 6 <img> (section 5.2).
-
error_<hash>.html file generated in wwwroot/scriptcase/tmp/ with the Undefined array key "css_text_decoration" (section 5.3).
- Path of the implicated script:
devel/class/page/nmPageAppSchemaAdvanced.class.php.
- Implicated client file:
devel/lib/js/_sc_cache_sc_theme_multicombo_10.1.002.js (loadAjaxThemes function, line 489).