Solved

Error: Call-time pass-by-reference

Posted on 2003-11-07
3
382 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
how can i gnupg encrypt a PDF document? 12 60
Split wordpress loop 35 56
Why will this INSERT statement not insert the date? 2 19
What is wrong with this PDO Delete Query? 2 17
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
This article discusses four methods for overlaying images in a container on a web page
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

790 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