[PHP-BUG] Req #63655 [NEW]: check type functions - check type operators

2012-11-30 Thread sailormax at inbox dot lv
From: sailormax at inbox dot lv
Operating system: 
PHP version:  5.3.19
Package:  Performance problem
Bug Type: Feature/Change Request
Bug description:check type functions - check type operators

Description:

Currently check type functions (is_string, is_int, is_float, is_bool,
is_object, is_array) are functions. They are very often use in many
engines. But because they are functions - they are very slow for engines.
In result engine authors have to use faster alternatives (~2x faster)
like:
is_string = ((string)$var === $var)
is_int= ((int)$var === $var)
is_float  = ((float)$var === $var)
is_bool   = ((bool)$var === $var)
is_object = ((object)$var === $var)
is_array  = ((array)$var === $var)

Can you compile this type of functions as operators?

thank you.

Test script:
---
$ts = microtime(true);
for ($i=0; $i5; $i++) $res = is_string($_GET);
var_dump(microtime(true) - $ts);
print br /br /;
$ts = microtime(true);
for ($i=0; $i5; $i++) $res = ((string)$_GET === $_GET);
var_dump(microtime(true) - $ts);
print br /br /;


Expected result:

equal time

Actual result:
--
is_string ~ 2x slower than ((string)$_GET === $_GET)

-- 
Edit bug report at https://bugs.php.net/bug.php?id=63655edit=1
-- 
Try a snapshot (PHP 5.4):   
https://bugs.php.net/fix.php?id=63655r=trysnapshot54
Try a snapshot (PHP 5.3):   
https://bugs.php.net/fix.php?id=63655r=trysnapshot53
Try a snapshot (trunk): 
https://bugs.php.net/fix.php?id=63655r=trysnapshottrunk
Fixed in SVN:   https://bugs.php.net/fix.php?id=63655r=fixed
Fixed in release:   https://bugs.php.net/fix.php?id=63655r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=63655r=needtrace
Need Reproduce Script:  https://bugs.php.net/fix.php?id=63655r=needscript
Try newer version:  https://bugs.php.net/fix.php?id=63655r=oldversion
Not developer issue:https://bugs.php.net/fix.php?id=63655r=support
Expected behavior:  https://bugs.php.net/fix.php?id=63655r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=63655r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=63655r=submittedtwice
register_globals:   https://bugs.php.net/fix.php?id=63655r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63655r=php4
Daylight Savings:   https://bugs.php.net/fix.php?id=63655r=dst
IIS Stability:  https://bugs.php.net/fix.php?id=63655r=isapi
Install GNU Sed:https://bugs.php.net/fix.php?id=63655r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=63655r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=63655r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=63655r=mysqlcfg



Bug #51458 [Com]: Lack of error context with nested exceptions

2011-01-09 Thread sailormax at inbox dot lv
Edit report at http://bugs.php.net/bug.php?id=51458edit=1

 ID: 51458
 Comment by: sailormax at inbox dot lv
 Reported by:nlgordon at gmail dot com
 Summary:Lack of error context with nested exceptions
 Status: Open
 Type:   Bug
 Package:Unknown/Other Function
 Operating System:   Redhat Linux
 PHP Version:5.3.2
 Block user comment: N
 Private report: N

 New Comment:

same problem with 5.2.x after 5.2.5;

I had calling unexist function in exception handler. In result PHP
returned empty page and didn't write any error in logs. Not very
comfortable debug scripts in such conditions... :/


Previous Comments:

[2010-04-01 23:15:54] nlgordon at gmail dot com

Description:

In short, if you thrown an exception from within the exception handler,
you get an uninformative error message with no contextual information. 
It makes sense for this case to be a fatal error.  We don't want to get
recursive throwing of exceptions and spiral to our death.



If you create an exception in the error handler without throwing it, it
has the correct info about where it was created. This is enough to
figure out where the error is coming from.  It is at least far more
informative and gives you a starting place in a potentially complex code
base.



From my quick look at the code in Zend/zend_exceptions.c:94 where this
originates.  It looks like the exception is there, and that would have
file/line num info.

Test script:
---
?php



set_exception_handler(exceptionHandler);



function exceptionHandler($excp)

{

throw new Exception(Error 2);

}



throw new Exception(Error 1);

Expected result:

Fatal Error: Error 2

Actual result:
--
Fatal error: Exception thrown without a stack frame in Unknown on line 0






