« first day (3288 days earlier)      last day (1650 days later) » 
04:00 - 18:0018:00 - 23:00

Wes
4:17 AM
@PeeHaa async tutorial link? i cant' find it
 
 
2 hours later…
6:23 AM
@NikiC did a google doc happen re 25yrs?
\o
 
7:14 AM
Hi there
Can someone please help me with the code? I am compressing image while uploading/saving to database. But transparent images save as black background, I have googled a lot but didn't find any solution. Please help me
public function compressImage($source, $destination, $quality) {
$info = getimagesize($source);

if ($info['mime'] == 'image/jpeg'){
$image = imagecreatefromjpeg($source);
} elseif ($info['mime'] == 'image/png'){
$image = imagecreatefrompng($source);
}

imagepng($image, $destination, $quality);
} // This is the function code
 
cmb
7:34 AM
!!docs imagesavealpha
 
[ imagesavealpha() ] Whether to retain full alpha channel information when saving PNG images
 
public function compressImage($source, $destination, $quality) {
$info = getimagesize($source);

if ($info['mime'] == 'image/jpeg'){
$image = imagecreatefromjpeg($source);
} elseif ($info['mime'] == 'image/png'){
$image = imagecreatefrompng($source);
imagealphablending($image, false);
imagesavealpha($image, true);
}

imagejpeg($image, $destination, $quality);
} //updated code
Still it's saving with black background, not transparent
 
@JoeWatkins Shared for now: docs.google.com/document/d/…
 
Interface declaration of ... unexpected behavior – #78677
 
How it can be done, I mean how can i save and compress image without that black background which is generating itself in php while uploading?
 
cmb
7:45 AM
@ZainShabir, JPEG does not support any transparency; you'd have to save as PNG.
 
How can I set environment variables in linux so that commands inside shell_exec can see it? ex: shell_exec('echo $SOME_VAR')
 
@NikiC thanks - I think 2 days at least, better 3.
 
imagepng() function? It works but what about quality, It's not compressing image with imagepng() function?
 
is there a way other than putenv?
 
@Hmmm putenv
@Hmmm "in linux" you can simply use export - php will see those as well
 
7:52 AM
morning
@ZainShabir why don't you use the imagick lib?
 
@Sjon yeah maybe I'm doing something wrong but If I tray to add export SOME_VAR=value in ~/.profile for example. it works I can use it echo $SOME_VAR. but if I execute it using php with shell_exec in cli it doesn't show up
 
I don't know about imagik library, let me search brother
 
@JoeWatkins @bwoebi Oops, I shared the wrong link: docs.google.com/document/d/…
 
cmb
@ZainShabir, PNG compresses, but lossless. If you need stronger compression, you have to "simplify" the image (e.g. scale down, or use `imagetruecolortopalette` to reduce the number of colors).
Another option would be to resolve the alpha channel; something like `imagealphablending($image, true); imagecopy(...)`.
The "best" results depend on the images. You'll likely have to experiment with this.
 
That one should be editable
 
7:55 AM
@Hmmm does it show up if you print_r($_SERVER); ? This works for me $ TEST=Hmmm php -r 'echo shell_exec("echo \$TEST");'
 
Also @LeviMorrison
 
@Hmmm shell variables are scoped, you cannot manipulate the env of your shell from within a php program you call from your shell
 
brother, imagealphablending($image, true); doesn't work.
 
@Sjon Yes my bad I think i just need to set it globally maybe in /etc/profile so that a different user can read it.
 
genial favorable to growth or comfort : mild
 
cmb
8:00 AM
@ZainShabir, by iteself it does nothing. It is only relevant if you resize/copy the image.
 
8:23 AM
/me waves
@Girgias I should be good for tonight. My last meeting ends at 19, and should be good for a beer or something. Staying in Mayfair.
 
@NikiC cool
 
Error in the second parameter document of stream-set-blocking – #78678
 
got an email from an e-learning company about my blog, saying it'd be cool if I placed a link to their content on my blog
um,.....
 
9:34 AM
Any general thoughts on getting a feature-flag-enabled, super lightweight, built-in tracer into PHP 8 that tracers & profilers could hook into to add functionality? @LeviMorrison and I have been chatting about this for a while and would love to hear some of your all's thoughts. :)
 
