Bug #74999 [Opn->Ver]: Exception::__toString truncates message at null byte

From: Date: Fri, 28 Jul 2017 09:24:44 +0000
Subject: Bug #74999 [Opn->Ver]: Exception::__toString truncates message at null byte
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-210386@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=74999&edit=1 ID: 74999 Updated by: kalle@php.net Reported by: nobots dot nospam at example dot org Summary: Exception::__toString truncates message at null byte -Status: Open +Status: Verified Type: Bug Package: *General Issues PHP Version: Irrelevant Block user comment: N Private report: N New Comment: Internally it comes down to the fact that the smartstr snprintf family function is not binary safe Previous Comments: ------------------------------------------------------------------------ [2017-07-28 03:58:51] nobots dot nospam at example dot org Description: ------------ Exception's message as string is truncated at the first occurrence of a null byte, notably a problem when anonymous classes are involved, as their name does contain a null byte thanks Test script: --------------- echo new Exception("XXXX " . get_class(new class{}) . " YYYY"); Expected result: ---------------- Exception: XXXX class@anonymous... YYYY in file:3 Stack trace: #0 {main} Actual result: -------------- Exception: XXXX class@anonymous in /in/mft0e:3 Stack trace: #0 {main} ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=74999&edit=1

« previous php.bugs (#210386) next »