-- 
Edit this bug report at http://bugs.php.net/bug.php?id=51458edit=1


Req #51116 [Bgs]: header replace Set-Cookie as similar header

2010-11-25 Thread sailormax at inbox dot lv
Edit report at http://bugs.php.net/bug.php?id=51116edit=1

 ID: 51116
 User updated by:sailormax at inbox dot lv
 Reported by:sailormax at inbox dot lv
 Summary:header replace Set-Cookie as similar header
 Status: Bogus
 Type:   Feature/Change Request
 Package:*General Issues
 Operating System:   any
 PHP Version:5.2.12
 Block user comment: N
 Private report: N

 New Comment:

I meant: Why Set-cookie: lang.name replace Set-Cookie: sessid?

Logically Set-cookie: lang.name should replace other Set-cookie:
lang.name, but not Set-Cookie: sessid. Am I wrong?


Previous Comments:

[2010-11-24 14:03:52] j...@php.net

If you don't want to replace, pass the 2nd parameter like this:



header(Set-cookie: lang.name=en;expires=Wed, 01 Jan 2020 16:59:02
GMT;path=/;,false);



The feature exists, so use it,.


[2010-02-22 17:14:47] sailormax at inbox dot lv

Description:

function header() has second parameter = replace;

it turned on by default;

in result it replace all previous Set-cookie:, including Set-cookie of
session. Why it do not look at cookie name and domain? By standard
header can contain several Set-cookie...



Yes, I can turn off replace, but for what this parameter in result? I
think for remove duplicates in header. For remove duplicates like few
Content-type:, Date:, Expires:,... and for remove duplicates in
few similar by _name, domain and path_ Set-cookie:.

Reproduce code:
---
session_start();

header(Set-cookie: lang.name=en;expires=Wed, 01 Jan 2020 16:59:02
GMT;path=/;);

Expected result:

in header:

~

Set-Cookie: sessid=efd66810c22e02211ad598d93aff7d211e7b17b7;
expires=Thu, 25 Feb 2010 16:59:02 GMT; path=/

Set-cookie: lang.name=en;expires=Wed, 01 Jan 2020 16:59:02 GMT;path=/;

~



all not duplicated cookies

Actual result:
--
in header:

~

Set-cookie: lang.name=en;expires=Wed, 01 Jan 2020 16:59:02 GMT;path=/;

~



only last cookie...






-- 
Edit this bug report at http://bugs.php.net/bug.php?id=51116edit=1


#51116 [NEW]: header replace Set-Cookie as similar header

2010-02-22 Thread sailormax at inbox dot lv
From: sailormax at inbox dot lv
Operating system: any
PHP version:  5.2.12
PHP Bug Type: Feature/Change Request
Bug description:  header replace Set-Cookie as similar header

Description:

function header() has second parameter = replace;
it turned on by default;
in result it replace all previous Set-cookie:, including Set-cookie of
session. Why it do not look at cookie name and domain? By standard header
can contain several Set-cookie...

Yes, I can turn off replace, but for what this parameter in result? I
think for remove duplicates in header. For remove duplicates like few
Content-type:, Date:, Expires:,... and for remove duplicates in few
similar by _name, domain and path_ Set-cookie:.

Reproduce code:
---
session_start();
header(Set-cookie: lang.name=en;expires=Wed, 01 Jan 2020 16:59:02
GMT;path=/;);

Expected result:

in header:
~
Set-Cookie: sessid=efd66810c22e02211ad598d93aff7d211e7b17b7; expires=Thu,
25 Feb 2010 16:59:02 GMT; path=/
Set-cookie: lang.name=en;expires=Wed, 01 Jan 2020 16:59:02 GMT;path=/;
~

all not duplicated cookies

Actual result:
--
in header:
~
Set-cookie: lang.name=en;expires=Wed, 01 Jan 2020 16:59:02 GMT;path=/;
~

only last cookie...