@SammyK my feature flag, do you mean compile time flag? --enable-tracing or something like that?
 
@SammyK PHP actually has DTRACE support. It's not very useful though
 
It might have to be a compile-time flag. Or if it didn't add overhead, an INI directive, but it seems like the former would have less performance hit.
@Gordon Yeah, maybe we make dtrace a first-class citizen or something? :)
 
@SammyK also, built-in is somewhat of a hassle to maintain, especially when it's a moving target like open tracing, census, telemetry
 
@Gordon True - that's why I'm thinking like super-basic timing info and memory pointer and nothing else. Almost useless on its own unless an extension hooks into it
 
9:40 AM
@SammyK I don't think you would be happy with DTRACE as a first class citizen. try it out. It's much different from your approach if I am not wrong.
Instana can ingest that but we've never seen anyone use it. not in php, nor anywhere else.
 
@Gordon Yeah, @LeviMorrison and I have been trying to think outside the box a bit for an upstream change that would provide proper tracing hooks into the engine. Something other than zend_execute_ex and opcode handlers.
 
But I agree that having some sort of low cost hooking mechanism or api would be nice
 
Yeah, all the tracers everywhere would benefit and with the market on telemetry growing like it is, something like this would be a big win all around I think. :)
 
Then again, if there was an OpenTelemetry PHP extension, we likely all just need to write our convertors and be done with it… assuming they keep the OpenCensus idea of one tracer, many convertors.
 
That would be nice! :D The OpenTelemetry PHP extension would still need to hook into thee engine though and it'd be nice if that hook was designed for tracing/profiling with as little overhead as possible.
 
9:48 AM
yes
 
9:59 AM
HI , I need some help please this command is set up with our adminstrator

sftp -o ProxyCommand="alias my.proxy.com proxy_port %h %p" Username@target_address_to_connect

my question how can I convert this to php script and how can I download and upload file using sftp
 
cmb
!!docs ssh2_sftp
 
[ ssh2_sftp() ] Initialize SFTP subsystem
 
Thank you I will try
Hi I am confuse in ssh2_connect() what should I put the target address ? or my proxy ?
 
10:33 AM
Morngind
Won't be really useful for you though I guess as it is pre-beginner :-)
 
Wes
that's it? :B
i thought there was more :B
 
Nope
 
Wes
i need to understand how to use yield correctly
 
In general terms you always want your API to return promises
And you yield promises
Imo you should prevent working with generators directly in most cases
So you only need yield and not yield from
To turn generators into promised based apis you can simply wrap your code in return call() calls
The above is based on the assumptions you are trying to use amp as an end user
If any of those assumptions are incorrect forget what I just said :D
 
Wes
say i have two statements. i want other code to run between them, how do i do that?
if($a){}
// run other code here
if($b){}
shouldn't i yield something there?
 
10:44 AM
In terms of amp or in general?
As that is what the scheduler takes care of
 
Wes
what do you mean in general :B yeah in terms of amp
 
The yield keyword simply "stops" execution inside a function and passes back control
 
Wes
which is what i want to do between the two statements
should i yield null; ?
 
Do you have a more concrete example for my not awake mind?
 
Wes
i get i have to do yield, but what should i yield?
and how do i convert that generator to a promise?
 
10:48 AM
Simply just yield; already turns a function insto a generator
 
Wes
is it normal to do that?
 
function foo(): \Generator {
    yield;
}
 
Wes
i am wondering why yield can pass a value at all
 
@Wes Yes. In certain cases you do not care about a value
function foo(): Promise {
    return new Success();
}


function foo(): Promise {
    return call(function () {
        yield;
    });
}
^ both are valid ways to have a promise api
Say you are doing some http call and you want your api to be promise based you would do something like:
function foo(): Promise {
    return call(function () {
        $response = yield $this->httpClient->request('https://example.com');

        return yield $response->getBody()->buffer();
    });
}
And you would call it using yield foo();
If you would not have a promise based api it would look like:
function foo(): \Generator {
    $response = yield $this->httpClient->request('https://example.com');

    return yield $response->getBody()->buffer();
}
 
Wes
call will start to consume the generator immediately, right?
 
10:55 AM
And the call would look like yield from foo();
@Wes Call returns a promise
 
