« first day (1723 days earlier)      last day (3225 days later) » 

9:03 PM
alo'
@DaveRandom nice @ RFC
 
RFC? :o
 
I wonder why pupils think that assertions are for development only.
then they go into production and all the so important assertions are unchecked.
 
@hakre Important checks shouldn't be assertions. ;-)
 
@NikiC should this be implemented as an exception?
ErrorExceptions etc.
 
9:10 PM
@kelunik an assertion is a specific kind of check. you probably expect something you check, but an assertion just asserts.
 
I have a ProviderProvider
This smells bad :(
It works, but it smells bad
 
though I think the date is wrong. Got the mail notification today
 
@SilentEcho yeah....you're falling into the Java trap of everything being a noun. Verbs are where it's at. have you tried using Auryn?
 
@Ocramius Neat! ES6 does the same thing :)
 
@Ocramius date is correct, @DaveRandom procrastinates.
 
9:18 PM
@SilentEcho Does your ProviderProvider create itself?
 
@Danack aha
@Andrea I was looking at TypeScript and I am convinced I'd like it
still no time to do anything that doesn't produce money, tho
 
@LeviMorrison Typo "I would be in favor of removal of the error/warning" in your email ?
 
@bwoebi what came first, the ProviderProvider or the ProviderProvider?
 
@bwoebi Sadly not.
 
@RonaldUlyssesSwanson :-)
 
9:21 PM
Maybe I need a ProviderProviderProvider.
 
hehe
 
Implement a ParentProviderEvaluator that recurses and does eval($providerClassName) for every level of instantiation indirection (until infinity)
 
Or just functions.
 
