Solved

Error: Call-time pass-by-reference

Posted on 2003-11-07
3
378 Views
Last Modified: 2010-05-18
You got all the points I've got (as posted) if you can help me with this error message.


PHP Warning: Call-time pass-by-reference has been deprecated - argument passed by value; If you would like to pass it by reference, modify the declaration of fsockopen(). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. However, future versions may not support this any longer. in d:\debug.php on line 41 PHP Warning: Call-time pass-by-reference has been deprecated - argument passed by value; If you would like to pass it by reference, modify the declaration of fsockopen(). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. However, future versions may not support this any longer. in d:\debug.php on line 56


Here's the code for debug.php

<?
/*
Barcode Render Class for PHP using the GD graphics library
Copyright (C) 2001  Karim Mribti
       
   Version  0.0.7a  2001-04-01  
       
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
                 
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.
             
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
                   
Copy of GNU Lesser General Public License at: http://www.gnu.org/copyleft/lesser.txt
             
Source code home page: http://www.mribti.com/barcode/
Contact author at: barcode@mribti.com
*/

define(__DEBUG_HOST__, "localhost");
define(__DEBUG_PORT__, "9999");

define(__TRACE_HOST__, "localhost");
define(__TRACE_PORT__, "9999");

define(__TIMEOUT__, 3);
         
function __TRACE__ ($str) {
if (__TRACE_ENABLED__) {
 $errno  = 0;
 $errstr = "no error";
 
 $fp = @fsockopen(__TRACE_HOST__, __TRACE_PORT__, &$errno, &$errstr, __TIMEOUT__);
 
 if ($fp)
 {
    @fputs($fp, $str);
    @fclose($fp);
 }
 }
}
 
function __DEBUG__ ($str) {
if (__DEBUG_ENABLED__) {
 $errno  = 0;
 $errstr = "no error";
 
 $fp = @fsockopen(__DEBUG_HOST__, __DEGUB_PORT__, &$errno, &$errstr, __TIMEOUT__);
 
 if ($fp)
 {
    @fputs($fp, $str);
    @fclose($fp);
 }
 }
}
0
Comment
Question by:RobA
  • 2
3 Comments
 
LVL 14

Accepted Solution

by:
ThG earned 40 total points
ID: 9701467
$fp = @fsockopen(__TRACE_HOST__, __TRACE_PORT__, &$errno, &$errstr, __TIMEOUT__);

change this to:

 $fp = @fsockopen(__TRACE_HOST__, __TRACE_PORT__, $errno, $errstr, __TIMEOUT__);
0
 

Author Comment

by:RobA
ID: 9701553
PHP Warning: main(debug.php) [function.main]: failed to create stream: No such file or directory in d:\webserver\nczoo.org\www\cf\barcode\barcode.php on line 28 PHP Fatal error: main() [function.main]: Failed opening required 'debug.php' (include_path='.;c:\php4\pear') in d:\webserver\nczoo.org\www\cf\barcode\barcode.php on line 28



<?php
/*
Barcode Render Class for PHP using the GD graphics library
Copyright (C) 2001  Karim Mribti
                                                
   Version  0.0.7a  2001-04-01  
                                                
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
                                                                                                 
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.
                                                                    
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
                                                                                                             
Copy of GNU Lesser General Public License at: http://www.gnu.org/copyleft/lesser.txt
                                                                              
Source code home page: http://www.mribti.com/barcode/
Contact author at: barcode@mribti.com
*/

require("debug.php");

/***************************** base class ********************************************/
/** NB: all GD call's is here **/

/* Styles */

/* Global */
define("BCS_BORDER"                ,    1);
define("BCS_TRANSPARENT"    ,    2);
define("BCS_ALIGN_CENTER"   ,    4);
define("BCS_ALIGN_LEFT"     ,    8);
define("BCS_ALIGN_RIGHT"    ,   16);
define("BCS_IMAGE_JPEG"     ,   32);
define("BCS_IMAGE_PNG"      ,   64);
define("BCS_DRAW_TEXT"      ,  128);
define("BCS_STRETCH_TEXT"   ,  256);
define("BCS_REVERSE_COLOR"  ,  512);
/* For the I25 Only  */
define("BCS_I25_DRAW_CHECK" , 2048);

/* Default values */

/* Global */
define("BCD_DEFAULT_BACKGROUND_COLOR", 0xFFFFFF);
define("BCD_DEFAULT_FOREGROUND_COLOR", 0x000000);
define("BCD_DEFAULT_STYLE"           , BCS_BORDER | BCS_ALIGN_CENTER | BCS_IMAGE_PNG);
define("BCD_DEFAULT_WIDTH"           , 460);
define("BCD_DEFAULT_HEIGHT"          , 120);
define("BCD_DEFAULT_FONT"            ,   5);
define("BCD_DEFAULT_XRES"            ,   2);
/* Margins */
define("BCD_DEFAULT_MAR_Y1"          ,  10);
define("BCD_DEFAULT_MAR_Y2"          ,  10);
define("BCD_DEFAULT_TEXT_OFFSET"     ,   2);
/* For the I25 Only */
define("BCD_I25_NARROW_BAR"              ,   1);
define("BCD_I25_WIDE_BAR"                   ,   2);

