php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73441 mb_internal_encoding() never returns
Submitted: 2016-11-02 07:30 UTC Modified: 2016-11-02 19:59 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: inge at vabekk dot no Assigned:
Status: Not a bug Package: mbstring related
PHP Version: 7.0.12 OS: Ubuntu 16.04
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: inge at vabekk dot no
New email:
PHP Version: OS:

 

 [2016-11-02 07:30 UTC] inge at vabekk dot no
Description:
------------
---
From manual page: http://www.php.net/function.mb-internal-encoding
---
This function does not return.


Test script:
---------------
HERE 1
<php
mb_internal_encoding (UTF-8);
?>
HERE 2!


Expected result:
----------------
HERE 1
HERE 2

Actual result:
--------------
HERE 1

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-11-02 09:58 UTC] cmb@php.net
-Summary: PHP 7.0.8-0ubuntu0.16.04.3 +Summary: mb_internal_encoding() never returns -Type: Documentation Problem +Type: Bug -Package: PHP Language Specification +Package: mbstring related
 [2016-11-02 18:03 UTC] requinix@php.net
-Status: Open +Status: Feedback
 [2016-11-02 18:03 UTC] requinix@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.

Your script is not valid PHP code. It will not execute as PHP but instead display "HERE 1 HERE 2!" in your browser.
 [2016-11-02 18:46 UTC] inge at vabekk dot no
-Status: Feedback +Status: Open
 [2016-11-02 18:46 UTC] inge at vabekk dot no
It's easier to describe the output outside of the php statements.
However, I also lost a question mark. So write it this way:

<?php
echo "HERE 1\n";
mb_internal_encoding (UTF-8);
echo "HERE 2\n";
?>

The expected result should be evident.
 [2016-11-02 18:47 UTC] requinix@php.net
-Status: Open +Status: Feedback
 [2016-11-02 18:53 UTC] inge at vabekk dot no
-Status: Feedback +Status: Open
 [2016-11-02 18:53 UTC] inge at vabekk dot no
The "UTF-8" should be surrounded by quotes - I used a variable and forgot them.
 [2016-11-02 18:54 UTC] requinix@php.net
-Status: Open +Status: Feedback
 [2016-11-02 18:54 UTC] requinix@php.net
It still works. https://3v4l.org/oDJBr
 [2016-11-02 19:03 UTC] inge at vabekk dot no
-Status: Feedback +Status: Open
 [2016-11-02 19:03 UTC] inge at vabekk dot no
I run this function alone and get this result:
php erter.php
HERE 1
PHP Fatal error:  Uncaught Error: Call to undefined function mb_internal_encoding() in /Store/inge/bin/erter.php:3
Stack trace:
#0 {main}
  thrown in /Store/inge/bin/erter.php on line 3

There is no return from the function. This is php 7.
 [2016-11-02 19:05 UTC] requinix@php.net
-Status: Open +Status: Not a bug
 [2016-11-02 19:05 UTC] requinix@php.net
You don't have the mbstring extension installed.

apt-get install php-mbstring
 [2016-11-02 19:27 UTC] inge at vabekk dot no
Hard to find good documentation for this. The function documentation states that it should be valid for php7 - the need for this install should be made more clear. The error did not occur for php5.
 [2016-11-02 19:59 UTC] requinix@php.net
It is valid. The problem is that your PHP 7 setup does not have mbstring installed while your PHP 5 setup did. It's a configuration issue when you set up your Ubuntu server.

And in case it wasn't clear enough, the error message is telling you that the function was not defined. Does not exist. Which is because the extension that defined it was not loaded.

https://www.google.com/search?q="Call+to+undefined+function+mb_internal_encoding"
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 17:01:58 2024 UTC