[PHP-DEV] Call to a member function on a non-object in

2002-12-14 Thread electroteque
Hi i am getting either this error or  Call to undefined function: _encrypt()
within my class script , it has been working previously until i compiled the
latest cvs, i am referecing my functions like so $this-_encrypt(); within
other functions , what seems to be the problem ??



-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DEV] Re: Call to a member function on a non-object in

2002-12-14 Thread electroteque
never mind after a headache 24hrs , i have worked out someone has added
_encrypt as a php function which is why it was somehow buggering my script
up , i changed it back to _crypt and it is fine now.

Electroteque [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi i am getting either this error or  Call to undefined function:
_encrypt()
 within my class script , it has been working previously until i compiled
the
 latest cvs, i am referecing my functions like so $this-_encrypt(); within
 other functions , what seems to be the problem ??





-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DEV] PHP 4 Bug Summary Report

2002-12-14 Thread php-dev
 PHP 4 Bug Database summary - http://bugs.php.net

 Num Status Summary (1031 total including feature requests)
===[*Configuration Issues]
13561 Assigned   --without-pear prevent install of php-config,phpize,...
19282 Won't fix  Place php4ts.dll into \sapi
20490 Analyzed   enable versioning not supported on OSX
20689 Won\'t fix  php_admin_value disable_functions not working as it should
===[*General Issues]==
20195 Open   make install doesnt set permissions
20604 Feedback   PHP CLI exists always with Segmantation Fault
20775 Open   Silent install (/s) does not work
20806 Feedback   display of rows in browse incorrect due to field names
20849 Feedback   POST data submitted by UNIX Netscape 4+ (Mozilla 1+) won't fill 
*_POST array
20896 Verified   php -w hangs indefinitely at 100% CPU
20946 Suspended  php_ingres.dll missing in the php 4 zip!!!
===[*Graphics related]
21010 Open   typo in tag name and some identifiers
===[*Languages/Translation]===
11975 Won't fix  mix of hebrew  english
13014 Won't fix  hebrevc ()
20166 Open   Unicode (Slovenian) characters are not displayed correctly
===[*Network Functions]===
15639 Suspended  detecting end of UDP packets
===[*URL Functions]===
20989 Feedback   URL variable without = affects other URL variable
===[Apache related]===
14409 Open   request for nonexistent file does not return 404 error
15529 Open   ap_cleanup_for_exec not used when creating
17837 Won't fix  PHP 'handles' permission problems rather than letting Apache do it
19113 Feedback   HTTP status 200 returned on HTTP CONNECT when mod_proxy not in use
19292 Critical   random error: open_basedir restriction in effect. File is in wrong 
directory
20104 Feedback   unhandled exception with multiple requests
20190 Critical   Random mem corruption: zend_get_executed_filename() mismatch
20551 Open   Output compression causes segfaults (ob_gzhandler)
20643 Feedback   long POST fields get truncated
20665 Feedback   Memory leaks on SIGHUP
20986 Open   PHP causes Apache to leak semaphores
===[Apache2 related]==
17098 Analyzed   apache sending 304 - not modified header
17414 Open   Segfaults on restart
17566 Feedback   phpinfo() causes load of 2+
17868 Verified   Doesn't work two and more !--include-- directives of PHP code on 
different OS
18648 Feedback   Single entry form POST gives incorrect variable content
18957 Won't fix   multiple definitions
19739 Feedback   php-4.2.3 fails to Install with Apache 2.0.42 on AIX 5.1 ML2
19787 Won\'t fix  Can not load module
19918 Open   no libphp4.so produced
20569 Feedback   Apache fails when restarting
20910 Open   Default for AcceptPathInfo changed
20929 Open   Problem in handling big5 characters from HTML form
20954 Feedback   Serious problem , unknown reason
===[Arrays related]===
18829 Won\'t fix  array_pop, array_shift, array_push... functions very slow with large 
arrays
20251 Won\'t fix  Can't assign values to array in loop.
===[BC math related]==
13551 Open   BC functions apply decimal places argument also on arguments
===[CCVS related]=
10447 Won\'t fix  ccvs_*() functions segfault when given invalid session ID
===[Class/Object related]=
15675 Suspended  get_class() returns only lower chars
17637 Analyzed   constructors in classes (Back to PHP3)
20520 Feedback   Nonsymetric data syncronization with references
20531 Open   Object property association broken
20676 Verified   Reinitialization of a reference
===[COM related]==
15771 Suspended  cannot pass value to image field by ado
16375 Suspended  Feature: Support for VARIANT multi dimensional arrays
19150 Open   Overloaded COM Property Set Leaks Memory
20100 Open   Com Performance/Memory issues
20282 Open   COM memory leak
===[Compile Failure]==
1298 Verified   need to use -taso with Netscape LDAP libs
7643 Open   APXS compile fails with not a DSO
10108 Open   cc 1501:218 file XXX contains an incorrect file suffix
14245 Verified   make install fails on apxs
17820 Won't fix  php.ini-dist not copied
18358 Won't fix  Recode doesn't compile with apache2
19555 Feedback   GNU pthreads issue?
19973 Open   compile zlib and pcre as shared fails
20444 Won\'t fix  Various compile warnings 

