php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27507 class method returns other value
Submitted: 2004-03-05 12:40 UTC Modified: 2004-03-05 18:58 UTC
From: alexandre at z-index dot com dot br Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: 4.3.4 OS: Windows 2000 SP4
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: alexandre at z-index dot com dot br
New email:
PHP Version: OS:

 

 [2004-03-05 12:40 UTC] alexandre at z-index dot com dot br
Description:
------------
This problem happens when a call a specific method from a class and when a i try a echo this values strange chars (+,*,),#) apear than the real data value. Here goes the sample script:

Reproduce code:
---------------
<?

class y
  {
  function x()
    {
    $query = "any insert";
    $resultado = mysql_query($query);
  
    $id = mysql_insert_id($this->Conexao);
    echo "<br>inside function ".$id; 
    }
  }

$z = new y();
$x = $z->x();

echo "<br>outside function".$x;

?>

Expected result:
----------------
inside function 12
outside function 12

Actual result:
--------------
inside function 12
outside function (

or 

inside function 12
outside function *

or 

inside function 12
outside function #

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-03-05 13:18 UTC] alexandre at z-index dot com dot br
A find out that any time that a refresh de page (posting again) those strange chars follow an order... i think it?s kind a ascii table... a got 0,1,2,3,4...9,:,;,<,= instead the real value for mysql_insert_id($this->Conexao) was 56,57,58 e etc...
 [2004-03-05 18:58 UTC] derick@php.net
You need to return the value yourself from the function with the 'return' keyword.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Sep 11 22:01:26 2024 UTC