php-general Digest 5 Jun 2012 15:29:29 -0000 Issue 7842

Topics (messages 318156 through 318167):

zend_auto_global_disable_jit missing in PHP 5.4.5
        318156 by: freeone3000
        318166 by: Daniel Brown
        318167 by: Matijn Woudt

Re: long running php script won't complete :(
        318157 by: rene7705

Re: disabled cookies
        318158 by: Lester Caine

Re: 0.0.0.0 & iplong()
        318159 by: jas
        318160 by: Matijn Woudt
        318161 by: jas
        318162 by: Chris Knipe
        318165 by: Matijn Woudt

Which workstation????
        318163 by: Farzan Dalaee
        318164 by: Simon Schick

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
I'm working with a third-party PHP extension that makes a call to
zend_auto_global_disable_jit. However, in PHP5.4.5, there is no
zend_auto_global_disable_jit available, nor is it in its traditional
header. Commenting out all zend_auto_global_disable_jit calls causes
PHP to no longer recognize it as a valid extension, while leaving them
in attempts for an invalid method to be called.

The file in question is
https://github.com/mtorromeo/runkit/blob/master/runkit.c line 305. As
is relatively obvious, it's not part of a macro, and its removal
should not affect whether the library is a PHP extension or not -
perhaps it's based on PHP's static analysis? If it doesn't call the
function, it would access a global, possibly before the global has
been JIT initialized by the runtime. If this is the case, what is the
replacement function for PHP 5.4.5?

-- 
James Moore

--- End Message ---
--- Begin Message ---
On Mon, Jun 4, 2012 at 11:30 PM, freeone3000 <freeone3...@gmail.com> wrote:
> I'm working with a third-party PHP extension that makes a call to
> zend_auto_global_disable_jit. However, in PHP5.4.5, there is no
> zend_auto_global_disable_jit available, nor is it in its traditional
> header. Commenting out all zend_auto_global_disable_jit calls causes
> PHP to no longer recognize it as a valid extension, while leaving them
> in attempts for an invalid method to be called.
>
> The file in question is
> https://github.com/mtorromeo/runkit/blob/master/runkit.c line 305. As
> is relatively obvious, it's not part of a macro, and its removal
> should not affect whether the library is a PHP extension or not -
> perhaps it's based on PHP's static analysis? If it doesn't call the
> function, it would access a global, possibly before the global has
> been JIT initialized by the runtime. If this is the case, what is the
> replacement function for PHP 5.4.5?

    This is something you're going to want to ask on the Internals