[PHP-DEV] uniqid

2002-12-14 Thread Marcus Börger
First: Uniqid test (tests/strings/001.phpt) failes for cygwin because
the time for gettimeofday() is only updated once per second.
I suggest we should change the test to use more entropy.

Second: We should consider more entropy being default even though
it is slower.

Third: the function is available even when HAVE_GETTIMEOFDAY
is not available. This should be changed (is on out todo) or the function
should return a unique value for such platforms, too.

Fourth: We should split ./tests/strings/001.phpt. One for the string
functions and one for uniqid().

marcus


--
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DEV] Re: Call to a member function on a non-object in

2002-12-14 Thread electroteque
this is strange i now get the same error for _crypt but it bypassed it
before, is this a bug ?
Electroteque [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 never mind after a headache 24hrs , i have worked out someone has added
 _encrypt as a php function which is why it was somehow buggering my script
 up , i changed it back to _crypt and it is fine now.

 Electroteque [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Hi i am getting either this error or  Call to undefined function:
 _encrypt()
  within my class script , it has been working previously until i compiled
 the
  latest cvs, i am referecing my functions like so $this-_encrypt();
within
  other functions , what seems to be the problem ??
 
 





-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DEV] is_callable documentation

2002-12-14 Thread Rick Widmer

I just submitted documentation for the is_callable function.  I _think_ is 
correct, but someone who knows more about it than I might want to look it 
over.  It should appear soon in the user notes at:

   http://www.php.net/manual/en/function.is-callable.php


Rick

Thanks to Andrei Zmievski and leon at leonatkinson.com for the 
information I found in the archives on the function.


--
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DEV] downgrade undefined function from fatal error

2002-12-14 Thread John Coggeshall

There is absolutely no reason why you cannot simply include your
functions in your scripts. If you are really lazy, you can even
auto_prepend an include file.

John


-Original Message-
From: Dave [Hawk-Systems] [mailto:[EMAIL PROTECTED]] 
Sent: Friday, December 13, 2002 8:56 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DEV] downgrade undefined function from fatal error


reviewed and did a couple of searches on this prior to signing 
up to this particular list...

Is this a reasonable consideration for changes to PHP's 
handling of undefined functions?

Currently, calling a previously undefined function generates 
an E_ERROR, and halts the script as a cirtical failure meaning 
we can't handle the error as we do others (this is clearly documented).

What I am not clear on is why an undefined function should 
necessarily be a fatal error with no change to code the script 
to handle the error.  For example

?php
function eh($type, $msg, $file, $line, $context){
   # code to parse $msg for 
/undefined\040function:\040(.*)\(\)/,$match
   # check specified directory for the function:
   # include the file if exists (./functions/$match[1].php)
   # try to resume
   # if we can't find it, halt with die()
}

error_reporting(0);
set_error_handler(eh);

undefined_function();
?

This would seem much more intuitive, and allow collection of 
massive amounts of sharable and accessible functions to be 
contained in shared directories, and not have to worry about 
identifying them all at the head of all pages, or including 
functionsthat would not be required.

