#23385 [NEW]: Problem with object assignment and the :: operator in a function.
| From: | jon at lightsky dot com | Date: | Mon, 28 Apr 2003 17:11:45 +0000 |
| Subject: | #23385 [NEW]: Problem with object assignment and the :: operator in a function. | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-38629@lists.php.net to get a copy of this message | ||
From: jon at lightsky dot com
Operating system: linux
PHP version: 4.3.1
PHP Bug Type: Scripting Engine problem
Bug description: Problem with object assignment and the :: operator in a function.
I am having trouble assigning new objects returned from a method called
with the :: operator.
Here is the code that I am running.
// PEAR mail object
require_once ('Mail.php');
require_once ('Mail/sendmail.php');
// the function that i am running
function send_notification ($intraval) {
// Create the mail object using the Mail::factory method for send mail
$params['sendmail_path']='/usr/lib/sendmail';
echo 'Test 1 ' . (Mail::factory('sendmail',$params));
echo '<br >Test 2 ' . ($bla = Mail::factory('sendmail',$params));
echo '<br >Test 3 ' . ($bla);
echo '<br>Test 4 ' . $GLOBALS['bla'];
// try creating the obj without the :: operator
$send_mail = new Mail_sendmail ($params);
echo '<br >Test 5 ' . $send_mail;
}
// attempt to run my function
send_notification (1);
It outputs This:
Test 1 Object
Test 2 Object
Test 3
Test 4
Test 5 Object
You can see that when I echo the results returned from the Mail::factory
method in test 1 and 2 I get an object. However, when I attempt to echo
the variable assigned from Mail::factory--tests 3 and 4--i get nothing.
In test 5 i created an object using 'new' and it is assigned just fine.
I don't know if this is really a bug but I don't know at this point what
else it could be.
Complied Modules:
'./configure' '--with-gd' '--with-pgsql=/usr/local/pgsql/'
'--with-ldap'
'--prefix=/usr/local/apache/php' '--with-apxs=/usr/local/apache/bin/apxs'
'--with-zlib-dir=/usr/lib' '--with-config-file=/usr/local/apache/lib/'
On a side note I was searching for bugs with '::' and the search removed
'::' from my search. I don't know if it is possible to allow '::' as a
search string but it was quite a bit harder to find similar bugs when the
main condition I was trying to match was removed
--
Edit bug report at http://bugs.php.net/?id=23385&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=23385&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=23385&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=23385&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=23385&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=23385&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=23385&r=support
Expected behavior: http://bugs.php.net/fix.php?id=23385&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=23385&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=23385&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=23385&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=23385&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=23385&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=23385&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=23385&r=gnused