php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64057 substr_replace failed charset utf-8
Submitted: 2013-01-23 17:54 UTC Modified: 2014-12-30 10:41 UTC
Votes:1
Avg. Score:1.0 ± 0.0
Reproduced:0 of 1 (0.0%)
From: ltsujiguchi at gmail dot com Assigned:
Status: No Feedback Package: Strings related
PHP Version: 5.4.11 OS: Ubuntu 12.10
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: ltsujiguchi at gmail dot com
New email:
PHP Version: OS:

 

 [2013-01-23 17:54 UTC] ltsujiguchi at gmail dot com
Description:
------------
I had a problem when i used the substr_replace, using those changes os php.ini:

I couldn't find the exact version of my php on the drop, so i put the closest 
version, but my real version is the 5.4.6.

Result expected:
noticia.noticia_titulo LIKE %é% OR noticia.noticia_conteudo LIKE %é%

Result returned:
noticia.noticia_titulo LIKE %é% OR noticia.noticia_conteudo LIKE%é%?

Test script:
---------------
$replacement = '%é%';
$cond = 'noticia.noticia_titulo LIKE ? OR noticia.noticia_conteudo LIKE ?';
$posItem = stripos($cond, '?');
$cond = substr_replace($cond, $replacement, $posItem, 1);
$posItem = stripos($cond, '?');
$cond = substr_replace($cond, $replacement, $posItem, 1);
echo $cond;


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-01-23 18:21 UTC] krakjoe@php.net
[joe@fiji php-5.4.6]$ nano 64057.php
[joe@fiji php-5.4.6]$ sapi/cli/php 64057.php
noticia.noticia_titulo LIKE %é% OR noticia.noticia_conteudo LIKE %é%

Anyone else ??
 [2013-01-23 21:46 UTC] mail+php at requinix dot net
Do you have one of those weird editors where shift+space produces something 
besides a regular space? It may sound stupid and probably won't change anything 
but try deleting the "LIKE ?" and typing it again carefully.

Also stupid and pointless, check that
  echo bin2hex($cond);
ends in "...4c494b45203f".
 [2013-01-24 03:45 UTC] aharvey@php.net
Works fine for me too. Can you upload the entire file (preferably without 
copy/pasting), please?
 [2013-01-24 03:45 UTC] aharvey@php.net
-Status: Open +Status: Feedback
 [2013-01-26 13:37 UTC] ltsujiguchi at gmail dot com
Use NetBeans 7.2 using codification UTF-8.

Outher problem using:
$replacement = '%ééééáááá%';

Result approximate:
noticia.noticia_titulo LIKE %é% OR noticia.noticia_conteudo L%é%IKE ?
 [2013-01-26 13:42 UTC] ltsujiguchi at gmail dot com
Concatenating solved using substr.
 [2013-01-26 13:42 UTC] ltsujiguchi at gmail dot com
-Status: Feedback +Status: Open
 [2013-01-26 13:50 UTC] ltsujiguchi at gmail dot com
Update comment above: [2013-01-26 13:37 UTC] ltsujiguchi at gmail dot com

Using source in gedit new file
Manually 

<?php
$replacement = '%éééééááááá%';
$cond = 'noticia.noticia_titulo LIKE ? OR noticia.noticia_conteudo LIKE ?';
$posItem = stripos($cond, '?');
$cond = substr_replace($cond, $replacement, $posItem, 1);
$posItem = stripos($cond, '?');
$cond = substr_replace($cond, $replacement, $posItem, 1);
echo $cond;
?>

Result:
noticia.noticia_titulo LIKE %éééééááááá% OR noticia.noticia_cont%éééééááááá%udo 
LIKE ?
 [2013-01-26 13:54 UTC] ltsujiguchi at gmail dot com
Using echo bin2hex($cond);

Return:
6e6f74696369612e6e6f74696369615f746974756c6f204c494b452025c3a925204f52206e6f74696
369615f6e6f74696369615f636f6e746575646f204c494b4525c3a9253f
 [2013-10-10 07:36 UTC] datibbaw@php.net
Couldn't reproduce this on quite a few versions; see also: http://3v4l.org/FMSW9
 [2013-10-24 06:32 UTC] yohgaki@php.net
-Status: Open +Status: Feedback
 [2013-10-24 06:32 UTC] yohgaki@php.net
Taking look at the source code, I don't see the cause of this report.

I also get
http://3v4l.org/FMSW9

Try to ask Ubuntu developers.
 [2014-12-30 10:41 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Oct 13 14:01:27 2024 UTC