Why I'm not getting result?
public function userResult($latitude, $longitude, $radius){

		//Get the Result
		$sql = "SELECT title, latitude, longitude, 3956 * 2 *
          ASIN(SQRT( POWER(SIN(($latitude - abs(latitude))*pi()/180/2),2)
          +COS($latitude*pi()/180 )*COS(abs(latitude)*pi()/180)
          *POWER(SIN(($longitude-longitude)*pi()/180/2),2)))
          as radiusance FROM posts WHERE
          longitude between ($longitude-$radius/abs(cos(radians($latitude))*69))
          and ($longitude+$radius/abs(cos(radians($latitude))*69))
 
@Danack __invoke() is the way
@BrianS is that Haversine done in SQL? EWW.
 
Anonymous
9:24 PM
eww++
 
lel
 
@BrianS tabs/spaces, shaken not stirred
 
Yes I need to get result base on Longitude and latitude
 
I wold separate the math from the query
 
Note: the fact that I dislike it doesn't mean it's incorrect. I just did Haversine in SQL in the past and it's a mess from a perf perspective. Use a geolocation type with an index specific to it instead.
 
9:26 PM
@Ocramius can you show me one?
I got what i have from stackoverflow
I have stalk in this problem for 1 week now :(
 
Is that MySQL btw?
 
Yes MySQL and PHP
This thing is almost making me cry lol
 
this is what you should probably use for this sort of operation
 
oh no
 
does it also explain the radius?
 
9:29 PM
making Array-to-string conversion a recoverable error breaks all the tests
;_;
 
cause I need to pull data base on user long, lat and radius
 
Test urldecode() function : usage variations  - <type here specifics of this variation> [ext/standard/tests/url/urldecode_variation_001.phpt]
Test urlencode() function : usage variations  - <type here specifics of this variation> [ext/standard/tests/url/urlencode_variation_001.phpt]
...
 
@Andrea would be anyway an Error nowadays?
 
@NikiC I thought you wanted to kill all the E_RECOVERABLE_ERRORs?
 
9:35 PM
@Trowski ^ CastError -> ArrayToStringCastError maybe?
 
@RonaldUlyssesSwanson We don't need too specific errors.
 
CastError is fine tho
 
public function __call($method, $args)
{
  if (false === empty($args)) {
    throw new UnexpectedParameterException("ProviderProvider expects no args to function calls.");
  }

  if (1 === preg_match('/^get(?P<class>\w+)$/', $method, $matches)) {
    $shortClass = $matches['class'];
    $class      = "\\Coco\\Provider\\".$matches['class'];

    if (array_key_exists($shortClass, $this->providers)) {
      return $this->providers[$shortClass];
    } else {
      if (true === is_class($class) && true === is_subclass_of($class, Provider)) {
On a scale of 1-10
How bad is this? :D
 
assuming 10 the worst, a 4.
 
Hmm
I somewhat like what it does but the code is much less elegant than I expected.
 
9:41 PM
@RonaldUlyssesSwanson Right now I'm implementing InvalidAccessError, InvalidValueError, UndefinedSymbolError, and LogicError.
I didn't want to go crazy right away. Subclasses of those can always be added.
 
@Trowski what's logic error?
everything is about logic
 
@RonaldUlyssesSwanson e.g. if you try to resolve a Promise that has already been resolved.
 
@Trowski what exactly is a Symbol?
 
@bwoebi function, method, const, ...
 
@kelunik i don't like the name
 
9:44 PM
@kelunik I didn't ask that, but rather what is considered symbol for the error.
 
@Trowski InvalidValueError or InvalidArgumentError?
@bwoebi I just told you.
 
@kelunik Argument is a subclass of Value, and it's not necessary imho
 
@kelunik Lots of things. Trying to use $this outside an instance method, trying to assign when using a string as an array, etc.
@bwoebi A symbol is a function, method, or constant.
 
@Trowski IMHO LogicError is too generic.
 
@bwoebi I want to, sure
Why?
 
9:46 PM
@NikiC because I just noticed it still exists…
and wondered if that were intentional or why
 
@bwoebi It might be... I was assigning it to things that didn't fit well in the other slots.
Maybe I could just leave those as generic Error objects.
 
@Trowski exactly.
 
@Trowski Please don't make the same error as SPL did
 
@bwoebi The ones in Zend/ should be intentional, while everything else wasn't touched
 
9:49 PM
also @Trowski i would drop the Invalid prefix, they are errors already, you don't need it
 
@Andrea There was a decision not to implement it
 
@NikiC Object of class %s could not be converted to %s and Method %s::__toString() must return a string value are intentional? why?
 
@RonaldUlyssesSwanson sigh
 
@NikiC Huh. Too much BC impact?
 
ie ValueError / TypeError
 
9:49 PM
@bwoebi Because __toString
 
otherwise make it InvalidTypeError
 
@bwoebi If you want to have those as Error exceptions, chime in on the __toString thread
 
AccessError, ValueError, TypeError
 
@RonaldUlyssesSwanson That's they way I had it. About 2 hours ago when I asked in this room the opinion was that AccessError and ValueError weren't appropriate. :P
 
@Trowski I agree that there should be no Invalid prefix
 
9:52 PM
@Trowski lol, why? AccessError is found in a bunch of languages, and so is ValueError
 
@bwoebi Good. I felt that way to begin with, so that's what I'm going to do :)
 
:-)
@NikiC okay, I see. I need to re-read that thread again. Lost it a bit with all the x / 0 drama.
 
@Andrea Because it ought to be an exception, if anything, but we currently don't do exceptions in that place
 
@NikiC ...huh
Failed conversions really should be exceptions
 
still not sure about SymbolError, which is too generic... that should be UndefinedSymbolError, or NoSuchSymbolError
 
9:53 PM
We throw a recoverable error, but that's silly
 
@bwoebi @NikiC When you get a chance, can you review this: github.com/php/php-src/pull/1388
 
@Andrea because __toString().
 
@Andrea If it helps at all, this is a "because PHP" issue
 
@bwoebi oh, right
hnnnghghghgghghjgklfmn;gdfmg/f.,gfd/.gfgd;,mg
 
@bwoebi UndefinedSymbolError or simply UndefinedError (or other)?
 
9:55 PM
@Andrea That makes so much more sense than PHP, btw
7
 
@Trowski UndefinedError would be fine too, yeah
 
Would be thrown for undefined functions, methods, constants, etc.
 
@RonaldUlyssesSwanson UndefinedError is a bit like it contains variables too etc.
@Trowski I think UndefinedSymbolError is fine here.
 
@bwoebi Ok, thanks.
 
comparing to java errors, the only left is InstantiationError which should be raised when you use new on an interface|trait|abstractclass (private constructor too, maybe?)
 
10:06 PM
Is there a way to pull data from MySQL based on user selected category (multiple selection)?
 
@NikiC not sure where do you get that from that object -> int/float emits a notice?
 
Kind of like this pull.php?category=Local,Food
 
@bwoebi zend_object_handlers.c
 
@NikiC ah, but convert_to_object_type is always recoverable?
 
> Cannot use isset() on the result of an expression (you can use "null !== expression" instead)
i thought that was changed
 
10:08 PM
@NikiC that's for normal userland classes
 
@bwoebi the one in there only gets triggered for strings
@bwoebi Yes, which is the 99% case, not many classes overwriting cast_object
 
@NikiC oh, that's just for explicit cast_object… yeah, I see
@NikiC why are these notices at all?
 
@RonaldUlyssesSwanson I think it was only changed to support constants.
 
also 3v4l.org/7b6lR this is bad imho
 
@RonaldUlyssesSwanson What's bad there?
 
10:13 PM
@bwoebi What should they be?
 
@NikiC Errors IMO?
 
@kelunik nothing, just need to sleep xD
 
@RonaldUlyssesSwanson Well, your logic, yes. ^^
 
@bwoebi In principle I agree, though it's likely somewhat steep to go from notice to Error exception
 
@NikiC I don't disagree. It's just what it should be. What would you then propose if not notice?
 
10:46 PM
@NikiC Thanks for tearing apart my PR. :)
 
Can we please remove __toString completely? sigh…
 
@Trowski you're welcome ^^
 
@NikiC I thought safe_emalloc set the memory to 0, is that not the case?
 
no
 
@Trowski Only function automatically zeroing memory is calloc
safe_emalloc only does overflow checks
 
11:01 PM
@NikiC Alright. So memset(ldap_mods, 0, (num_mods+1) * sizeof(LDAPMod *)) should do it after this line?
 
I have an idea for creating a magic method.
 
@Trowski not sure why you want to memset that? you know the current i value of how much already was initialized?
 
That's true, I could just keep track of that and use it in the cleanup block.
 
@Trowski so, you could set num_mods to i - 1 and efree(ldap_mods[i]);
 
@bwoebi There's some pointers that need freeing within the LDAPMod structs in the array.
 
11:08 PM
… No, I mean
zend_throw_error(...);
RETVAL_FALSE;
efree(ldap_mods[i]);
num_mods = i - 1;
goto cleanup;
 
I have an idea for creating a magic method and I would go to any of you, for I know not program in C.
Sorry my bad english. I am brazilian
 
@RowAraujo first step is always discussing what concretely you want to add
@Trowski see what I mean?
 
@bwoebi Ok.. I'll try to explain.
 
@bwoebi Yep, now I do.
 
@Trowski because actually, you have a partially initialized element (ldap_mods[i] is allocated but pointers are bogus)
hence the memset variant isn't perfect yet
 
11:13 PM
The method is called: __toReturn.
It is very similar to __toString, but with it you can return any type of value (not just a string) except an object.
 
huh?
 
@ircmaxell I guess he means __castTo or so.
 
23 mins ago, by bwoebi
Can we please remove __toString completely? sigh…
 
@bwoebi Wouldn't it be num_mods = i?
 
11:16 PM
@Trowski right.
 
K, just making sure I'm thinking correctly.
 
class foo {
public $bar;

public function __Construct($bar)
{
$this->bar = $bar;
}

public function __toReturn(): int {
return $this->bar;
}
}

$foo = new foo('123 bar');
echo $foo;
 
@bwoebi zval_dtor(return_value) is all I need to do to deallocate a zval, correct?
 
yeah
 
Ok, wasn't sure if there was some macro magic or something.
@bwoebi Here is the branch with Error subclasses I'm working on. I have more tests to update, but I'd like to know if you think I'm using the classes appropriately (second commit).
 
11:29 PM
@Trowski what's the difference between a typeError and a valueError?
like I see you're using in zend_API.c:248 valueError for a wrong type?
can't one just merge these two?
because actually … a lot of value errors are basically type errors
like Can use "yield from" only with arrays and Traversables … classified as ValueError?
Isn't it strictly seen a typing issue?
hence… I think we maybe should just merge them @Trowski
 
@bwoebi I think I agree, since most of the conditions throwing ValueError were due to the wrong type of value. I wasn't sure if TypeError was to be reserved for type-hint mismatches.
 
@Trowski callable typehint mismatches are (currently) a zend_ce_error
so, there's something not totally right it seems
 
@bwoebi That should be a TypeError. Could you show me where that is?
 
@Trowski your changes in Zend_API.c ?
 
@bwoebi So many changes I'm loosing track of where things are.
 
11:41 PM
@Trowski does it have any benefit to distinguish these?
@Trowski hehe
 
@bwoebi I would say no. Going afk for a while. I'll think about it, but more than likely I'll just merge ValueError into TypeError. Also if you can think of a better name than UndefinedSymbolError I'm open to suggestions.
 
@Trowski I have no better suggestion.
 
How to indent text here?
i have found
 
Soo.. flying to Brazil costs less than flying to the UK...
thanks, frikken airlines.
 
"Discussion for all things PHP."
 
11:51 PM
@RowAraujo put 4 spaces before it, or use backticks (`)
 
@Ocramius yeah
//foo.php
class foo {
    public static $number = 2;
    public static $doubleNumber;

    public function __onLoad(){
        $this->doubleNumber = $this->number * 2;
    }
}

//bar.php
require 'foo.php';
echo foo::$doubleNumber; // Outputs int(1) 4
it is possible?
 
@RowAraujo why can't one just put the onload part right after the class declaration?
where's the point in it?
 
Let's assume that I load classes in a function. I can not move in the code.
 

« first day (1723 days earlier)      last day (3225 days later) »