You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fdiv() in ext/standard/fdiv.php only accepts int/float operands and throws LogicException for numeric strings and non-scalars. Zend PHP_FUNCTION(fdiv) uses Z_PARAM_DOUBLE: numeric strings coerce; arrays/objects throw TypeError.
Category
stdlibProblem
fdiv()inext/standard/fdiv.phponly accepts int/float operands and throwsLogicExceptionfor numeric strings and non-scalars. ZendPHP_FUNCTION(fdiv)usesZ_PARAM_DOUBLE: numeric strings coerce; arrays/objects throwTypeError.php-src reference
ext/standard/math.c—PHP_FUNCTION(fdiv);Z_PARAM_DOUBLEon both operandszend_fdiv()inZend/zend_operators.cRepro
Save as
repro_fdiv.php:fdiv("6","2")float(3)LogicExceptionfdiv("6.0", 2)float(3)LogicExceptionfdiv([], 2)TypeErrorLogicExceptionScope (this repo)
ext/standard/fdiv.php—toFloat()/ operand validationext/standard/VmMath.php— reuse double coercion helper (#4350)fdiv::call()—unboxValueToDoublemust not return0.0for invalid types silentlytest/compliance/cases/stdlib/fdiv_numeric_string.phptDone when
Z_PARAM_DOUBLErulesTypeError(notLogicException)0.0fallback for bad types)./script/ci-fast.sh --filter fdivgreendocs/capabilities.mdmatrix unchanged (already VM/JIT/AOT yes)Links