Currently as a workaround we are using the following logic;

?PHP
function func($f_name){
   if(!function_exists($f_name)){
   # function doesn't exists, needs to be included
   require('/path/to/functions/'.$f_name.'.php');
   }else{
   # function already exists, no action required
   }
   return $f_name;
}

$database=call_user_func(func('DatabaseConnect'),'var1','var2');
?

But this results in code that isn't quite as intuitive.

Thoughts? Comments? You are nuts?

Dave



-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] downgrade undefined function from fatal error

2002-12-14 Thread Ivan Ristic
John Coggeshall wrote:

There is absolutely no reason why you cannot simply include your
functions in your scripts


  Erm, to avoid manual work? There is no reason whatsoever
  to include files manually.

  Right now you must pre-load every single
  class you intend to use in the application. This may or
  may not be a problem, depending on the size of the application,
  since the engine must parse hundreds of KB of code. I use classes
  for everything and I would prefer to have one file per class,
  and to load classes on demand. Makes maintenance much easier.

  The patch for this is trivial. It was made a while ago and
  it seems that it still works (just tried it with 4.2.3)

http://www.webkreator.com/php/configuration/automatic-php-class-loading.html

--
Ivan Ristic, http://www.webkreator.com


--
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DEV] $php_errormsg not populated

2002-12-14 Thread Ivan Ristic

I have noticed that $php_errormsg is not populated
for all types of errors. The code below is from main/main.c.
Do you think that we can safely switch places for parts one
and two? If we do $php_errormsg will be populated before
bailing out, and this inconsistency will be sorted.

-- pt 1 --

/* Bail out if we can't recover */
switch (type) {
case E_CORE_ERROR:
if(!module_initialized) {
/* bad error in module startup - no way we can live 
with this */
exit(-2);
}
/* no break - intentionally */
case E_ERROR:
/*case E_PARSE: the parser would return 1 (failure), we can 
bail out nicely */
case E_COMPILE_ERROR:
case E_USER_ERROR:
if (module_initialized) {
zend_bailout();
return;
}
break;
}

-- pt 2 ---

   /* Log if necessary */
