|
Changes previously carried as bnw-container-paths.patch in
guix-bioinformatics, now applied to the source directly:
* unify data directories on /var/lib/genenet/bnw (was /tmp/bnw and
./data/ mixed)
* make the shell_exec paths __DIR__-relative and the example/octave
helper scripts location-independent, so php-fpm can run them from
any working directory
* use core-octave randn/exp instead of the statistics-package
normrnd/normpdf (not available in the container's octave)
* nnodes: strtrim before strfind so the node count parses with the
container's octave output
* python3 instead of a hardcoded /home/jziebart path
* add diag.php, a debug page showing the request and data state
* bn_genenet.php: serve the GeneNetwork (GN2) handshake server-side;
the My_Gennenet POST is converted (commas -> tabs, semicolons ->
newlines) in PHP and the prepared-data page is returned in ONE
request. This removes the raw-echo of into a JavaScript
string (an XSS hole on public deployments) and is backward
compatible for GN2 (same POST, better response).
|
|
PHP 8 throws a fatal TypeError for arithmetic (+ - * /) on a
non-numeric string ("Unsupported operand types"); PHP 7.4 only warned
and treated it as 0. Several files perform arithmetic directly on
values parsed from intermediate state files (nnode.txt, nrows.txt,
structure_input*.txt) or from `dot -Tplain` output, with no
is_numeric() check — safe as long as those files are well-formed, but
a crash risk if a file is missing/empty/truncated or a `dot` output
line doesn't parse as expected.
Affected: runtime_check.php ($node, $nrows), remove_variables.php and
create_tiers_gom_part1.php ($maxplist=$node-1), mat_structure.php
(matrix cell multiplication), and the four network_layout_{evd,inv}[,_2].php
files ($r_index=$node+N and the dot-output-derived $cell arithmetic in
the _2 variants).
Fix pattern: coalesce to 0 via `is_numeric($x) ? $x : 0` before the
arithmetic, matching PHP 7.4's original fallback-to-0 behavior instead
of crashing.
Verified empirically against PHP 8.3.28 with runtime_check.php and
mat_structure.php: previously, a missing/empty source file caused
TypeError: Unsupported operand types: string - int (or string * int)
after the fix, the same missing-file scenario produces only the
pre-existing "undefined array key" warnings (same as PHP 7.4) and the
function completes and returns a value instead of crashing.
Reviewed by: Frederick M Muriithi <fredmanglis@gmail.com>
|