|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2007-09-11 09:35 UTC] hans at origin dot edvz dot uni-linz dot ac dot at
Description:
------------
in stats-1.0.2/statistics.c we have some conflicts in the
name maps ... the actual C statement declaring the function name and binding to the randlib.c function uses a different name as the 'proto' comment tells
e.g.
/* {{{ proto int stats_rand_gen_int(void)
Generates random integer between 1 and 2147483562 */
PHP_FUNCTION(stats_rand_ignlgi)
^^^^^^^^^^^^^^^^^ mismatch/conflict with
proto name
should read correctly:
/* {{{ proto int stats_rand_gen_int(void)
Generates random integer between 1 and 2147483562 */
PHP_FUNCTION(stats_rand_int)
^^^^^^^^^^^^^^^ corresponds to 'proto' name
The following command pipe generates a list of all name pairs supposed to be a mismatch:
rapax STATS-Extension/stats-1.0.2> egrep 'PHP_FUNCTION\(st|proto' statistics.c | awk -F'[\(\) ]' '/proto/{nn=$5; next;} /)/{if ( nn != $2) print "mismatch: ",nn, $2}'
mismatch: stats_stat_gennch stats_cdf_normal
mismatch: stats_stat_noncentral_t stats_cdf_noncentral_t
mismatch: stats_rand_get_seeds stats_rand_getsd
mismatch: stats_rand_gen_int stats_rand_ignlgi
mismatch: stats_rand_gen_noncenral_chisquare stats_rand_gen_noncentral_chisquare
mismatch: stats_rand_gen_noncentral_f stats_rand_gen_noncenral_f
mismatch: stats_rand_gen_ibinomial stats_rand_ibinomial
mismatch: stats_rand_gen_ibinomial_negative stats_rand_ibinomial_negative
mismatch: stats_den_uniform stats_dens_uniform
mismatch: stats_dens_negative_binomial stats_dens_pmf_negative_binomial
mismatch: stats_stat_gennch stats_stat_factorial
---> for each of these names the proper declaration/definition/mapping in
php_statistics.h
statistics.c
needs to be checked / corrected
Reproduce code:
---------------
<?
echo " === testing random generator \n";
//echo " stats_rand_gen_int() ... undefined ... use stats_rand_ignlgi() " . stats_rand_ignlgi() . " \n";
echo " stats_rand_gen_int() --> " . stats_rand_gen_int() . " \n";
?>
Expected result:
----------------
X-Powered-By: PHP/4.4.5
Content-type: text/html
=== testing random generator
stats_rand_gen_int() --> 695163044
Actual result:
--------------
rapax DIST/STATS-Extension> /opt/php4/inst/bin/php MeJ_test_rand_gen_int.php
X-Powered-By: PHP/4.4.5
Content-type: text/html
=== testing random generator
<br />
<b>Fatal error</b>: Call to undefined function: stats_rand_gen_int() in <b>/opt/php4/DIST/STATS-Extension/MeJ_test_rand_gen_int.php</b> on line <b>6</b><br />
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 15 13:00:01 2025 UTC |
... sorry there are some typos in my bug report ... for example: PHP_FUNCTION(stats_rand_int) ^^^^^^^^^^^^^^^ corresponds to 'proto' name should really read: PHP_FUNCTION(stats_rand_gen_int) ^^^^^^^^^^^^^^^^^^ corresponds to 'proto' name but the 'idea' should be clear ;-))))