-- 
Edit bug report at http://bugs.php.net/?id=51116edit=1
-- 
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=51116r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=51116r=trysnapshot53
Try a snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=51116r=trysnapshot60
Fixed in SVN:
http://bugs.php.net/fix.php?id=51116r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=51116r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=51116r=alreadyfixed
Need backtrace:  
http://bugs.php.net/fix.php?id=51116r=needtrace
Need Reproduce Script:   
http://bugs.php.net/fix.php?id=51116r=needscript
Try newer version:   
http://bugs.php.net/fix.php?id=51116r=oldversion
Not developer issue: 
http://bugs.php.net/fix.php?id=51116r=support
Expected behavior:   
http://bugs.php.net/fix.php?id=51116r=notwrong
Not enough info: 
http://bugs.php.net/fix.php?id=51116r=notenoughinfo
Submitted twice: 
http://bugs.php.net/fix.php?id=51116r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=51116r=globals
PHP 4 support discontinued:  http://bugs.php.net/fix.php?id=51116r=php4
Daylight Savings:http://bugs.php.net/fix.php?id=51116r=dst
IIS Stability:   
http://bugs.php.net/fix.php?id=51116r=isapi
Install GNU Sed: 
http://bugs.php.net/fix.php?id=51116r=gnused
Floating point limitations:  
http://bugs.php.net/fix.php?id=51116r=float
No Zend Extensions:  
http://bugs.php.net/fix.php?id=51116r=nozend
MySQL Configuration Error:   
http://bugs.php.net/fix.php?id=51116r=mysqlcfg



#26771 [Com]: register_tick_funtions crash under threaded webservers

2007-01-24 Thread sailormax at inbox dot lv
 ID:   26771
 Comment by:   sailormax at inbox dot lv
 Reported By:  info at tphnet dot com
 Status:   Suspended
 Bug Type: *General Issues
 Operating System: * (ZTS only!)
 PHP Version:  6CVS, 5CVS, 4CVS
 Assigned To:  rasmus
 New Comment:

-- 3 years later --

PHP 5.2.0 (Apache2 handler)
Apache 2.2.3

problem still here...
and broken example (16-3) in help without any marks still here :)
http://lv.php.net/manual/en/control-structures.declare.php


Previous Comments:


[2006-07-04 16:10:07] astronouth7303 at gmail dot com

I've seen this bug on my set up as well.

PHP 5.0.5 (Apache2 handler)
Apache 2.0.55
Windows XP Pro v2002 SP2 (Windows NT 5.1 build 2600)

The way I've figured it out is that if the tick function (registered by
register_tick_function()) is called (N ticks have gone by), PHP/Apache
crash.

I'm not sure if this applies to everyone, but I also found that the
Apache child process would not fully initialize after crashing. The new
child process had to be killed manually, and the next child would finish
initialization.



[2006-04-18 20:10:49] motin at demomusic dot nu

Noticed typo: Of course I meant 83 instead of 85. Also, too bad the
post got screwed up, with doubled linebreaks in the example.



[2006-04-18 19:58:56] motin at demomusic dot nu

I do not have the skills to dig into the appropriate code,
unfortunately. 

Possible workarounds:

1. Switch to Linux :) - If not wholly, do it by installing the free
VMWare GSX Server and build up a server in there. Recommended because
learning how to configure a Linux server is a great skill that all
php-developers will gain on learning. 

2. PHP in cgi-mode is not affected, only php when running as an
apache_module. I wanted to use ticks only for debugging purposes, and
what I did while on windows was to configure httpd.conf so that
accessing my site on port 85 would run php in cgi-mode instead of as a
module. 

Here is a simplified section of my httpd.conf for this:

# Make sure no modules are loaded before VirtualHost-containers

Listen 80

VirtualHost *:80


 LoadFile /Dev/Server/php5/php5apache2.dll

 LoadModule php5_module /Dev/Server/php5/php5apache2.dll

 AddType application/x-httpd-php .php


 DocumentRoot /path

 ServerName localhost

IfModule mod_php5.c

 php_admin_value display_errors 0

 php_admin_value error_reporting 7

/IfModule


/VirtualHost



Listen 83


VirtualHost *:83

 RemoveType .php 

 Action php5-script /php/php-cgi.exe

 AddHandler php5-script .php


 DocumentRoot /path

 ServerName localhost


 # php_admin_value and php_value is not possible in cgi-mode. These
values has to be entered in php.ini

 # This section I found when trying to configure this myself back then.
Do not know if it is needed
 # Directory /path/to/php/

 #  Options +ExecCGI +FollowSymLinks

 #  AllowOverride None

 #  Order allow,deny

 #  Allow from all

 # /Directory



/VirtualHost



Cheers!



[2005-08-10 20:02:22] [EMAIL PROTECTED]

You are probably right that the tick stuff is broken in ZTS mode.  But
I doubt anybody is all that interested in fixing it as it is a very
fringe feature in a very fringe environment.  You can always hope, but
chances are you will need to dig into the code yourself and send us a
patch to get any movement on this.