if (PG(track_errors)  EG(active_symbol_table)) {
pval *tmp;

ALLOC_ZVAL(tmp);
INIT_PZVAL(tmp);
Z_STRVAL_P(tmp) = (char *) estrndup(buffer, buffer_len);
Z_STRLEN_P(tmp) = buffer_len;
Z_TYPE_P(tmp) = IS_STRING;
zend_hash_update(EG(active_symbol_table), php_errormsg, 
sizeof(php_errormsg), (void **)  tmp, si
}

---

--
Ivan Ristic, http://www.webkreator.com


--
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Re: #20993 [Ver]: Element value changeswithoutasking

2002-12-14 Thread Moriyoshi Koizumi
Oops, the patch was wrong as the runtime occationally segfaults
in a case like:

?php
  $a = 0;
  $a = $a; /* is_ref=1, refcount=1 */
?

Attached is the revised patch. Please try it out.

And the result of a tiny benchmark follows:

[Before patching]
1: 0.263245
2: 0.142505
3: 0.328045
4: 0.137149

[After patching]
1: 0.273811
2: 0.141965
3: 0.699429
4: 0.137010

Moriyoshi

 My proposal, was based on 2 things: fix or document. I'm sure Zeev/Andi had a
 good reason not to always separate, and that probably is performance.
 
 IF this impacts overall performance very negatively, then maybe the better
 choice is to document it.
 
 I'll try the patch though.
 
 
 With kind regards,
 
 Melvyn Sopacua
 ?php include(not_reflecting_employers_views.txt); ?
 
 
 -- 
 PHP Development Mailing List http://www.php.net/
 To unsubscribe, visit: http://www.php.net/unsub.php
 

Index: zend_execute.c
===
RCS file: /repository/Zend/zend_execute.c,v
retrieving revision 1.316.2.2
diff -u -r1.316.2.2 zend_execute.c
--- zend_execute.c  17 Nov 2002 22:00:32 -  1.316.2.2
+++ zend_execute.c  15 Dec 2002 06:47:03 -
@@ -65,6 +65,7 @@
 static void zend_extension_statement_handler(zend_extension *extension, zend_op_array 
*op_array TSRMLS_DC);
 static void zend_extension_fcall_begin_handler(zend_extension *extension, 
zend_op_array *op_array TSRMLS_DC);
 static void zend_extension_fcall_end_handler(zend_extension *extension, zend_op_array 
*op_array TSRMLS_DC);
+static int _zval_array_disref(zval **ppz);
 
 #define RETURN_VALUE_USED(opline) (!((opline)-result.u.EA.type  EXT_TYPE_UNUSED))
 
@@ -1816,6 +1817,7 @@
} else if (PZVAL_IS_REF(*param)) {

zend_assign_to_variable_reference(NULL, get_zval_ptr_ptr(EX(opline)-result, EX(Ts), 
BP_VAR_W), param, NULL TSRMLS_CC);
} else {
+   _zval_array_disref(param);
zend_assign_to_variable(NULL, 
EX(opline)-result, NULL, *param, IS_VAR, EX(Ts) TSRMLS_CC);
}
}
@@ -2480,4 +2482,59 @@
}
}
zend_error(E_ERROR, Arrived at end of main loop which shouldn't happen);
+}
+
+static int _zval_ref_check(zval **p, void *flag)
+{
+   if ((*p)-is_ref) {
+   *(int *)flag = 1;
+   }
+   _zval_array_disref(p);
+   return ZEND_HASH_APPLY_KEEP;
+}
+
+static void zval_dis_ref(zval **p)
+{
+   if ((*p)-is_ref) {
+   zval *newzv;
+   ALLOC_ZVAL(newzv);
+   *newzv = **p;
+   zval_copy_ctor(newzv);
+   newzv-refcount = 1;
+   newzv-is_ref = 0;
+
+   if ((*p)-refcount  1) {
+   zval_dtor((*p));
+   FREE_ZVAL(*p);
+   }
+
+   *p = newzv;
+   } else {
+   ((*p))-refcount++;
+   }
+}
+
+static int _zval_array_disref(zval **ppz)
+{
+   TSRMLS_FETCH();
+   if ((*ppz)-type == IS_ARRAY) {
+   int flag = 0;
+   if ((*ppz)-value.ht == EG(symbol_table)) {
+   return SUCCESS;
+   }
+   zend_hash_apply_with_argument((*ppz)-value.ht, (apply_func_arg_t) 
+_zval_ref_check, (void *)flag TSRMLS_CC);
+   if (flag) {
+   zval *newzv, *tmp;
+   ALLOC_ZVAL(newzv);
+   *newzv = **ppz;
+   ALLOC_HASHTABLE(newzv-value.ht);
+   zend_hash_init(newzv-value.ht, 0, NULL, ZVAL_PTR_DTOR, 0);
+   zend_hash_copy(newzv-value.ht, Z_ARRVAL_PP(ppz), 
+(copy_ctor_func_t) zval_dis_ref, (void *) tmp, sizeof(zval *));
+   zval_ptr_dtor(ppz);
+   *ppz = newzv;
+   newzv-is_ref = 0;
+   newzv-refcount = 1;
+   }
+   } 
+   return SUCCESS;
 }

?php
function timediff($ts, $te) {
list($ts_usec, $ts_sec) = explode(' ', $ts);
list($te_usec, $te_sec) = explode(' ', $te);
return ((float)$te_usec - (float)$ts_usec) + (float)( (int)$te_sec - 
(int)$ts_sec );
}

function test1( $ary ) {
$ary[32048] = '3';
}

function test2( $ary ) {
$ary[32048] = '3';
}

for ($i=0; $i10; ++$i) { 
$ary_org[$i] = str_repeat(\\, rand( 0, 12 )).sprintf(%08x, 
rand(-1,0x7fff));
} 

for ($i=0; $i10; ++$i) { 
$ary_ref[$i] = $ary_ref[$i];
} 

$ts = microtime();
$ary = $ary_org;
test1($ary);
$te = microtime();
printf(1: %f\n, timediff($ts, $te));

$ts =