Wes
question, why do you yield $this->httpClient->request( ...
given that you don't need that value
 
I do need that value though
It's the response in the second line
 
Wes
you need it in $response
 
I need to work on the eventual response
Not the promise
 
Wes
why are you giving it to the generator?
 
10:58 AM
So first the response is being resolved
meanwhile the scheduler can decide to do other things
Afterwards the complete body is buffered
 
Wes
ok i get that
my question is, do you send the values to the generator for a reason?
return call(function () {
    $response = $this->httpClient->request('https://example.com');
    yield;
    $buffer = $response->getBody()->buffer();
    yield;
    return $buffer;
});
is this different?
 
yes it is
$this->httpClient->request('https://example.com');
^ returns a promise, meaning:
$buffer = $response->getBody()->buffer();
$response is still a promise
 
HI
i need a help
 
You do not want the promise. You want the eventual response object
$response = yield $promisewill resolve the promise to the actual response object
You know async await from js right @Wes?
 
i have this below code for loginsubmit.php file which receive the login request and input data and process the authentication and pass the successfull login page. code as follows but the problem is that i am not to process the login request. ```
 
11:07 AM
Anyone who knows where i can get good mysql documentation on usage of brackets
for instance i need a complex query with mutiple between statements followed by several and condiutions
 
In JS you do basically the same thing with async/await as what amp does without the sugar @Wes
const theEventualValue = await somePromiseThing();
1 message moved to Trash can
Please do not post wall of code @Rink16
If you really need to post a lot of it please use github gists or something alike
@Wes Do you see why that doesn't work now?
 
@PeeHaa ok but can you please look at it
 
No thanks. I don't feel like it. If somebody else is here and they want to help they will
 
Wes
@PeeHaa i am trying to understand how putting yield there awaits for the promise to be resolved
 
@Wes For all intents and purposes yield === await
In terms of amp
 
Wes
11:12 AM
i mean literally i am wondering how that is implemented
 
That's all the loop/schedular magic that amp does
 
Wes
instead how do i do promise.all and promise.race ?
 
If you want to know how amp in specific does it look into amphp/amp if you want to understand how it works in general nikic.github.io/2012/12/22/…
 
@Wes race() is first promise to resolve wins?
 
Wes
yes bwoeb
 
11:14 AM
What a shitty name :P
 
@Wes \Amp\Promise\first()
 
What language calls it that?
 
Wes
it's the js name, so yeah, it's shitty
 
:D
 
and all is \Amp\Promise\all()
 
ah
yeah, there's no direct equivalent for race() in amp
 
ok then bye
 
@bwoebi huh?
What is the difference between race and first?
 
@PeeHaa first() is the first one to succeed
and fails if all failed
 
ah
 
11:17 AM
race() is the first one to resolve, at all, and ignores everything else
 
aaah race is just one to either fal or succeed
yep got it
 
Wes
ah, i do need resolve
 
@PeeHaa race() could be useful if you have multiple nodes to an infrastructure hosting the same data, and you know that all nodes will return the same data, so you just want the fastest
 
@Wes ?
@bwoebi But you don't want to fail if the first one fails?
Or are we talking about different failure modes here?
 
@PeeHaa depends on the type of failure, I meant failure as in "no data available"
yeah
 
11:21 AM
As in no data
:P
Yeah kk
 
@Wes curious, what's your use case?
 
Wes
no use case, but according to previous experiences i'd say both are useful
 
@SammyK count us in on brainstorming with you :-) i don't believe it should be compile flag or ini setting, just a better api than zend_execute that works with a.) userland b.) internal c.) JIT - with 0 overhead when not used, a way to enable on an individual function level, or for all functions.
imho only userland is missing in the equation, and i wouldn't be completly against this being AST based, because its the most powerful. maybe with new opcodes injected into the function that starts this functionality for just that function. as far as i understood @LeviMorrison there must be some improvements to simplify access to return values or exceptions
 
Wes
@bwoebi how do i check a promise's state?
 
@Wes you don't.
 
11:34 AM
@Wes Why would you need that?
 
Wes
$promise->--- pending/resolved/rejected ?
 
@Wes yes, why would you need that?
You wait for a promise to resolve. If it resolves, then you do an action (could be setting a simple flag)
 
Wes
$result = race($promises, /* accept result */ function(Promise $promise){
    return $promise->state === Promise::FULFILLED;
});
$result = race($promises, /* accept result */ function(Promise $promise){
    return true; // accept the first result regardless it's fulfilled or rejected
});
 
good mornings.
is there a ::class like ::func pseudo constant for functions (e.g. trim::func) when dealing with namespaces?
 
@Wes and that's the difference between amp and js: in amp this function would throw if it failed and return if it succeeded. Not return the promise itself.
 
11:41 AM
(well I think it's not, but then would it be a good suggestion?)
 
Wes
ah
 
@Wes so I played around with the console stuff a bit, and basically PHP doesn't have enough support for it right now
there's more required than just enabling vt100
I played around with it in C and it works, but it's more nuanced than everything just working all the time
e.g. the "query state" commands end up printing the response to screen unless you disable input echo
it needs moar functions
 
@bwoebi you would need it, because what if you want to cancel the other promises. You'd need to know which succeeded and which are still pending to be able to issue a cancelation
 
@hakre We need first class functions
 
11:44 AM
it should be an API to let you directly manipulate the console opts, instead of just 1 specific opt
/cc @cmb ^
@PeeHaa all my functions are first class, everything I do is first class, I'm English.
 
@ircmaxell actually, it would return the Promise and you can yield that promise to get the result - my bad
and given the promise you can cancel all others
(because if one promise resolved, all the others are not resolved yet)
 
@DaveRandom I have seen your gals in a weekend in london. Not sure that is actually first class
 
I didn't say it was classy, that's a whole different thing
 
:P
 
@PeeHaa well this could be just syntax, couldn't it?
 
11:49 AM
@ircmaxell and technically it should be allowed to cancel already resolved promises (it just should not do anything)
 
@bwoebi this is what exit(0); is for.
 
@hakre well depending on what you want /are doing ::class might work
 
@hakre haaaa
 
As it just works on strings
 
@hakre technically you can use ::class, although it won't play nice with static analysis 3v4l.org/6L52l
 
11:52 AM
@bwoebi fair
 
@PeeHaa "work" and "does what is expected" are two different thing :)
 
@ircmaxell I am agree :-)
 
12:06 PM
Hi, anyone keen on looking at a PHP-7.4 GC issue with extension code?
 
cmb
12:16 PM
@DaveRandom, do you mean to support the Console API directly?
@hakre, ::class can be thought of being an implicitly defined class constant. Functions don't have constants, so that would stretch the concept quite far.
 
@m6w6 I think I know what causes that
Just haven't gotten around to it yet
 
@cmb at the very minimum, needs to be able to trigger DISABLE_NEWLINE_AUTO_RETURN on output streams, and ENABLE_LINE_INPUT/ENABLE_ECHO_INPUT on input streams. Therefore, I don't really set any reason not to expose the entirety of [GS]etConsoleMode() to userland - those options are the only ones I touched while messing about with the vt100 stuff, but there are all manner of potential use-cases I haven't encountered
 
@beberlei Yay! :) Those are all great requirements. I'll throw a quick README with some of these requirements up on GH in a bit and share here.
 
given that we've already created a very specifically windows API to deal with this, may as well expose all of it
(ref)
btw ENABLE_LINE_INPUT should probably be disabled by default, but that's a massively breaking change at this point
that's why you can't do fgetc(STDIN), it always blocks until there's a new line
...which means that the vt100 query commands just plain don't work
it would also be good to be able to capture raw kbd/mouse/console events (like window resize)
 
oooooh are you giving windows some sweet love here @DaveRandom?
 
12:25 PM
sort of :-P
 
\o/
 
oh also you can do fopen('CONIN$', 'r') to get a handle to the console input, independent of stdin (i.e. fetch console input stream regardless of whether stdin has been redirected to a pipe), but you can't do fopen('CONOUT$', 'w') (afaict) because there's no way to do the necessary tap dancing required to pass the correct set of flags to CreateFileW()
(and inherited handles don't play the game there, because fopen() doesn't pass a SECUIRTY_ATTRIBUTES struct to CreateFileW())
basically, there's a whole bunch of relatively trivial improvements that could be made to expose this stuff sanely
 
@DaveRandom this is astonishing, didn't know. 3v4l.org/mNvpo
 
@hakre constant ::class expressions are resolved to string literals at compile time without any sort of checks around whether the symbol really exists, afaik. The problem is that it only works with the class symtable :-/
...yet another reason why I personally think we should just merge the symtables and eliminate the madness where it's possible to define class/func/const with the same name
equally I don't think it makes sense to be able to define a method/prop/class const with the same name
but I've ranted about this before and there's no point shouting into the wind about it
a poor-man's solution would be to have ClassName::class, FuncName::function and ConstName::const I guess
 
@DaveRandom I take this a code smell.
 
12:34 PM
@hakre exactly, same with top-level symbols
If you really must, could introduce __invokeStatic() as a way to deal with function/class conflicts
(but also nope)
I've been banging this drum for years though, I don't think it will ever happen :-/
 
Sorry for heating this inside you then.
I try to keep this chatroom trigger free, but it's not easy :D
 
@ircmaxell 2000 at Picadilly Circus? Also the chat doesn't really work on my phone for some reason :(
Or do you prefer maybe somewhere else? I don't really have an address in mind D:
 
@Girgias works for me. There's a cocktail bar in that area I've been interested to go back to (Burger and Lobster).
 
@ircmaxell Sure seems like a plan then :)
 
:+1:
 
user10655999
12:45 PM
Can some one help me out with this error Fatal error: Uncaught SoapFault exception: [Client] Function ("call") is not a valid method for this service in C:\PHPv7.2\sourcecode\WSPAN\Request_cvl.php:35 Stack trace: #0 C:\PHPv7.2\sourcecode\WSPAN\Request_cvl.php(35): SoapClient->__call('call', Array) #1 {main} thrown in
 
user10655999
calling $message=$c->call("xmldata",array("string"=>$inp),'http://localhost/BOISLST/gateway/test/webserv/nusoap','uri:helloworld/getname');
 
The soap server does not provide a method with the name "call"
probably you want to change the first parameter of the __call mehtod
 
@hakre :-P
it's more unending sadness than heat
 
@daoootim oh no you missed the __ before call
 
cmb
@DaveRandom, I guess that was only a 1st stab by Anatol; not much, if any, feedback so far; can certainly be improved. PR(s) welcome; not sure if I'll find time to do it myself.
 
12:51 PM
@user3655829 @daoootim also you almost certainly want __soapCall()
 
cmb
Re 1 symbol table: "that ship has sailed long ago; this will never happen!" ;)
 
But why :(
 
@cmb ditto, I will try and get to it but The List is probably longer than my projected lifespan at this point :-P
@cmb I know
> unending sadness
:-P
 
cmb
DaveRandom extends Lifespan:)
 
@Girgias I'm inclined to agree with that... I personally think that it would be sane to starting issuing E_DEPRECATED about symbol naming conflicts in 8 and then make the change in 9, but the prospect of trying to get enough people to agree to that does not give me a warm fuzzy.
 
12:56 PM
@cmb implements Disappointment
 
cmb
lol
 
use @PeeHaa;
7
 
Whoever starred @DaveRandom's response and not mine: I hate you
 
^ don't worry, he hates everyone
 
1:17 PM
@DaveRandom I mean doesn't it also give way to some optimisations? Other than the complexity of needing to remember that multiple symbols can have the same name (which is also a good reason to merge them) I don't know what else is in favor for merging thenm together
 
@PeeHaa I hate you too <3
 
Because the downside (as all things it seems currently) is that we "need" to break some code potentially
 
@Ekin <3
 
I'm currently working with: import "peehaas_mom"
 
@Gordon They have one. It uses zend_execute_ex and is therefore unsuitable for some orgs.
It's still very early in its lifecycle. I've been meaning to join their (weekly?) meeting.
I've never looked at dtrace -- really ought to as it has source code in the engine.
 
1:38 PM
@cmb oh, that is interesting, will test it tomorrow under Windows platform
 
cmb
Thanks @lisachenko!
 
I'm curious, if I change PHP method opcode code in runtime, what should I do to apply this change?
Looks like PHP engine stores this information somewhere else...
 
1:52 PM
@beberlei Do you use the return value? I've been looking around, and it's something I can't find other tracers doing.
If return values aren't needed, it becomes much easier. You basically just wrap it in a try {/*open */ ; /* original */ } finally { /* close */ }.
 
Unified symbol tables <3
The major breakage I see is the natural consequence is being able to refer to class properties, which don't share the table either
 
Using AST should be robust, and should just work with JIT, and theoretically even with function inlining.
The downside is adding more PHP-level function calls instead of doing all that internally. Since it is performance sensitive that is a bit of a bummer.
@beberlei I guess if it had new opcodes then the extensions could use an opcode handler to do value-added tasks.
 
2:18 PM
@DaveRandom ab-
 
@Girgias here's a selection of stuff that i want but can't have without it 3v4l.org/2GMh8
it's possible to work around most of that stuff, but it's so untidy atm
and I really can't see that it's such a huge deal to just fix your shit to avoid naming conflicts, esp if you have an entire major version (!!!) and some nice friendly deprecation notices to help you
I'm not suggesting breaking anything tomorrow, I'm suggesting giving you like 3+ years notice and a lot of hand-holding
a lot of scope for static analysis-based tooling as well
 
Case lines are not covered – #78679
 
@DaveRandom Line 17 would probably not be what you want, actually, since that method is not static.
And later, you'd want something like $this->registerCallback($this->inner); (not [$this, 'inner']) which would capture the accessibility at $this->inner, not at when the callback is invoked.
 
2:48 PM
Hi
I'm a c# developer and I'm getting mad with PHP.. (I'm trying to develop a very simple plugin for wordpress).
I'm trying a foreach on this array:
array(1) {
["domande"]=>
array(1) {
[0]=>
array(2) {
["domanda"]=>
string(31) "Quanti anni ha Maria De Filippi"
["risposta"]=>
string(16) "Maria ha 57 anni"
}
}
}
 
!!errors
 
558
Q: How can I get useful error messages in PHP?

CandidasaI find programming in PHP quite frustrating. Quite often I will try and run the script and just get a blank screen back. No error message, just empty screen. The cause might have been a simple syntax error (wrong bracket, missing semicolon), or a failed function call, or something else entirely. ...

 
10 secs ago, by Jeeves
558
Q: How can I get useful error messages in PHP?

CandidasaI find programming in PHP quite frustrating. Quite often I will try and run the script and just get a blank screen back. No error message, just empty screen. The cause might have been a simple syntax error (wrong bracket, missing semicolon), or a failed function call, or something else entirely. ...

How do I tell the result of a command to a user again @DaveRandom?
 
thanks guys it works!
but I'm still missing something..
the code
ok, sorry I got
 
3:10 PM
@LeviMorrison correct on all counts, however a) the top section was intended more as a syntax demo (and if we are going to be really anal about it then technically it will currently work and emit E_DEPRECATED because PHP4 legacy :-P) and b) the bottom section is a demo of code that currently works but has the scope binding problem, whereas first-class functions could automagically solved that, exactly as you say
in essence it would behave as if it were implicitly converted to a Closure::createFromCallable() wrapper
but this is all academic since the chances of any of this happen may as well be 0
Nevertheless, I still think that's the way it should work, and I don't think BC is a strong enough arg against a graceful process to get it. But no-one cares what I think and I'm semi-fine with that :-P
@PeeHaa I forget, did we make that work?
I think we maybe didn't bother because of the implied double-ping
 
ah could be yeah
 
@DaveRandom I'm pretty sure the way to do it is to propose it now, get it denied, then propose it again later, and get it accepted.
 
Sure, I'll add it to the list of things that I wish I had the time/energy for :-P
(and yes that is fully on me and I don't really have grounds to complain)
 
But yeah, I'm on board.
 
3:19 PM
oh cool, most people look at me like I'm from space when I even suggest it
 
when you suggest what?
 
3 hours ago, by DaveRandom
...yet another reason why I personally think we should just merge the symtables and eliminate the madness where it's possible to define class/func/const with the same name
 
3:37 PM
echo <<<TAG
]} </script>
TAG;
the / exit the string
it seems crazy to me
or better said this two chars exit the string: "</"
I cannot use HTML in php strings?
https://stackoverflow.com/questions/10551116/html-php-escape-and-symbols-while-echoing
 
4:19 PM
@NikiC do you think there's value chatting with the Hack/HHVM team at any point about some of the more advanced features (union types/etc) that are being worked on?
(or anyone). I have Hack language designer sitting about 3 meters from me now :-D
 
4:34 PM
@ircmaxell is hack even a thing outside the gates of Mordor?
 
cmb
@Revious, look at the source code in the browser.
@LeviMorrison, @DaveRandom, re 1 symbol table: don't forget about case-insanity.
 
4:49 PM
There are also differences in how they handle not-found symbols.
functions fallback to global namespace and then error if not found there, types error after autoload, constants... I don't actually know what constants do in this case.
They used to be bare-string literals, I think. We finally got rid of that garbage, right?
 
is a global const case sensitive?
 
cmb
depends (as of PHP 8 it is always)
 
ffs
I'm all for normalisation but that's the wrong choice of the 2 possible options imho :-P
@LeviMorrison "bare" constants currently warn and are converted to string, but explicitly state that it will throw in a future version. Class constants throw i.e. same as undefined method
 
cmb
constconstants have been case-sensitive forever; define and ext constants could choose.
 
case sensitivity is a trickier one though
at least in terms of property vs method
I don't like it, but I don't think it's reasonable to prevent properties that only vary by case
 
4:57 PM
Using case insensitivity for all symbols is the smoothest migration. I do not prefer it, but given that we are already breaking compat if we merge the tables then if we can smooth that migration a bit then that may be worth it.
 
Yep, bareword strings are dead in PHP 8, per wiki.php.net/rfc/deprecate-bareword-strings. Undefined constants will now just error at the time they're resolved.
 
No global namespace fallback?
 
oh, yeah, does that work the same way as functions?
 
@LeviMorrison (slightly reluctantly) agreed
at least it will be a compile-time/declarative error
reduces the scope for undebuggable runtime weirdness
8 mins ago, by cmb
depends (as of PHP 8 it is always)
^ although this is directly at odds with that :-/
(unless I misinterpreted what you meant @cmb?)
if a rule is enforced, it should be always CI, if only for consistency with the way the other top-level symtables behave
 
cmb
no, you've got it right @DaveRandom
 
5:04 PM
class properties is a trickier one though, since I don't think anyone is suggesting making local vars case insensitive (?) and it seems reasonable to expect properties to have the same semantics as local vars (?)
out of interest, does anyone know off-hand whether $THIS === $this? #lazyweb
 
case sensitivity has the benefit that it's simpler to explain; since PHP doesn't actually process names as Unicode, function foo and function FOO are the same function, but function fóó and function FÓÓ are not
that's only really relevant if you have a time machine or very clever BC mechanism, though
 
well yeh but unicode is a whole other box which not even Pandora is prepared to open
just agreeing on a normalisation form would be hard enough
(actually I personally think it's as simple as a copypasta of the idna2008 NAMEPREP, but someone will probably disagree with that even in this room)
 
yeah, I guess even without case folding you'd expect different code point sequences to represent the same name
 
yes, even simple differences in which font you use in your IDE could breed confusion, that way insanity lies. I realise that as an English native I have an extremely narrow view of the world in this regard, but it seems to me that using non-ASCII chars in symbol names anywhere at all (not just PHP) is a great way to cause yourself all sorts of heisenbugs
 
I consider having characters in the higher nibble inside source code a smell.
That's a simple check to run on a code-base.
Even I'm not English native speaker. So no Üs and Äs in comments or strings.
 
5:16 PM
@DaveRandom Makes even more sense for them to match class methods and constants, yes?
 
@hakre the only place where I have (semi)legitimately done it is when I want private members in traits, like I have done private function TraitName⋮⋮methodName() essentially as a poor man's namespacing hack. I'm not advocating it, just saying that I have done it and didn't completely hate it.
@LeviMorrison yes, true, and I am generally in your camp I think, but I can just see it being a thing which gets more resistance than other parts, potentially
/me drives home and does childcare, bbiab
 
@DaveRandom smell means I use it for code-review which allows to spot these places quick. Also I've some half-ready unicode to \x \u converter for strings thanks to PHP parser by nikic.
It's manly to spot portability issues.
and issues like non breaking spaces in comments and elsewhere. it's astonishing what you find in code-bases.
 
5:53 PM
Hi
 
04:00 - 18:0018:00 - 23:00

« first day (3288 days earlier)      last day (1650 days later) »