[PHP] call-time pass-by-reference feature really deprecated?
Hi, I just got a warning message on a system using php version 4.3.1: 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 [runtime function name](). 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. This msg does not appear on my machine running php 4.3.2. Maybe it's because of the different configuration? Will the pass-by-reference feature really be dropped?! Many software design patterns wouldn't be possible anymore! It's an essential feature. The config of the system throwing the warning is: './configure' '--with-mysql=/usr/local/mysql/' '--with-apache=../apache_1.3.27/' '--enable-track-vars' '--with-config-file-path=/etc/' '--with-imap=/usr/local/imap-2001a' '--with-gettext' '--with-exec-dir=/usr/local/typo3sh/bin' '--with-gd=/usr/local/typo3sh' '--with-jpeg-dir' '--with-png-dir' '--with-tiff-dir' '--with-ttf=/usr/local/typo3sh' '--with-zlib=yes' '--enable-gd-nativ-ttf' '--enable-ftp' '--with-xml' /dorgon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] call-time pass-by-reference feature really deprecated?
Maybe, there's a setting for this in php.ini. yes. there is: >>declaration of [runtime function name](). 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. "pass-by-reference" has not been dropped, it is "Call-time pass-by-reference" which is being deprecated. so call-time pass-by-reference is giving parameters as reference to functions, e.g. function returnObjectToAccumulator(&$obj) {...} If this feature is really dropped, how would you implement ConnectionPools for DB-connections for instance, or any classes managing a set of object and providing them by returning references? many OOP design patterns (primarily adopted from java) would not be possible anymore. I think this would be worth talking about. Is there any plausible reason for that decision? /dorgon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: call-time pass-by-reference feature really deprecated?
whats the difference? call-time-pass... is function callMe(&$obj) {...} and pass-by-ref is "return &$obj" ? I'm not sure if I got you. tx dorgon Rush wrote: "Dorgon" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Will the pass-by-reference feature really be dropped?! Many software design patterns wouldn't be possible anymore! It's an essential feature. I think call-pass-by-reference is going away, but pass-by-reference is going to be default in PHP5. rush -- http://www.templatetamer.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Version Independent Sessions?
that's some of my scripts I once used. have a look at it. it won't run instantly, since I just took them from a collection of classes hth /Dorgon the most interesting part will be: // initialize global session object session_start(); if (isset($_SESSION)) { // php versions >= 4.1.0 if (!isset($_SESSION['userSess'])) { $_SESSION['userSess'] = new UserSession(); $sess =& $_SESSION['userSess']; $sess->init(); } else { $sess =& $_SESSION['userSess']; $_SESSION['userSess']->reuse(); } } else { // for downward compatibility to old php version (< 4.1.0) if (!isset($userSess)) { $userSess = new UserSession(); $sess =& $userSess; $userSess->init(); session_register("userSess"); } else { $sess =& $userSess; $userSess->reuse(); session_register("userSess"); } } Lee Herron Qcs wrote: Does anyone know of a working snippet to manage sessions using any combination of Register_Global and pre/post php v4.1? Would love to look at some examples .. params = array(); $this->msg = ""; $this->userID = null; $this->userData = array(); } /** * reuse() should be called on each page request within session scope * get-parameters which should be stored in the session can be submitted * by a single get-variable: params=KEY1_VALUE1,KEY2_VALUE2,KEY3_VALUE3... * ater that the login action is called and * finally the proper reuseAction() function of the child class is called */ function reuse() { if (isset($GLOBALS['_GET']['params'])) { $doubles = explode(".",$GLOBALS['_GET']['params']); foreach ($doubles as $par) { $par = explode("_",$par); $this->params[$par[0]] = $par[1]; } } $this->doLogin(); $this->reuseAction(); } /** * login action * proper functions loginAction(), log */ function doLogin() { if (isset($GLOBALS['_GET']['dologin'])) { switch($GLOBALS['_GET']['dologin']) { case "form": $this->loginFormAction(); break; case "login": if ($GLOBALS['_POST']['user_login'] == "") { $this->msg = "Please enter your login name."; return false; } else { if(!defined("__USEROBJECT_CLASS")) include $GLOBALS['conf']->get("dir_objects")."userobject.inc"; $user = new UserObject(); $user->loadUserByLogin($GLOBALS['_POST']['user_login']); if ($user->checkPwd($GLOBALS['_POST']['user_password'])) { if ($this->loginAction(&$user)) { $this->userData = $user->getRecord(); $user->unload(); $this->userID = $this->userData['user_id']; $this->params['last_selflogin_time'] = $this->userData['last_login_time']; $this->params['last_selflogin_host'] = $this->userData['last_login_host']; $user->loadLastAdmin(); $this->params['last_userlogin_name'] = $user->get("user_first_name")." ".$user->get("user_last_name"); $this->params['last_userlo
Re: [PHP] call-time pass-by-reference feature really deprecated?
I think you are absolutely right. thanx! I'll fix it and see if the warning still remains. /Dorgon Bobby Patel wrote: Isn't Call-time pass-by-reference the following $variable = myFunction1(&$x); Where myFunction1() is defined as function myFunction1($x) Where as pass-be-reference is called as $variable = myFunction2($x); Where is defined as function myFunction2 (&$Obj); I think the latter is better anyways, because the caller shouldn't know the internals of the function, so you don't know if the function will copy the argument and use that instead. "Dorgon" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Maybe, there's a setting for this in php.ini. yes. there is: >>declaration of [runtime function name](). 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. "pass-by-reference" has not been dropped, it is "Call-time pass-by-reference" which is being deprecated. so call-time pass-by-reference is giving parameters as reference to functions, e.g. function returnObjectToAccumulator(&$obj) {...} If this feature is really dropped, how would you implement ConnectionPools for DB-connections for instance, or any classes managing a set of object and providing them by returning references? many OOP design patterns (primarily adopted from java) would not be possible anymore. I think this would be worth talking about. Is there any plausible reason for that decision? /dorgon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] call-time pass-by-reference feature really deprecated?
Thanks for the explanation. Yes, let us drop call-time pass-by-reference!! I'm with you. ;-) /dorgon Jason Wong wrote: On Friday 20 June 2003 01:11, dorgon wrote: Maybe, there's a setting for this in php.ini. yes. there is: Yes, I know there is ;-) The 'maybe' is maybe you have it set different on the two systems. >>declaration of [runtime function name](). 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. "pass-by-reference" has not been dropped, it is "Call-time pass-by-reference" which is being deprecated. so call-time pass-by-reference is giving parameters as reference to functions, e.g. function returnObjectToAccumulator(&$obj) {...} If this feature is really dropped, how would you implement ConnectionPools for DB-connections for instance, or any classes managing a set of object and providing them by returning references? many OOP design patterns (primarily adopted from java) would not be possible anymore. I think this would be worth talking about. Is there any plausible reason for that decision? "Call-time pass-by-reference" = function doo($i_may_or_may_not_be_a_reference) { $i_may_or_may_not_be_a_reference++; } $i = 1; doo($i); echo $i; // 1 doo(&$i); echo $i; // 2 // here doo() is not defined to have parameters passed by reference. The decision on whether to pass by reference is made at run-time, hence call-time pass-by-reference. It is this behaviour which is being deprecated. So in the newer versions of PHP if call-time pass-by-reference is disabled and you wish to pass parameters by reference you'll have to define your functions accordingly: function doo(&$i_am_passed_by_reference) { ... } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] open_basedir
hi folks, I just realised that open_basedir also prevents the access to /tmp. Thus, file uploads aren't possible. One solution would be, to use a tmp directory within open_basedir, to give PHP the required write access. But assume you're using a server with multiple VirtualHosts and www-dirs. You use open_basedir to limit the access of every script running in a specific VirtualHost/www-dir to its proper www-dir. Now you would have to create a .../tmp directory for each single www-dir, which is not very pretty. Would it be possible to limit access to open_basedir without the exception of /tmp, to allow the uploads? /dorgon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] identify not only browser, but even browser windows with session
hi, does anybody know how I could identify the browser window? my problem is, that i have a application framework and I want to use multiple windows providing different GUIs. Each window should be able to send a request and send a proper session key or unique key which identifies the application window. I cannot use get/post parameters, because the framework works in a different way and uses the path info. i also don't want to use the path info to pass through the window key. can cookies be stored for single browser instances (windows)? does the browser send some information that could be uses? thanks in advance, dorgon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: topic_maps with php
I don't know any php lib working with topic maps. Why don't you use Java for displaying too. Check out http://weblogs.medien.uni-weimar.de/topicmaps/Tools I think you will have better support for Java since it was introduced in Java. /dorgon Sebastian Mangelkramer Imac wrote: hi all together, our team started working with topic maps one jear ago, with java (tm4j). now we decide to develop a tool with php which displays us a topicmap. we`ve tried several ways to display it, but no one was ok. my question: does anyone know a solution for displaying a topicmap with php, without the use of any other languages like java, etc. ? thanks ! yours sincerly sebastian, imac.de -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Encoding
plase ISO-8859-2 is the one you'll need. Denis 'Alpheus' Cahuk wrote: So you don't know what encoding I should use? At 19:39 24.6.2003 +0800, you wrote: On Tuesday 24 June 2003 19:07, Denis 'Alpheus' Cahuk wrote: > My surname (Èahuk, I write it Cahuk) is writen with a C and a \/ above it. > What encoding do I need so that every1 will see it? Can we just call you Denis? -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] identify not only browser, but even browser windows
I thought so One solution would be not to use cookies and pass different unique ids from each window. thx dorgon Ernest E Vogelsinger wrote: At 10:58 24.06.2003, dorgon said: [snip] can cookies be stored for single browser instances (windows)? does the browser send some information that could be uses? [snip] Short answer - no, and no. Cookies are stored browser-wide, and if the user presses Ctrl+N (or else) to open a new window you would never detect it. Even using some sophisticated techniques like session access counters, session serial numbers, etc, are not guaranteed to work since the browser may have cached the page contents and simply _locally_ copied it to the new window, not issuing a new request. However you may use a serial number in session data that is incremented with each request. Incorporate this number in any form or session-based link to have the browser transmit it back to you. Then compare if the serial number matches the expected vale; if not it's a reload and you can proceed as seems fit. However you don't have a chance to recognize if the reload comes from simply a page reload, or from a window clone. BTW - this is the reason I have switched off session cookies at my servers. Having the SID available allows to run more than one session from a single browser instance. HTH, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php caches mysql connections to same host
Is this a bug or a feature? I realised that php caches mysql connection even when not using persistent connections! When calling mysql_connect(...host...) twice, and not closing to first connection I get the same resource #id the first connection has. I noticed that, when writing a connectionPool, that opens n connections to different DSN (data source names, that specify dbms://user:[EMAIL PROTECTED]/db in one string). The problem raises, when I have to different connections to the same mysql host but different databases. Then the second connection is taking the first, but the first is used by another class. The only solution is to do a mysql_select_db before every query. Is this a bug or a feature? /dorgon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php caches mysql connections to same host
for better understanding: $conn1 = mysql_connect("localhost", "user", "pwd"); mysql_select_db("database1", $conn1); $conn2 = mysql_connect("localhost", "user", "pwd"); mysql_select_db("database2", $conn2); // select two diff. DBs echo $conn1.""; echo $conn2.""; returns: Resource id #2 Resource id #2 BUT: $conn1 = mysql_connect("127.0.0.1", "user", "pwd"); mysql_select_db("database1", $conn1); $conn2 = mysql_connect("localhost", "user", "pwd"); mysql_select_db("database2", $conn2); // select two diff. DBs ...returns two different resource IDs (which I'd like to have). When using mysql_pconnect I'm always getting correctly different resource ids. /dorgon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: MSWord attachment with mail()
I suggest you to use PEAR's Mail_Mime package. That class just takes you a couple of minutes to send MIME Mails with blank text + html + attachments. Alberto Brea wrote: Dear list, What header must I use to send a MSWord attachment with mail()? I have looked it up in the manual and on php.net but cannot find it. Thanks anyone, Alberto Brea http://estudiobrea.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: generate word docs
hmm... sounds troublesome. do you need all text/paragraph formatting features of word? what if finding a spec for RTF, which is much easier and specifying the word MIME key respectifely saving as .doc (words opens rtf without a convert dialog I think). just a thought Evan Nemerson wrote: Summary: I have to create a word document on the fly. what's the best way to go about it? Okay so I have a client that would like something output to a word document. I already have HTML and PDF versions... I'm trying to figure out the best way to do this. I am already aware of the open html in word hack. The way I see it, these are my choices: 1) Use the hack that I'm really don't like. It never looks quite right (which is the whole point of this). 2) Move everything over to a windows host and use COM. 3) Somehow convice host (hurricane electric) to run PHP5 CVS w/ Sterling's mono extension, and use .net to create the word document (does mono support that class yet?). I hate C#. VB is even worse. 4) Find an open-source library that writes word documents (quick search revealed nothing...), write an extension for php. 5) Find a spec for word docs and write a library in php 6) find a spec and write a library in c, then create php extension. I'm willing to do this, but it would take a long time... 7) Tell my boss to sod off (politely, though), it's not currently feasible... I think this is what he's expecting, anyways. So, does anyone have any suggestions/comments? Anyone know where I could find a library (in c or php) or a spec? I'm kinda thinking aloud here hoping someone will prod me in the right direction... Thanks Evan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: correct syntax
Harry Wiens wrote: What would be the correct syntax? 1. $_SESSION[test] in this case "test" is a constant and must be defined by calling define("test", some_integer_value) before 2. $_SESSION['test'] this is correct. but variables will not be equaled in the string. so when using '' brackets, you cant write $var = 'hello $name!'. even escape chars (\n, etc.) aren't resolved. 3. $_SESSION["test"] this is best practise for most cases. you can write variables inside the string, which will be substituted by their values and escape chars are resolved mfg. harry wiens -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: generate word docs
If you know what you want your word doc to look like, set it up in Word, or whatever will save a formatted rtf file (Sorry, I'm Windows/Mac based, but I presume that Open Office etc will do this on Linux). I'm not sure if I got you, but RTF as very different from native word format. RTF doesn't allow you to place images or other floating objects. I don't know if tables and borders are possible. Tabulatur sometimes can't fit your needs. I insert placeholders into the document where I want to put dynamic data I use %_varname_% to avoid any RTF conflicts. this idea really sounds great. a faster way can't hardly be found. /dorgon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] apache specific
hi folks, i know it's not really php specific, but i think, you guys are the right ones to address anyhow i've been struggling all the evening with the followsymlinks option in httpd.conf. i've already used it before and it always worked... since i installed the gentoo distro last days. i compiled an apache 2.0.47 by my own (no gentoo "ebuild") and php 5 beta (that wouldn't have influence anyhow on the symlink feature). does anybody know bugs or some hint, why it doesn't work, even the settings MUST be correct?! my httpd.conf looks like this: ...blah blah blah... Options FollowSymLinks AllowOverride None ...blah...blah... Options Indexes FollowSymLinks AllowOverride None Order allow,deny Allow from all ... as u can see, there's always the option enabled... I'm tired now gn8 /dorgon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php