[2004-01-02 19:23:33] info at tphnet dot com

Description:

While searching the bug database I found some similar problems, but all
were suspended. I wasn't sure if it was useful to reply to one of those
(Most recent one: http://bugs.php.net/bug.php?id=26286). Well anyways,
here goes:

The problem is very simple. I just copy and paste the 'tick' example
from the php manual into a new php file an try to execute it on my
apache2 server.
The apache child process crashes, restarts, crashes, restarts and
eventually just stops restarting. When I comment out the line
'register_tick_function', everyting works just fine.
Also, when I start the file from the CLI version of PHP it is executed
without any problems.

I'm using PHP 4.3.4 and Apache 2.0.48 (in conjunction with
php4apache2.dll).

Reproduce code:
---
http://nl.php.net/manual/en/control-structures.declare.php

See Example 11-1

Actual result:
--
[Sat Jan 03 01:11:04 2004] [notice] Parent: child process exited with
status 3221225477 -- Restarting.
[Sat Jan 03 01:11:04 2004] [notice] Parent: Created child process 3036
[Sat Jan 03 01:11:04 2004] [notice] Child 3036: Child process is
running
[Sat Jan 03 01:11:04 2004] [notice] Child 3036: Acquired the start
mutex.
[Sat Jan 03 01:11:04 2004] [notice] Child 3036: Starting 250

#39614 [NEW]: assignment reference returned by function

2006-11-24 Thread sailormax at inbox dot lv
From: sailormax at inbox dot lv
Operating system: any
PHP version:  5.2.0
PHP Bug Type: Scripting Engine problem
Bug description:  assignment reference returned by function

Description:

PHP 4.x.x, returned value by reference, assign to variable reference. But
5.x.x assign copy of value...

Reproduce code:
---
function ret_ref($arr)
{
return $arr;
}

$arr = array(11, 222, );
$test = ret_ref($arr);
$test[] = 44;
print_r($arr);


Expected result:

Array ( [0] = 11 [1] = 222 [2] =  [3] = 44 )

Actual result:
--
Array ( [0] = 11 [1] = 222 [2] =  )

-- 
Edit bug report at http://bugs.php.net/?id=39614edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=39614r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=39614r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=39614r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=39614r=fixedcvs
Fixed in release: 
http://bugs.php.net/fix.php?id=39614r=alreadyfixed
Need backtrace:   http://bugs.php.net/fix.php?id=39614r=needtrace
Need Reproduce Script:http://bugs.php.net/fix.php?id=39614r=needscript
Try newer version:http://bugs.php.net/fix.php?id=39614r=oldversion
Not developer issue:  http://bugs.php.net/fix.php?id=39614r=support
Expected behavior:http://bugs.php.net/fix.php?id=39614r=notwrong
Not enough info:  
http://bugs.php.net/fix.php?id=39614r=notenoughinfo
Submitted twice:  
http://bugs.php.net/fix.php?id=39614r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=39614r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=39614r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=39614r=dst
IIS Stability:http://bugs.php.net/fix.php?id=39614r=isapi
Install GNU Sed:  http://bugs.php.net/fix.php?id=39614r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=39614r=float
No Zend Extensions:   http://bugs.php.net/fix.php?id=39614r=nozend
MySQL Configuration Error:http://bugs.php.net/fix.php?id=39614r=mysqlcfg


#39397 [NEW]: invalid statement handle in Unknown on line 0

2006-11-06 Thread sailormax at inbox dot lv
From: sailormax at inbox dot lv
Operating system: Win32 / Linux
PHP version:  5.2.0
PHP Bug Type: InterBase related
Bug description:  invalid statement handle in Unknown on line 0

Description:

PHP output warning:
Warning: Unknown: invalid statement handle in Unknown on line 0

if don't use connection_id as parameter for function ibase_close()

Firebird 2.0 Release Candidate

Reproduce code:
---
?
ibase_connect(localhost:D:\\test.gdb, SYSDBA, masterkey);
$prep = ibase_prepare(SELECT * FROM TB_TEST);
$res = ibase_execute($prep);
while ($row = ibase_fetch_row($res))
{
print_r($row);
print br /;
}
ibase_close();
?

Expected result:

output list of data in table

Actual result:
--
output list of data in table
and
Warning: Unknown: invalid statement handle in Unknown on line 0