/* For the C39 Only */
define("BCD_C39_NARROW_BAR"              ,   1);
define("BCD_C39_WIDE_BAR"                   ,   2);

/* For Code 128 */
define("BCD_C128_BAR_1"              ,   1);
define("BCD_C128_BAR_2"              ,   2);
define("BCD_C128_BAR_3"              ,   3);
define("BCD_C128_BAR_4"              ,   4);

  class BarcodeObject {
                                 
    var $mWidth, $mHeight, $mStyle, $mBgcolor, $mBrush;
      var $mImg, $mFont;
      var $mError;
      
      function BarcodeObject ($Width = BCD_DEFAULT_Width, $Height = BCD_DEFAULT_HEIGHT, $Style = BCD_DEFAULT_STYLE)  {
          $this->mWidth   = $Width;
            $this->mHeight  = $Height;
            $this->mStyle   = $Style;
            $this->mFont    = BCD_DEFAULT_FONT;
            $this->mImg        = ImageCreate($this->mWidth, $this->mHeight);
            $dbColor        = $this->mStyle & BCS_REVERSE_COLOR ? BCD_DEFAULT_FOREGROUND_COLOR : BCD_DEFAULT_BACKGROUND_COLOR;
            $dfColor        = $this->mStyle & BCS_REVERSE_COLOR ? BCD_DEFAULT_BACKGROUND_COLOR : BCD_DEFAULT_FOREGROUND_COLOR;
            $this->mBgcolor = ImageColorAllocate($this->mImg, ($dbColor & 0xFF0000) >> 16,
                                      ($dbColor & 0x00FF00) >> 8 , $dbColor & 0x0000FF);              
            $this->mBrush   = ImageColorAllocate($this->mImg, ($dfColor & 0xFF0000) >> 16,
                                                  ($dfColor & 0x00FF00) >> 8 , $dfColor & 0x0000FF);
            if (!($this->mStyle & BCS_TRANSPARENT)) {                                                        
                  ImageFill($this->mImg, $this->mWidth, $this->mHeight, $this->mBgcolor);
            }
        __TRACE__("OBJECT CONSTRUCTION: ".$this->mWidth." ".$this->mHeight." ".$this->mStyle);
      }
      
    function DrawObject ($xres)      {
        /* there is not implementation neded, is simply the asbsract function. */
       __TRACE__("OBJECT DRAW: NEED VIRTUAL FUNCTION IMPLEMENTATION");
       return false;
      }
      
      function DrawBorder () {
          ImageRectangle($this->mImg, 0, 0, $this->mWidth-1, $this->mHeight-1, $this->mBrush);
           __TRACE__("DRAWING BORDER");
      }
      
      function DrawChar ($Font, $xPos, $yPos, $Char) {
                  ImageString($this->mImg,$Font,$xPos,$yPos,$Char,$this->mBrush);
      }
      
      function DrawText ($Font, $xPos, $yPos, $Char) {
                  ImageString($this->mImg,$Font,$xPos,$yPos,$Char,$this->mBrush);
      }  
            
      function DrawSingleBar($xPos, $yPos, $xSize, $ySize) {
        if ($xPos>=0 && $xPos<=$this->mWidth  && ($xPos+$xSize)<=$this->mWidth &&
            $yPos>=0 && $yPos<=$this->mHeight && ($yPos+$ySize)<=$this->mHeight) {
                for ($i=0;$i<$xSize;$i++) {
                     ImageLine($this->mImg, $xPos+$i, $yPos, $xPos+$i, $yPos+$ySize, $this->mBrush);
                     }
                     return true;
                   }
            __DEBUG__("DrawSingleBar: Out of range");
             return false;    
        }                               
                                       
      function GetError() {  
        return $this->mError;
      }                                 
                                       
      function GetFontHeight($font) {
       return ImageFontHeight($font);
      }                                             
                                                   
      function GetFontWidth($font)  {
       return ImageFontWidth($font);
      }                               
                                     
      function SetFont($font) {
       $this->mFont = $font;
      }                               
                                     
      function GetStyle () {
       return $this->mStyle;
      }                               
                                     
      function SetStyle ($Style) {
     __TRACE__("CHANGING STYLE");
       $this->mStyle = $Style;
      }                   
                         
      function FlushObject () {
       if (($this->mStyle & BCS_BORDER)) {
             $this->DrawBorder();
          }                              
         if ($this->mStyle & BCS_IMAGE_PNG) {
         Header("Content-Type: image/png");
           ImagePng($this->mImg);
         } else if ($this->mStyle & BCS_IMAGE_JPEG) {
                     Header("Content-Type: image/jpeg");
                      ImageJpeg($this->mImg);
                     } else __DEBUG__("FlushObject: No output type");
       }                                                                  
                                                                          
     function DestroyObject () {
         ImageDestroy($obj->mImg);
       }
   }
?>
0
 

Author Comment

by:RobA
ID: 9703403
NOw, if I could just get this damn thing to work!
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Sending email via PHP & Pear - Warning: include_once(Net/SMTP.php): failed to open stream 5 67
error log using ftp 7 41
How would I do this...? 2 28
PHP Syntax Error 4 27
Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question