Bug #80070 [Csd]: mb_http_input("UTF-8"); does crash php8.0.0beta3

From: Date: Mon, 07 Sep 2020 08:05:43 +0000
Subject: Bug #80070 [Csd]: mb_http_input("UTF-8"); does crash php8.0.0beta3
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-228919@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80070&edit=1 ID: 80070 User updated by: call dot user dot func at gmail dot com Reported by: call dot user dot func at gmail dot com Summary: mb_http_input("UTF-8"); does crash php8.0.0beta3 Status: Closed Type: Bug Package: mbstring related Operating System: Windows 10 PHP Version: 8.0.0beta3 Assigned To: nikic Block user comment: N Private report: N New Comment: Thanks for fast reply. Also i'm surprised why we had that wrong parameter. Never thought about it until today. I guess we had it because in next line we do mb_http_output() which accepts an encoding parameter. Previous Comments: ------------------------------------------------------------------------ [2020-09-07 08:02:09] nikic@php.net This has already been fixed in https://github.com/php/php-src/commit/d57f9e5ea41aac7e40d37b6335cd2e03bf3b73fa. However, after seeing your code I also changed it to throw a ValueError: https://github.com/php/php-src/commit/623bf96e7e37a05622df163a228c8e1c3f7d0b02 mb_http_input() is a function to get the input encoding, not to set it. Passing an encoding to it doesn't make sense. ------------------------------------------------------------------------ [2020-09-07 06:00:39] requinix@php.net valgrind of php -r 'mb_http_input("UTF-8");' ==50== Process terminating with default action of signal 11 (SIGSEGV) ==50== Access not within mapped region at address 0x8 ==50== at 0x4D0A03: zif_mb_http_input (mbstring.c:1379) ==50== by 0x7ECC63: ZEND_DO_ICALL_SPEC_RETVAL_UNUSED_HANDLER (zend_vm_execute.h:1234) ==50== by 0x85D411: execute_ex (zend_vm_execute.h:55325) ==50== by 0x861DE3: zend_execute (zend_vm_execute.h:59932) ==50== by 0x79E3A8: zend_eval_stringl (zend_execute_API.c:1177) ==50== by 0x79E5A2: zend_eval_stringl_ex (zend_execute_API.c:1218) ==50== by 0x79E617: zend_eval_string_ex (zend_execute_API.c:1228) ==50== by 0x8A1656: do_cli (php_cli.c:979) ==50== by 0x8A25A1: main (php_cli.c:1336) ------------------------------------------------------------------------ [2020-09-07 05:27:36] call dot user dot func at gmail dot com Description: ------------ Starting with php8.0.0beta3 on windows (all prev. versions work as expected), php does crash on line mb_http_input() with enabled mbstring extension: error_reporting(E_ALL); mb_http_input("UTF-8"); echo mb_substr("foo", 0, 1); This is in command line and apache module. Apache does crash the thread with no clear error log. PHP CLI just crash without error, at least i can't find any. Are there any dependency that we must update with beta3? As i can read here: https://github.com/php/php-src/blob/php-8.0.0beta3/NEWS - I see there is a Fixed bug #55847 (DOTNET .NET 4.0 GAC new location). (cmb) Maybe something happened here? Test script: --------------- <?php error_reporting(E_ALL); mb_http_input("UTF-8"); echo mb_substr("foo", 0, 1); ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=80070&edit=1

« previous php.bugs (#228919) next »