-- 
Edit bug report at http://bugs.php.net/?id=39397edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=39397r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=39397r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=39397r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=39397r=fixedcvs
Fixed in release: 
http://bugs.php.net/fix.php?id=39397r=alreadyfixed
Need backtrace:   http://bugs.php.net/fix.php?id=39397r=needtrace
Need Reproduce Script:http://bugs.php.net/fix.php?id=39397r=needscript
Try newer version:http://bugs.php.net/fix.php?id=39397r=oldversion
Not developer issue:  http://bugs.php.net/fix.php?id=39397r=support
Expected behavior:http://bugs.php.net/fix.php?id=39397r=notwrong
Not enough info:  
http://bugs.php.net/fix.php?id=39397r=notenoughinfo
Submitted twice:  
http://bugs.php.net/fix.php?id=39397r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=39397r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=39397r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=39397r=dst
IIS Stability:http://bugs.php.net/fix.php?id=39397r=isapi
Install GNU Sed:  http://bugs.php.net/fix.php?id=39397r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=39397r=float
No Zend Extensions:   http://bugs.php.net/fix.php?id=39397r=nozend
MySQL Configuration Error:http://bugs.php.net/fix.php?id=39397r=mysqlcfg


#39130 [Com]: Compile failure with the compiler of VC++ 2005

2006-11-04 Thread sailormax at inbox dot lv
 ID:   39130
 Comment by:   sailormax at inbox dot lv
 Reported By:  ben dot yan at msn dot com
 Status:   Assigned
 Bug Type: Compile Failure
 Operating System: Windows
 PHP Version:  5.2.0RC5
 Assigned To:  wez
 New Comment:

I have same error while trying compile my module. With previous PHP all
was fine.
With 5.2.0 all fine too, if comment 2 lines at config.w32.h:
#define _USE_32BIT_TIME_T 1
#define HAVE_STDLIB_H 1

used VC++ 2005 Express Edition


Previous Comments:


[2006-10-12 11:19:20] [EMAIL PROTECTED]

I've seen this before; I think have the fix on a company laptop that is
currently occupied and I'll commit it just as soon as I can get access
to it again.



[2006-10-12 08:28:29] [EMAIL PROTECTED]

Wez, you added those lines for VC++ 2005 compability. Could you have a
look?



[2006-10-11 18:29:43] ben dot yan at msn dot com

Description:

Compile with VS.NET 2005

c:\program files\microsoft visual studio 8\vc\include\sys\stat.inl(44)
: error C2466: cannot allocate an array of constant size 0
c:\program files\microsoft visual studio 8\vc\include\sys\stat.inl(49)
: error C2466: cannot allocate an array of constant size 0
c:\program files\microsoft visual studio 8\vc\include\sys\utime.inl(39)
: error C2466: cannot allocate an array of constant size 0
c:\program files\microsoft visual studio 8\vc\include\sys\utime.inl(44)
: error C2466: cannot allocate an array of constant size 0
c:\program files\microsoft visual studio 8\vc\include\sys\utime.inl(49)
: error C2466: cannot allocate an array of constant size 0
c:\program files\microsoft visual studio 8\vc\include\sys\utime.inl(78)
: error C2466: cannot allocate an array of constant size 0


Reproduce code:
---
look the zend.h :

...

#include stdio.h

/*
 * general definitions
 */

#ifdef ZEND_WIN32
# include zend_config.w32.h
# define ZEND_PATHS_SEPARATOR   ';'
#elif defined(XXX)
...
#endif


Expected result:

Look the line 151 at the ../main/config.w32.h:

/* vs.net 2005 has a 64-bit time_t.  This will likely break
 * 3rdParty libs that were built with older compilers; switch
 * back to 32-bit */
#define _USE_32BIT_TIME_T 1
#define HAVE_STDLIB_H 1


so the config.w32.h should be included first. But it isn't so in the
zend.h:

#include stdio.h

/*
 * general definitions
 */

#ifdef ZEND_WIN32
# include zend_config.w32.h
# define ZEND_PATHS_SEPARATOR   ';'
#elif defined(XXX)
...
#endif


This would induce the compile error. and if 

#include stdio.h

BEHIND the 

#ifdef ZEND_WIN32
# include zend_config.w32.h
# define ZEND_PATHS_SEPARATOR   ';'
#elif defined(XXX)
...
#endif

,it will be ok.

Actual result:
--
error C2466: cannot allocate an array of constant size 0





-- 
Edit this bug report at http://bugs.php.net/?id=39130edit=1