list (CC'd).  General is more for questions on using the language.

-- 
</Daniel P. Brown>
Network Infrastructure Manager
http://www.php.net/

--- End Message ---
--- Begin Message ---
On Tue, Jun 5, 2012 at 4:39 AM, freeone3000 <freeone3...@gmail.com> wrote:
> I'm working with a third-party PHP extension that makes a call to
> zend_auto_global_disable_jit. However, in PHP5.4.5, there is no
> zend_auto_global_disable_jit available, nor is it in its traditional
> header. Commenting out all zend_auto_global_disable_jit calls causes
> PHP to no longer recognize it as a valid extension, while leaving them
> in attempts for an invalid method to be called.
>
> The file in question is
> https://github.com/mtorromeo/runkit/blob/master/runkit.c line 305. As
> is relatively obvious, it's not part of a macro, and its removal
> should not affect whether the library is a PHP extension or not -
> perhaps it's based on PHP's static analysis? If it doesn't call the
> function, it would access a global, possibly before the global has
> been JIT initialized by the runtime. If this is the case, what is the
> replacement function for PHP 5.4.5?
>
> --
> James Moore
>

There's a bug report about it at [1], though there's no solution there.

- Matijn

[1] https://bugs.php.net/bug.php?id=61189

--- End Message ---
--- Begin Message ---
On Mon, Jun 4, 2012 at 6:52 PM, Matijn Woudt <tijn...@gmail.com> wrote:
> On Mon, Jun 4, 2012 at 5:57 PM, rene7705 <rene7...@gmail.com> wrote:
>> Hi.
>>
>> I've got a piece of code that builds up a multi-meg test array for my
>> opensourced http://mediabeez.ws/products/htmlMicroscope var_dump()
>> improvement, and when I run it for longer than about 20 minutes, the
>> browser just calls it quits.. :( Firefox, and chrome.
>>
>> I'd like to do this with a browser call, if all else fails I suppose I
>> can run the generation of the test array from the commandline, but I
>> prefer calling from the browser..
>>
>> So, I'm doing ob_start(), then start the main loop which does echo
>> '.'; ob_flush(); flush();.
>>
>> I've got my KeepAliveTime set to 25 seconds, as per
>> http://www.pctools.com/guides/registry/detail/891/
>>
>> And I'm calling this from my browser to the domain name that points
>> back to the machine I run the browser on, latest wampserver on windows
>> 7.
>> Calling via localhost doesn't work somehow.
>>
>> Is there anything obvious I've missed?
>>
>
> Just to be sure, have you checked the Apache error logs for anything
> obvious? (eg. out of memory?)
> In case the browser closes the connection, you could use
> ignore_user_abort [1] to be sure the script continues, though the
> browser won't receive the result.
>
> - Matijn
>
> [1] www.php.net/manual/en/function.ignore-user-abort.php

ignore_user_abort(true) together with set_time_limit(0) is doing the
job nicely atm. thanks!

--- End Message ---
--- Begin Message ---
Matijn Woudt wrote:
Yeah, it's been such a pain, as nobody over here is quite sure how the
>  hell it'll be enforced either, or if it even will be. It's also pretty
>  vague as to just where the line gets drawn. The official government
>  sites on this are pretty black and white, but don't clearly address the
>  grey areas. I think this is definitely a case of the persons making the
>  laws don't understand the technology involved, which sadly seems to be
>  the case across a lot of tech laws being passed world-wide of late:(
>
Yep,  When this law was discussed, they were mostly talking about
completely banning cookies. Only later they figured out that there are
quite a few sites that can't live without cookies...

Cookies for shopping baskets got flagged up early on and then people started to realise that there were more good reasons for using the than bad ;) The main 'grey' area is a session cookie which classified along with shopping basket ones - which don't need specific permission - but then we are told we should still ask? But we don't need to ask about shopping basket ones!

--
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

--- End Message ---
--- Begin Message ---
On 06/04/2012 12:48 PM, Matijn Woudt wrote:
On Mon, Jun 4, 2012 at 8:38 PM, jas<jason.ger...@gmail.com>  wrote:
On 06/04/2012 11:33 AM, Matijn Woudt wrote:

On Mon, Jun 4, 2012 at 6:54 PM, jas<jason.ger...@gmail.com>    wrote:

Not sure if this is a bug or not...

I have run into an error when performing a conditional using iplong() and
the ~ bitwise operator

$ip = '0.0.0.0';
$mask = '24';

$end = (ip2long($ip) || (~ip2long($mask))) + 1;

PHP Fatal error:  Unsupported operand types

I even tried to typecast the mask to (int)


The error is probably not where you suspect it to be. ip2long will
return false for ip2long($mask), because $mask is not a valid IP
address. The ~ operator is not supported for false.

- Matijn


Strange... this works

$ip = '10.0.2.0';
$mask = '24';

Anything using 0.0.0.0 fails using the bitmask to calculate valid CIDR
ranges.


Yes, because with $ip being 0.0.0.0, the result of ip2long($ip) will
be zero. Zero evaluates to false when PHP is going to parse the ||
operator, and because of that, it continues to parse the rest.
When the result of ip2long($ip) is greater that zero, in case of some
other valid IP, it will evaluate to true and PHP will not even execute
the rest after the || because the result will be true anyway.
Did you mean to use a single | operator, as a bitwise OR?

- Matijn

With any ACL rule using iptables, hosts.allow/hosts.deny, routers where 0.0.0.0/24 is specified (all of the internet ipv4 addresses) this is a valid range using CIDR notation.

It seems like a bug to me

--- End Message ---
--- Begin Message ---
On Tue, Jun 5, 2012 at 1:07 PM, jas <jason.ger...@gmail.com> wrote:
> On 06/04/2012 12:48 PM, Matijn Woudt wrote:
>>
>> On Mon, Jun 4, 2012 at 8:38 PM, jas<jason.ger...@gmail.com>  wrote:
>>>
>>> On 06/04/2012 11:33 AM, Matijn Woudt wrote:
>>>>
>>>>
>>>> On Mon, Jun 4, 2012 at 6:54 PM, jas<jason.ger...@gmail.com>    wrote:
>>>>>
>>>>>
>>>>> Not sure if this is a bug or not...
>>>>>
>>>>> I have run into an error when performing a conditional using iplong()
>>>>> and
>>>>> the ~ bitwise operator
>>>>>
>>>>> $ip = '0.0.0.0';
>>>>> $mask = '24';
>>>>>
>>>>> $end = (ip2long($ip) || (~ip2long($mask))) + 1;
>>>>>
>>>>> PHP Fatal error:  Unsupported operand types
>>>>>
>>>>> I even tried to typecast the mask to (int)
>>>>>
>>>>
>>>> The error is probably not where you suspect it to be. ip2long will
>>>> return false for ip2long($mask), because $mask is not a valid IP
>>>> address. The ~ operator is not supported for false.
>>>>
>>>> - Matijn
>>>
>>>
>>>
>>> Strange... this works
>>>
>>> $ip = '10.0.2.0';
>>> $mask = '24';
>>>
>>> Anything using 0.0.0.0 fails using the bitmask to calculate valid CIDR
>>> ranges.
>>>
>>
>> Yes, because with $ip being 0.0.0.0, the result of ip2long($ip) will
>> be zero. Zero evaluates to false when PHP is going to parse the ||
>> operator, and because of that, it continues to parse the rest.
>> When the result of ip2long($ip) is greater that zero, in case of some
>> other valid IP, it will evaluate to true and PHP will not even execute
>> the rest after the || because the result will be true anyway.
>> Did you mean to use a single | operator, as a bitwise OR?
>>
>> - Matijn
>
>
> With any ACL rule using iptables, hosts.allow/hosts.deny, routers where
> 0.0.0.0/24 is specified (all of the internet ipv4 addresses) this is a valid
> range using CIDR notation.
>
> It seems like a bug to me
>

Nope, there's no bug here. Can you explain what you're trying to do
with ip2long($mask)?

- Matijn

--- End Message ---
--- Begin Message ---
On 06/05/2012 05:40 AM, Matijn Woudt wrote:
On Tue, Jun 5, 2012 at 1:07 PM, jas<jason.ger...@gmail.com>  wrote:
On 06/04/2012 12:48 PM, Matijn Woudt wrote:

On Mon, Jun 4, 2012 at 8:38 PM, jas<jason.ger...@gmail.com>    wrote:

On 06/04/2012 11:33 AM, Matijn Woudt wrote:


On Mon, Jun 4, 2012 at 6:54 PM, jas<jason.ger...@gmail.com>      wrote:


Not sure if this is a bug or not...

I have run into an error when performing a conditional using iplong()
and
the ~ bitwise operator

$ip = '0.0.0.0';
$mask = '24';

$end = (ip2long($ip) || (~ip2long($mask))) + 1;

PHP Fatal error:  Unsupported operand types

I even tried to typecast the mask to (int)


The error is probably not where you suspect it to be. ip2long will
return false for ip2long($mask), because $mask is not a valid IP
address. The ~ operator is not supported for false.

- Matijn



Strange... this works

$ip = '10.0.2.0';
$mask = '24';

Anything using 0.0.0.0 fails using the bitmask to calculate valid CIDR
ranges.


Yes, because with $ip being 0.0.0.0, the result of ip2long($ip) will
be zero. Zero evaluates to false when PHP is going to parse the ||
operator, and because of that, it continues to parse the rest.
When the result of ip2long($ip) is greater that zero, in case of some
other valid IP, it will evaluate to true and PHP will not even execute
the rest after the || because the result will be true anyway.
Did you mean to use a single | operator, as a bitwise OR?

- Matijn


With any ACL rule using iptables, hosts.allow/hosts.deny, routers where
0.0.0.0/24 is specified (all of the internet ipv4 addresses) this is a valid
range using CIDR notation.

It seems like a bug to me


Nope, there's no bug here. Can you explain what you're trying to do
with ip2long($mask)?

- Matijn

As stated previously using CIDR notation such as 192.168.0.0/24, 10.0.0.0/24 perform validation on an IP existing within said subnet range.

visiting ip: 192.168.0.22

acl allow range: 192.168.0.0/24
acl deny range: 0.0.0.0/24

CIDR notation allows me to utilize shorthand notation for specifying a range of IP's

In those two cases any ip within 192.168.0.0 - 192.168.0.255 is allowed while anything else residing between 0.0.0.0 - 255.255.255.255 is denied

The problem is I can perform operations on CIDR ranges such as the following:
192.168.0.0/24
192.168.1.0/16
10.0.0.0/24

But cannot use the traditional 0.0.0.0/24 because iplong() evaluates 0.0.0.0 as false thereby invalidating a valid CIDR notation when evaluated as

(ip2long($ip) || (~ip2long($mask))) + 1;

From my own tests only 0.0.0.0/24 fails or as shown in the example code above

(ip2long(0.0.0.0) || (~ip2long(24))) + 1;

The class I am using to test with can be found at http://www.php.net/manual/en/function.ip2long.php#108812
--- End Message ---
--- Begin Message ---
> acl allow range: 192.168.0.0/24
> acl deny range: 0.0.0.0/24
>
> CIDR notation allows me to utilize shorthand notation for specifying a range
> of IP's
>
> In those two cases any ip within 192.168.0.0 - 192.168.0.255 is allowed
> while anything else residing between 0.0.0.0 - 255.255.255.255 is denied

Na-uh.  You want 0.0.0.0/0, which is valid. 0.0.0.0/24 isn't valid.

-- 

Regards,
Chris Knipe

--- End Message ---
--- Begin Message ---
On Tue, Jun 5, 2012 at 1:49 PM, jas <jason.ger...@gmail.com> wrote:
<snip>
>
>
> As stated previously using CIDR notation such as 192.168.0.0/24, 10.0.0.0/24
> perform validation on an IP existing within said subnet range.
>
> visiting ip: 192.168.0.22
>
> acl allow range: 192.168.0.0/24
> acl deny range: 0.0.0.0/24
>
> CIDR notation allows me to utilize shorthand notation for specifying a range
> of IP's
>
> In those two cases any ip within 192.168.0.0 - 192.168.0.255 is allowed
> while anything else residing between 0.0.0.0 - 255.255.255.255 is denied
>
> The problem is I can perform operations on CIDR ranges such as the
> following:
> 192.168.0.0/24
> 192.168.1.0/16
> 10.0.0.0/24
>
> But cannot use the traditional 0.0.0.0/24 because iplong() evaluates 0.0.0.0
> as false thereby invalidating a valid CIDR notation when evaluated as
>
> (ip2long($ip) || (~ip2long($mask))) + 1;
>
> From my own tests only 0.0.0.0/24 fails or as shown in the example code
> above
>
> (ip2long(0.0.0.0) || (~ip2long(24))) + 1;
>
> The class I am using to test with can be found at
> http://www.php.net/manual/en/function.ip2long.php#108812
>

First of all, as I suggested earlier, the class uses the single |,
which means bitwise OR, you're using ||, boolean OR.
Second, the class you're referring to is wrong. Using ip2long on 24 is
just not valid, you probably want to call ip2long('255.255.255.0')
instead, though it is probably easier to convert the 24 to the long
value.

 - Matijn

--- End Message ---
--- Begin Message ---
hi guys
i really confuse by choosing the best work station for php ( cakephp , smarty , 
net bean , ... ) , please give me some advisdes.
and please tell why which one is better, 
tnx 
best regards farzan

--- End Message ---
--- Begin Message ---
Hi, Farzan

I do not really get your point of confusion ...

What you've posted here are tools/frameworks that do not to the same stuff
at all, yes you could even use all without missing something ...

cakephp
.. is a full-stack PHP-Framework. Yes, I have to say that there's quite a
bunch of full-stack frameworks in PHP you could choose and I myself would
recommend one by knowing how much experience you have in PHP :)

smarty
.. is a template-engine for PHP. If you want to use smarty, twig, php
itself or another library as template-engine is up to you. Using a
template-engine for some programmers I know just feel like a better
separation between the view and the controler/model (search for
ModelViewControler if you don't know what I mean here).

netbeans
.. is an IDE where you can develop with. I prefer to use PhpStorm, others
use EclipsePDT, Notepad++ or even the basic editor of windows. This is just
about syntax-highlight, code-completion and other things helping you to
develop your code.

Hope that helps :)

Bye
Simon

On Tue, Jun 5, 2012 at 2:10 PM, Farzan Dalaee <farzan.dal...@gmail.com>wrote:

> hi guys
> i really confuse by choosing the best work station for php ( cakephp ,
> smarty , net bean , ... ) , please give me some advisdes.
> and please tell why which one is better,
> tnx
> best regards farzan

--- End Message ---

Reply via email to