com presentations: PHP 7.4 talk for php[world]: php-phpworld19.xml slides/internals/bishop-bettini.png slides/internals/bisshop-bettini.mp3 slides/internals/joe-watkins.jpg slides/internals/joe-watkins.mp3 slides/internals/matteo-becatti.mp3 slides/internals/matteo-becatti.png slides/internals/nikita-popov-first.mp3 slides/internals/nikita-popov.jpg slides/internals/nikita-popov.mp3 slides/internals/php74- __tostring-exceptions.xml slides/internal
[email protected] (Derick Rethans) Mon, 21 Oct 2019 16:55:48 +0000
| Newsgroups | php.pres |
|---|---|
| Message-ID | <[email protected]> |
Commit: 7b6b435da3606568a707f06ff89ecf1615f0af5a Author: Derick Rethans <[email protected]> Mon, 21 Oct 2019 17:55:48 +0100 Parents: 9f30de2a5d0b12796c19d9bd483ad7a8a8d8b83b Branches: master Link: http://git.php.net/?p=presentations.git;a=commitdiff;h=7b6b435da3606568a707f06ff89ecf1615f0af5a Log: PHP 7.4 talk for php[world] Changed paths: A php-phpworld19.xml A slides/internals/bishop-bettini.png A slides/internals/bisshop-bettini.mp3 A slides/internals/joe-watkins.jpg A slides/internals/joe-watkins.mp3 A slides/internals/matteo-becatti.mp3 A slides/internals/matteo-becatti.png A slides/internals/nikita-popov-first.mp3 A slides/internals/nikita-popov.jpg A slides/internals/nikita-popov.mp3 A slides/internals/php74-__tostring-exceptions.xml A slides/internals/php74-always-hash.xml A slides/internals/php74-arginfo.xml A slides/internals/php74-base-convert.xml A slides/internals/php74-concat-operator-precedence.xml A slides/internals/php74-custom-serialization-inheritence.xml A slides/internals/php74-custom-serialization.xml A slides/internals/php74-deprecate-curly-brace.xml A slides/internals/php74-deprecations.xml A slides/internals/php74-ffi-example.xml A slides/internals/php74-ffi.xml A slides/internals/php74-hash-argon.xml A slides/internals/php74-invalid-container-read.xml A slides/internals/php74-lsp-operator-precedence-lsp.xml A slides/internals/php74-lsp-operator-precedence.xml A slides/internals/php74-null-coalesce-assignment.xml A slides/internals/php74-numeric-literal-separator.xml A slides/internals/php74-operator-precedence-ternary.xml A slides/internals/php74-postgresql-escape.xml A slides/internals/php74-preloading-setup.xml A slides/internals/php74-preloading-with-ffi.xml A slides/internals/php74-preloading-zf.xml A slides/internals/php74-preloading.xml A slides/internals/php74-reference-reflection.xml A slides/internals/php74-saner-string-number-comparisons.xml A slides/internals/php74-short-arrow-functions-example.xml A slides/internals/php74-short-arrow-functions.xml A slides/internals/php74-spread-operator.xml A slides/internals/php74-timeline.xml A slides/internals/php74-typed-properties-read.xml A slides/internals/php74-typed-properties-write-coersive.xml A slides/internals/php74-typed-properties-write-strict.xml A slides/internals/php74-typed-properties-write.xml A slides/internals/php74-typed-properties.xml A slides/internals/php74-unbundle.xml A slides/internals/php74-variance-argument-ok.xml A slides/internals/php74-variance-argument-wrong.xml A slides/internals/php74-variance-properties-ok.xml A slides/internals/php74-variance-properties-wrong.xml A slides/internals/php74-variance-return-ok.xml A slides/internals/php74-variance-return-wrong.xml A slides/internals/php74-weakref.xml A slides/internals/phpinternalsnews-me.xml A slides/internals/phpintnews-intro.mp3 A slides/internals/phpintnews-outro.mp3 A slides/internals/phpintnews.jpg A slides/internals/queries.jpg A slides/internals/questions-new.xml A slides/internals/sara-golemon.jpg A slides/internals/sara-golemon.mp3 A slides/internals/scott-dutton.jpg A slides/internals/scott-dutton.mp3 A slides/internals/theodore-and-bishop.mp3 A slides/internals/theodore-brown-big.jpeg A slides/internals/theodore-brown.jpeg A slides/internals/theodore-brown.mp3 M slides/mongodb/me.xml A templates/default/audio.ezt M templates/default/example.ezt M templates/default/table.ezt M xdebug-phpworld19.xml
diff_7b6b435da3606568a707f06ff89ecf1615f0af5a.txt
(text/plain, 55.5 KB)
diff --git a/php-phpworld19.xml b/php-phpworld19.xml new file mode 100644 index 00000000..74987d8d --- /dev/null +++ b/php-phpworld19.xml @@ -0,0 +1,69 @@ +<?xml version="1.0" encoding="utf-8"?> +<presentation css="derick.css"> +<topic>Debugging</topic> +<title>The La(te)st PHP 7 โ What's new in PHP 7.4</title> +<event>php[world]</event> +<location>Washington DC, USA</location> +<date>October 24th, 2019</date> +<speaker>Derick Rethans</speaker> +<email>[email protected]</email> +<twitter>derickr</twitter> +<url>https://derickrethans.nl/talks/php-phpworld19</url> +<joindin>https://joind.in/26855</joindin> +<slide>slides/xdebug/title.xml</slide> +<slide>slides/mongodb/me.xml</slide> + +<slide>slides/internals/php74-typed-properties.xml</slide> +<slide>slides/internals/php74-typed-properties-read.xml</slide> +<slide>slides/internals/php74-typed-properties-write.xml</slide> +<slide>slides/internals/php74-typed-properties-write-coersive.xml</slide> +<slide>slides/internals/php74-typed-properties-write-strict.xml</slide> +<slide>slides/internals/php74-variance-return-ok.xml</slide> +<slide>slides/internals/php74-variance-return-wrong.xml</slide> +<slide>slides/internals/php74-variance-argument-ok.xml</slide> +<slide>slides/internals/php74-variance-argument-wrong.xml</slide> +<slide>slides/internals/php74-variance-properties-ok.xml</slide> +<slide>slides/internals/php74-variance-properties-wrong.xml</slide> + +<slide>slides/internals/php74-null-coalesce-assignment.xml</slide> +<slide>slides/internals/php74-spread-operator.xml</slide> +<slide>slides/internals/php74-invalid-container-read.xml</slide> + +<slide>slides/internals/php74-ffi.xml</slide> +<slide>slides/internals/php74-ffi-example.xml</slide> +<slide>slides/internals/php74-preloading.xml</slide> +<slide>slides/internals/php74-preloading-setup.xml</slide> +<slide>slides/internals/php74-preloading-zf.xml</slide> +<slide>slides/internals/php74-preloading-with-ffi.xml</slide> + +<slide>slides/internals/php74-reference-reflection.xml</slide> +<slide>slides/internals/php74-custom-serialization.xml</slide> +<slide>slides/internals/php74-custom-serialization-inheritence.xml</slide> + +<slide>slides/internals/php74-always-hash.xml</slide> +<slide>slides/internals/php74-unbundle.xml</slide> + +<slide>slides/xdebug/phpinternalsnews.xml</slide> +<slide>slides/internals/phpinternalsnews-me.xml</slide> + +<slide>slides/internals/php74-saner-string-number-comparisons.xml</slide> +<slide>slides/internals/php74-weakref.xml</slide> +<slide>slides/internals/php74-short-arrow-functions.xml</slide> +<slide>slides/internals/php74-short-arrow-functions-example.xml</slide> +<slide>slides/internals/php74-lsp-operator-precedence-lsp.xml</slide> +<slide>slides/internals/php74-operator-precedence-ternary.xml</slide> +<slide>slides/internals/php74-concat-operator-precedence.xml</slide> +<slide>slides/internals/php74-hash-argon.xml</slide> +<slide>slides/internals/php74-__tostring-exceptions.xml</slide> +<slide>slides/internals/php74-base-convert.xml</slide> +<slide>slides/internals/php74-numeric-literal-separator.xml</slide> +<slide>slides/internals/php74-deprecate-curly-brace.xml</slide> +<slide>slides/internals/php74-postgresql-escape.xml</slide> +<!-- <slide>slides/internals/php74-arginfo.xml</slide> --> +<slide>slides/internals/php74-deprecations.xml</slide> +<slide>slides/internals/php74-timeline.xml</slide> + +<slide>slides/internals/questions-new.xml</slide> +<slide>slides/xdebug/resources.xml</slide> + +</presentation> diff --git a/slides/internals/bishop-bettini.png b/slides/internals/bishop-bettini.png new file mode 100644 index 00000000..445775ff Binary files /dev/null and b/slides/internals/bishop-bettini.png differ diff --git a/slides/internals/bisshop-bettini.mp3 b/slides/internals/bisshop-bettini.mp3 new file mode 100644 index 00000000..2cb89886 Binary files /dev/null and b/slides/internals/bisshop-bettini.mp3 differ diff --git a/slides/internals/joe-watkins.jpg b/slides/internals/joe-watkins.jpg new file mode 100644 index 00000000..862f63b8 Binary files /dev/null and b/slides/internals/joe-watkins.jpg differ diff --git a/slides/internals/joe-watkins.mp3 b/slides/internals/joe-watkins.mp3 new file mode 100644 index 00000000..f2ff3234 Binary files /dev/null and b/slides/internals/joe-watkins.mp3 differ diff --git a/slides/internals/matteo-becatti.mp3 b/slides/internals/matteo-becatti.mp3 new file mode 100644 index 00000000..6dc9e3e5 Binary files /dev/null and b/slides/internals/matteo-becatti.mp3 differ diff --git a/slides/internals/matteo-becatti.png b/slides/internals/matteo-becatti.png new file mode 100644 index 00000000..93dbf7ff Binary files /dev/null and b/slides/internals/matteo-becatti.png differ diff --git a/slides/internals/nikita-popov-first.mp3 b/slides/internals/nikita-popov-first.mp3 new file mode 100644 index 00000000..33f31ccd Binary files /dev/null and b/slides/internals/nikita-popov-first.mp3 differ diff --git a/slides/internals/nikita-popov.jpg b/slides/internals/nikita-popov.jpg new file mode 100644 index 00000000..ced66067 Binary files /dev/null and b/slides/internals/nikita-popov.jpg differ diff --git a/slides/internals/nikita-popov.mp3 b/slides/internals/nikita-popov.mp3 new file mode 100644 index 00000000..843d1996 Binary files /dev/null and b/slides/internals/nikita-popov.mp3 differ diff --git a/slides/internals/php74-__tostring-exceptions.xml b/slides/internals/php74-__tostring-exceptions.xml new file mode 100644 index 00000000..ea6a8a99 --- /dev/null +++ b/slides/internals/php74-__tostring-exceptions.xml @@ -0,0 +1,42 @@ +<slide> +<title>Episode #14: __toString Exceptions</title> + +<image filename="nikita-popov.jpg" align="left" attr="Nikita Popov"/> + +Episode 14 โ __toString Exceptions โ Nikita Popov + +<example result="1"> +<?php +class ๐ฅ +{ + function __toString() + { + throw new Exception(); + } +} + +$๐ฃ = new ๐ฅ; +echo $๐ฃ; +?> +</example> +<break lines="3"/> + +<div effect="fade-out"> +<blurb>PHP 7.3:</blurb> +<example class="error"> +Fatal error: Method ๐ฅ::__toString() must not throw an exception, caught Exception +</example> +</div> + +<div effect="fade-in"> +<blurb>PHP 7.4:</blurb> +<example class="error"> +Fatal error: Uncaught Exception +</example> +</div> + +<break lines="2"/> +<blurb align="right">https://wiki.php.net/rfc/tostring_exceptions</blurb> โ https://github.com/php/php-src/pull/3887/files + +</slide> + diff --git a/slides/internals/php74-always-hash.xml b/slides/internals/php74-always-hash.xml new file mode 100644 index 00000000..f0f04168 --- /dev/null +++ b/slides/internals/php74-always-hash.xml @@ -0,0 +1,33 @@ +<slide> +<title>Always available hash extension</title> + +Always available hash extension โ Kalle Sommer Nielsen +https://wiki.php.net/rfc/permanent_hash_ext + +<blurb>PHP 7.3:</blurb> +<blurb> +<pre><span style="background-color:#4E4E4E"><font color="#FFFF55"> โฎฏ </font></span><span style="background-color:#4E4E4E">PHP-7.3 </span><span style="background-color:#303030"> ๐ท </span><span style="background-color:#303030"><font color="#FFFFFF"><b>7.3.6-dev</b></font></span><span style="background-color:#303030"> </span><span style="background-color:#303030"><font color="#AA0000">๏ผก๏ผต </font></span><span style="background-color:#303030"><font color="#55FF55"><b>๏ผค๏ผฎ</b></font></span><span style="background-color:#303030"><font color="#55FFFF"><b>โถโด</b></font></span><span style="background-color:#262626"> ๐ฟ </span><span style="background-color:#262626"><font color="#FFFFFF"><b>3.0.0-dev</b></font></span><span style="background-color:#303030"> </span><span style="background-color:#1C1C1C"> </span> +<span style="background-color:#4E4E4E"><font color="#55FF55"><b>derick@singlemalt</b></font>:<font color="#5555FF"><b>~/dev/php/php-src.git</b></font>$ ./configure --help | grep hash + --with-mhash=DIR Include mhash support + --disable-hash Disable hash support +</span></pre> +</blurb> + +<break/> + +<div effect="fade-in"> +<blurb>PHP 7.4:</blurb> +<blurb> +<pre><span style="background-color:#4E4E4E"><font color="#FFFF55"> โฎฏ </font></span><span style="background-color:#4E4E4E">PHP-7.3 </span><span style="background-color:#303030"> ๐ท </span><span style="background-color:#303030"><font color="#FFFFFF"><b>7.4.0-dev</b></font></span><span style="background-color:#303030"> </span><span style="background-color:#303030"><font color="#AA0000">๏ผก๏ผต </font></span><span style="background-color:#303030"><font color="#55FF55"><b>๏ผค๏ผฎ</b></font></span><span style="background-color:#303030"><font color="#55FFFF"><b>โถโด</b></font></span><span style="background-color:#262626"> ๐ฟ </span><span style="background-color:#262626"><font color="#FFFFFF"><b>3.0.0-dev</b></font></span><span style="background-color:#303030"> </span><span style="background-color:#1C1C1C"> </span> +<span style="background-color:#4E4E4E"><font color="#55FF55"><b>derick@singlemalt</b></font>:<font color="#5555FF"><b>~/dev/php/php-src.git</b></font>$ ./configure --help | grep hash + --with-mhash=DIR Include mhash support +</span></pre> +</blurb> +</div> + +<div effect="fade-in"> +<blurb class="centre">~yes, I know this one is boring~</blurb> +</div> + +</slide> + diff --git a/slides/internals/php74-arginfo.xml b/slides/internals/php74-arginfo.xml new file mode 100644 index 00000000..2cb9ce69 --- /dev/null +++ b/slides/internals/php74-arginfo.xml @@ -0,0 +1,9 @@ +<slide> +<title>Episode #27: Argument Information</title> + +<image filename="nikita-popov.jpg" align="left" attr="Nikita Popov"/> + +Episode 27 โ Argument Information โ Nitita Popov +??? +</slide> + diff --git a/slides/internals/php74-base-convert.xml b/slides/internals/php74-base-convert.xml new file mode 100644 index 00000000..fcc837a7 --- /dev/null +++ b/slides/internals/php74-base-convert.xml @@ -0,0 +1,47 @@ +<slide> +<title>Episode #15: Base Convert Improvements</title> + +Episode 15 โ Base Convert Improvements โ Scott Dutton +https://wiki.php.net/rfc/base_convert_improvements#vote โ https://github.com/php/php-src/pull/4328/files + +<audio filename="scott-dutton.mp3"/> + +<image filename="scott-dutton.jpg" align="right" attr="Scott Dutton"/> + +<blurb>%base_convert% โ ~Convert a number between arbitrary bases~</blurb> +<example> +base_convert (string $number, int $fromBase, int $toBase ) : string +</example> + +<blurb>What does this output?</blurb> +<example> +<?php +echo base_convert("hello world", 16, 10), "\n"; +?> +</example> + +<div effect="fade-in"> +<example inline="1" class="result"> +|ffffff|237| +</example> +</div> + +<div effect="fade-in"> +<blurb>This is what it really does:</blurb> +<example inline="1"> +&lt;?php +echo base_convert("|cccccc|h||ff0000|e||cccccc|llo worl||ff0000|d|", 16, 10), "\n"; +?> +</example> +</div> + +<div effect="fade-in"> +<blurb>In PHP 7.4:</blurb> +<example class="error"> +Deprecated: Invalid characters passed for attempted conversion, these have been ignored +</example> +</div> + +Negative didn't pass +</slide> + diff --git a/slides/internals/php74-concat-operator-precedence.xml b/slides/internals/php74-concat-operator-precedence.xml new file mode 100644 index 00000000..e1bdb27b --- /dev/null +++ b/slides/internals/php74-concat-operator-precedence.xml @@ -0,0 +1,34 @@ +<slide> +<title>Episode #10: LSP and Operator Precedence</title> + +Episode 10 โ LSP and Operator Precedence โ Nikita Popov +https://wiki.php.net/rfc/ternary_associativity โ https://github.com/php/php-src/pull/4017/files#diff-02b0ba36e963ebca22e7f764721073a5R1 +http://wiki.php.net/rfc/concatenation_precedence โ Deprecate only: https://github.com/php/php-src/pull/4001/files + +<blurb>What does this return?</blurb> +<example> +<?php +$a = 3; $b = 7; +echo "sum: " . $a + $b; +?> +</example> + +<div effect="fade-in"> +<blurb>Result:</blurb> +<blurb class="result"><example inline="1">|ffffff|7|</example></blurb> +</div> + +<div effect="fade-in"> +<break/> +<blurb>In PHP 7.4:</blurb> +<example class="error"> +Deprecated: The behavior of unparenthesized expressions containing both '.' and '+'/'-' โ + will change in PHP 8: '+'/'-' will take a higher precedence in Standard input code on line 3 +</example> + +<break/> +<blurb>~The impact to existing open-source code is de facto invisible; all found occurrences are actual bugs. This is a strong indicator that the overall impact will also be very minimal.~</blurb> +</div> + +</slide> + diff --git a/slides/internals/php74-custom-serialization-inheritence.xml b/slides/internals/php74-custom-serialization-inheritence.xml new file mode 100644 index 00000000..6550aef1 --- /dev/null +++ b/slides/internals/php74-custom-serialization-inheritence.xml @@ -0,0 +1,30 @@ +<slide> +<title>New custom object serialization mechanism</title> + +<example result="1"> +<?php +class ๐ฅ { + private $temperature = 5000; + + public function __serialize(): array { return ['t' => $this->temperature]; } + public function __unserialize(array $data) { $this->temperature = $data['t']; } +} + +class โญ extends ๐ฅ { + private $size = 695510000; + + public function __serialize(): array { + return [ + 's' => $this->size, + '๐ฅ' => parent::__serialize(), + ]; + } + public function __unserialize(array $data) { + parent::__unserialize( $data['๐ฅ'] ); + $this->size = $data['s']; + } +} +echo serialize( $test = new โญ ); +</example> + +</slide> diff --git a/slides/internals/php74-custom-serialization.xml b/slides/internals/php74-custom-serialization.xml new file mode 100644 index 00000000..9f5d5c89 --- /dev/null +++ b/slides/internals/php74-custom-serialization.xml @@ -0,0 +1,38 @@ +<slide> +<title>New custom object serialization mechanism</title> + +New custom object serialization mechanism +https://wiki.php.net/rfc/custom_object_serialization โ https://github.com/php/php-src/pull/3761/files + +<blurb>PHP's serialisation mechanisms:</blurb> +<list> + <bullet>Serializable interface</bullet> + <bullet>The __sleep()/__wakeup() magic methods</bullet> +</list> +<div effect="fade-in"> +<list> + <bullet> + <blurb>Two new *magic methods*:</blurb> +<example> +public function __serialize(): array; +public function __unserialize(array $data): void; +</example> + </bullet> +</list> + +<example> +class ๐ฅ { + private $temperature; + + public function __serialize(): array { + return ["t" => $this->temperature]; + } + public function __unserialize(array $data) { + $this->temperature = $data['t']; + } +} +</example> +</div> + +</slide> + diff --git a/slides/internals/php74-deprecate-curly-brace.xml b/slides/internals/php74-deprecate-curly-brace.xml new file mode 100644 index 00000000..83cd07fa --- /dev/null +++ b/slides/internals/php74-deprecate-curly-brace.xml @@ -0,0 +1,30 @@ +<slide> +<title>Episode #19: Deprecate curly brace syntax for accessing array elements and string offsets</title> + +<audio filename="theodore-brown.mp3"/> + +<image filename="theodore-brown-big.jpeg" align="left" attr="Theodore Brown"/> +Episode 19 โ Deprecate curly brace syntax for accessing array elements and string offsets โ with Theodore Brown +https://wiki.php.net/rfc/deprecate_curly_braces_array_access โ https://github.com/php/php-src/pull/4416/files + +<example result="1"> +<?php +$๐ป = [ 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144 ]; +echo $๐ป[4], "\n"; +echo $๐ป{4}, "\n"; + +$๐ = "Christmas Tree"; +echo $๐[4], "\n"; +echo $๐{4}, "\n"; +?> +</example> + +<div effect="fade-in"> +<blurb>In PHP 7.4:</blurb> +<example class="error"> +Deprecated: Array and string offset access syntax with curly braces is deprecated +Deprecated: Array and string offset access syntax with curly braces is deprecated +</example> +</div> + +</slide> diff --git a/slides/internals/php74-deprecations.xml b/slides/internals/php74-deprecations.xml new file mode 100644 index 00000000..0be6369f --- /dev/null +++ b/slides/internals/php74-deprecations.xml @@ -0,0 +1,23 @@ +<slide> +<title>Deprecations in PHP 7.4</title> + +<list class="noicon"> +<bullet>๐ฅ The ~real~ type</bullet> +<bullet>๐ฅ %FILTER_SANITIZE_MAGIC_QUOTES% filter</bullet> +<bullet>๐ฅ Magic quotes legacy</bullet> +<bullet>๐ฅ %array_key_exists()% with objects</bullet> +<bullet>๐ฅ Reflection %export()% methods</bullet> +<bullet>๐ฅ %mb_strrpos()% with encoding as 3rd argument</bullet> +<bullet>๐ฅ %implode()% parameter order mix</bullet> +<bullet>๐ฅ Unbinding %$this% from non-static closures</bullet> +<bullet>๐ฅ %hebrevc()% function</bullet> +<bullet>๐ฅ %convert_cyr_string()% function</bullet> +<bullet>๐ฅ %money_format()% function โ %NumberFormatter::formatCurrency()%</bullet> +<bullet>๐ฅ %ezmlm_hash()% function</bullet> +<bullet>๐ฅ %restore_include_path()% function</bullet> +<bullet>๐ฅ %allow_url_include% INI directive</bullet> +</list> + +??? +</slide> + diff --git a/slides/internals/php74-ffi-example.xml b/slides/internals/php74-ffi-example.xml new file mode 100644 index 00000000..d6039255 --- /dev/null +++ b/slides/internals/php74-ffi-example.xml @@ -0,0 +1,31 @@ +<slide> +<title>FFI โ Foreign Function Interface</title> + +<blurb>Simple header file with defintions:</blurb> +<example> +void sunpos(double d, double *L, double *M, double *ra, double *decl, double *rad); +</example> + +<break/> + +<blurb>In PHP, load definitions and call:</blurb> +<example> +<?php +$ffi = FFI::load(__DIR__ . '/astro.h'); + +$dayNr = (time() - 946598400) / 86400.0; + +$L = FFI::new('double'); +$M = FFI::new('double'); +$ra = FFI::new('double'); +$decl = FFI::new('double'); +$rad = FFI::new('double'); + +$ffi->sunpos( + $dayNr, + FFI::addr($L), FFI::addr($M), FFI::addr($ra), FFI::addr($decl), FFI::addr($rad) +); +</example> + +</slide> + diff --git a/slides/internals/php74-ffi.xml b/slides/internals/php74-ffi.xml new file mode 100644 index 00000000..9f447806 --- /dev/null +++ b/slides/internals/php74-ffi.xml @@ -0,0 +1,21 @@ +<slide> +<title>FFI โ Foreign Function Interface</title> + +FFI - Foreign Function Interface โ Dmitri Stogov + +<break lines="3"/> +<blurb class="big-centre">๐ฒ ยกHere Be Dragons! ๐ฒ</blurb> +<break lines="1"/> + +<list class="centre"> + <bullet>๐ A way to directly talk to C libraries from PHP</bullet> + <bullet>๐ Bundled with PHP 7.4, but not enabled by default</bullet> + <bullet>๐ท Consider it experimental</bullet> + <bullet>๐ซ๐ท Documentation, qu'est-ce que c'est?</bullet> +</list> + +<break lines="2"/> +<blurb align="right">https://wiki.php.net/rfc/ffi</blurb> โ https://github.com/php/php-src/commit/e089d506d5c7716c62cee5232d32ab22d0ddde26 + +</slide> + diff --git a/slides/internals/php74-hash-argon.xml b/slides/internals/php74-hash-argon.xml new file mode 100644 index 00000000..52ca478c --- /dev/null +++ b/slides/internals/php74-hash-argon.xml @@ -0,0 +1,60 @@ +<slide> +<title>Episode #12: Argon2 support from Sodium</title> + +<audio filename="sara-golemon.mp3"/> + +<image filename="sara-golemon.jpg" align="right" attr="Sara Golemon"/> +Episode 12 โ Argon โ Sara Golemon +Password Hashing Registry โ Sara Golemon +https://wiki.php.net/rfc/password_registry โ https://github.com/php/php-src/pull/3609 + +<div effect="fade-out"> +<example> +<?php +print_r(password_algos()); +?> +</example> + +<blurb>Result</blurb> +<example inline="1" class="result"> +|ffffff|Array| +|ffffff|(| +|ffffff| [0] => 2y| +|ffffff|)| +</example> +</div> + +<div effect="fade-in-out"> +<example inline="1" class="result"> +|ffffff|Array| +|ffffff|(| +|ffffff| [0] => 2y| +|ffffff| [1] => argon2i| +|ffffff| [2] => argon2id| +|ffffff|)| +</example> +</div> + +<div effect="fade-in"> +<example> +password_hash(string $password, int $algo, array $options) : string +password_verify(string $password, string $hash) : bool +</example> +<blurb>Options:</blurb> +<list> + <bullet> + *memory_cost*: Maximum memory to compute the hash. Defaults to 64kb. + </bullet> + <bullet> + *time_cost*: Maximum amount of time to compute the hash. Defaults to 4. + </bullet> + <bullet> + *threads*: Number of threads to use for computing the hash. Defaults to 1. + </bullet> +</list> +<blurb><small>(The defaults are %PASSWORD_ARGON2_DEFAULT_MEMORY_COST%, %PASSWORD_ARGON2_DEFAULT_TIME_COST%, %PASSWORD_ARGON2_DEFAULT_THREADS%, which may change over time)</small></blurb> +</div> +Argon2 support from sodium โ Sara Golemon +https://wiki.php.net/rfc/sodium.argon.hash โ https://github.com/php/php-src/pull/4012/files +</slide> + diff --git a/slides/internals/php74-invalid-container-read.xml b/slides/internals/php74-invalid-container-read.xml new file mode 100644 index 00000000..9731c4e9 --- /dev/null +++ b/slides/internals/php74-invalid-container-read.xml @@ -0,0 +1,37 @@ +<slide> +<title>E_WARNING for invalid container read array-access</title> + +E_WARNING for invalid container read array-access โ David Walker +https://wiki.php.net/rfc/notice-for-non-valid-array-container โ https://github.com/php/php-src/pull/4386 + +<example result="0"> +<?php +xdebug_disable(); error_reporting(-1); + +$var = false; +$var[1][2][3][4][5]; + +$var = array(123); +$var[0][1]; + +$a = [null]; +$c = null; +$b = ($a[0][0] + $c[0]); +</example> + +<div effect="fade-in"> +<example class="error"> +Notice: Trying to access array offset on value of type bool in /tmp/example.php on line 6 +Notice: Trying to access array offset on value of type null in /tmp/example.php on line 6 +Notice: Trying to access array offset on value of type null in /tmp/example.php on line 6 +Notice: Trying to access array offset on value of type null in /tmp/example.php on line 6 +Notice: Trying to access array offset on value of type null in /tmp/example.php on line 6 + +Notice: Trying to access array offset on value of type int in /tmp/example.php on line 9 + +Notice: Trying to access array offset on value of type null in /tmp/example.php on line 13 +Notice: Trying to access array offset on value of type null in /tmp/example.php on line 13 +</example> +</div> + +</slide> diff --git a/slides/internals/php74-lsp-operator-precedence-lsp.xml b/slides/internals/php74-lsp-operator-precedence-lsp.xml new file mode 100644 index 00000000..c8b6d6b4 --- /dev/null +++ b/slides/internals/php74-lsp-operator-precedence-lsp.xml @@ -0,0 +1,35 @@ +<slide> +<title>Episode #10: LSP and Operator Precedence</title> + +Episode 10 โ LSP and Operator Precedence โ Nikita Popov +https://wiki.php.net/rfc/lsp_errors โ https://github.com/php/php-src/pull/4000/files +https://wiki.php.net/rfc/ternary_associativity โ https://github.com/php/php-src/pull/4017/files#diff-02b0ba36e963ebca22e7f764721073a5R1 +http://wiki.php.net/rfc/concatenation_precedence โ Deprecate only: https://github.com/php/php-src/pull/4001/files + +<div effect="fade-out"> +<blurb>Compare:</blurb> +<example> +interface I { + public function method(array $a); +} +class C implements I { + public function method(int $a) {} +} +// Fatal error: Declaration of C::method(int $a) must be compatible with I::method(array $a) +</example> + +<blurb>With:</blurb> +<example>class C1 { + public function method(array $a) {} +} +class C2 extends C1 { + public function method(int $a) {} +} +// Warning: Declaration of C2::method(int $a) should be compatible with C1::method(array $a) +</example> +</div> + +<div effect="fade-in"><blurb class="big-centre"><break lines="2"/>PHP 8 โ ๐ฅ</blurb></div> + +</slide> + diff --git a/slides/internals/php74-lsp-operator-precedence.xml b/slides/internals/php74-lsp-operator-precedence.xml new file mode 100644 index 00000000..9190677a --- /dev/null +++ b/slides/internals/php74-lsp-operator-precedence.xml @@ -0,0 +1,10 @@ +<slide> +<title>Episode #10: LSP and Operator Precedence</title> + +Episode 10 โ LSP and Operator Precedence โ Nikita Popov +https://wiki.php.net/rfc/ternary_associativity โ https://github.com/php/php-src/pull/4017/files#diff-02b0ba36e963ebca22e7f764721073a5R1 +http://wiki.php.net/rfc/concatenation_precedence โ Deprecate only: https://github.com/php/php-src/pull/4001/files + + +</slide> + diff --git a/slides/internals/php74-null-coalesce-assignment.xml b/slides/internals/php74-null-coalesce-assignment.xml new file mode 100644 index 00000000..c876bca9 --- /dev/null +++ b/slides/internals/php74-null-coalesce-assignment.xml @@ -0,0 +1,38 @@ +<slide> +<title>Null Coalescing Assignment Operator</title> + +Null Coalescing Assignment Operator โ Midori Kocak +https://wiki.php.net/rfc/null_coalesce_equal_operator โ https://github.com/php/php-src/pull/1795 + +<blurb>Assignment Operator:</blurb> +<example> +<?php +$rad = $degrees * M_PI / 180; +$angle *= (M_PI / 180); +?> +</example> + +<break/> + +<div effect="fade-in"> +<blurb>Null Coalesce Operator:</blurb> +<example> +<?php +$this->data['comments']['user_id'] = $this->data['comments']['user_id'] ?? 'value'; +?> +</example> +</div> + +<break/> + +<div effect="fade-in"> +<blurb>Null Coalesce Assignment Operator:</blurb> +<example> +<?php +$this->data['comments']['user_id'] ??= 'value'; +?> +</example> +</div> + +</slide> + diff --git a/slides/internals/php74-numeric-literal-separator.xml b/slides/internals/php74-numeric-literal-separator.xml new file mode 100644 index 00000000..cd84a30b --- /dev/null +++ b/slides/internals/php74-numeric-literal-separator.xml @@ -0,0 +1,51 @@ +<slide> +<title>Episode #17: Numeric Literal Separator</title> + +Episode 17 โ Numeric Literal Separator โ Theodore Brown and Bishop Bettini +https://wiki.php.net/rfc/numeric_literal_separator โ https://github.com/php/php-src/pull/4165/files + +<audio filename="theodore-and-bishop.mp3"/> + +<image filename="theodore-brown.jpeg" align="right" attr="Theodore Brown"/> +<image filename="bishop-bettini.png" align="right" attr="Bishop Bettini"/> + +<blurb>Representing big numbers:</blurb> +<div effect="fade-out"> +<example> +const ASTRONOMICAL_UNIT = 149597870700; +const SPEED_OF_LIGHT = 299792458; +const EARTH_RADIUS = 6378137; +</example> +</div> + +<div effect="fade-in"> +<example> +const ASTRONOMICAL_UNIT = 149_597_870_700; +const SPEED_OF_LIGHT = 299_792_458; +const EARTH_RADIUS = 6_378_137; +</example> +</div> +<break lines="3"/> +<div effect="fade-in"> +<blurb>Also works for floats, hexadecimal, octal, and binary:</blurb> +<example> +$ฯ = 3.141_592_653_589_793_238_462_643_383_279_502_884_197_169_399_375_105_820_974_944_592_307_816_406_286_208_998_628_034_825_342_117_067_982_148_086_513_282_306_647_093_844_609_550_582_231_725_359_408; +$ttwatch = 0x0085_0001; +$perms = 04_755; +$gpio = 0b01010100_01101000_01100101_01101111; +</example> +</div> + +<break/> + +<div effect="fade-in"> +<blurb>To avoid:</blurb> + +<example> +$phoneNumber = 345_6789; +$creditCard = 231_6547_9081_2543; +$socialSecurity = 111_11_1111; +</example> +</div> + +</slide> diff --git a/slides/internals/php74-operator-precedence-ternary.xml b/slides/internals/php74-operator-precedence-ternary.xml new file mode 100644 index 00000000..a6120833 --- /dev/null +++ b/slides/internals/php74-operator-precedence-ternary.xml @@ -0,0 +1,29 @@ +<slide> +<title>Episode #10: LSP and Operator Precedence</title> + +Episode 10 โ LSP and Operator Precedence โ Nikita Popov +https://wiki.php.net/rfc/ternary_associativity โ https://github.com/php/php-src/pull/4017/files#diff-02b0ba36e963ebca22e7f764721073a5R1 +http://wiki.php.net/rfc/concatenation_precedence โ Deprecate only: https://github.com/php/php-src/pull/4001/files + +<blurb>What does this return?</blurb> +<example result="1"> +<?php +$a = 3; +echo $a == 1 ? 'one' : $a == 2 ? 'two' : $a == 3 ? 'three' : $a == 4 ? 'four' : 'other', "\n"; +?> +</example> + +<div effect="fade-in"> +<break/> +<blurb>In PHP 7.4:</blurb> +<example class="error"> +Deprecated: Unparenthesized `a ? b : c ? d : e` is deprecated. Use either `(a ? b : c) ? d : e` or `a ? b : (c ? d : e)` in Standard input code on line 3 + +Deprecated: Unparenthesized `a ? b : c ? d : e` is deprecated. Use either `(a ? b : c) ? d : e` or `a ? b : (c ? d : e)` in Standard input code on line 3 + +Deprecated: Unparenthesized `a ? b : c ? d : e` is deprecated. Use either `(a ? b : c) ? d : e` or `a ? b : (c ? d : e)` in Standard input code on line 3 +</example> +</div> + +</slide> + diff --git a/slides/internals/php74-postgresql-escape.xml b/slides/internals/php74-postgresql-escape.xml new file mode 100644 index 00000000..1c9f8561 --- /dev/null +++ b/slides/internals/php74-postgresql-escape.xml @@ -0,0 +1,31 @@ +<slide> +<title>Episode #22: PostGreSQL escape characters</title> + +<audio filename="matteo-becatti.mp3"/> + +<image filename="matteo-becatti.png" align="right" attr="Matteo Becatti"/> + +Episode 22 โ PostGreSQL escape characters โ with Matteo Beccati + +<blurb>*Given:*</blurb> +<list> + <bullet>*That:* PDO uses %?% as prepared value place holder</bullet> + <bullet>*And:* New SQL syntax uses %?% as an operator: +<example> +SELECT * FROM tbl WHERE json_col ? 'foo'; +</example> + </bullet> + <bullet>*Then:* We're in trouble</bullet> +</list> + +<div effect="fade-in"> +<break lines="3"/> +<blurb>PHP 7.4 has an escape character to provide the solution:</blurb> +<example inline="1"> +$stmt = $pdo->prepare('SELECT \* FROM tbl WHERE json_col *??* ?'); +</example> +</div> + +https://wiki.php.net/rfc/pdo_escape_placeholders โ https://github.com/php/php-src/pull/4217/files#diff-ebfd69a4c47ba09ff22a1b349e499292R22 +</slide> + diff --git a/slides/internals/php74-preloading-setup.xml b/slides/internals/php74-preloading-setup.xml new file mode 100644 index 00000000..f1f2162f --- /dev/null +++ b/slides/internals/php74-preloading-setup.xml @@ -0,0 +1,25 @@ +<slide> +<title>Preloading</title> +<subtitle>Example</subtitle> + +<blurb>Enable *%opcache.preload%*:</blurb> +<example inline="1"> +php \ + -dopcache.enable=1 -dopcache.enable_cli=1 *-d opcache.preload=preload.inc* \ + -d ffi.enable=1 \ + -S 0.0.0.0:8080 +</example> + +<break lines="2"/> + +<blurb>Stats:</blurb> +<example> +var_dump(opcache_get_status()['preload_statistics']); +</example> + +<break lines="2"/> + +<blurb>Once loaded, only a restart of the web server (or PHP-FPM) will reload files</blurb> + +</slide> + diff --git a/slides/internals/php74-preloading-with-ffi.xml b/slides/internals/php74-preloading-with-ffi.xml new file mode 100644 index 00000000..0665998b --- /dev/null +++ b/slides/internals/php74-preloading-with-ffi.xml @@ -0,0 +1,36 @@ +<slide> +<title>Preloading and FFI</title> + +FFI - Foreign Function Interface โ Dmitri Stogov + +<blurb class="center">๐ Processing FFI on each request is slow, but preloading is fast! ๐</blurb> + +<break lines="1"/> + +<blurb>%preload.inc%:</blurb> +<example> +<?php +FFI::load(__DIR__ . '/astro-preload.h'); +</example> + +<blurb>%astro-preload.h%:</blurb> +<example> +#define FFI_SCOPE "ASTRO" + +void sunpos(double d, double *L, double *M, double *ra, double *decl, double *rad); +</example> + +<blurb>Run:</blurb> + +<example> +<?php +$ffi = FFI::scope('ASTRO'); +โฆ +$ffi->sunpos( + $dayNr, + FFI::addr($L), FFI::addr($M), FFI::addr($ra), FFI::addr($decl), FFI::addr($rad) +); +</example> + +</slide> + diff --git a/slides/internals/php74-preloading-zf.xml b/slides/internals/php74-preloading-zf.xml new file mode 100644 index 00000000..6a43017b --- /dev/null +++ b/slides/internals/php74-preloading-zf.xml @@ -0,0 +1,31 @@ +<slide> +<title>Preloading โ Zend Framework</title> + +<example inline="2"> +&lt;?php +function _preload( $path, *string $pattern = '/\.php$/'*) +{ + if ( is_dir( $path ) ) { + if ( $dh = opendir( $path ) ) { + while ( ( $file = readdir( $dh ) ) !== false ) { + if ( $file !== '.' && $file !== '..' ) { + _preload( $path . '/' . $file, $pattern ); + } + } + closedir( $dh ); + } + } else if ( is_file( $path ) && preg_match( $pattern, $path ) ) { + if ( *!opcache_compile_file($path)* ) { + trigger_error( 'Preloading Failed', E_USER_ERROR ); + } + } +} + +_preload( '/var/www/ZendFramework/library' ); +</example> + +<break/> +<blurb class="centre">Alternatively, you may just include all files instead of %opcache_compile_file()%</blurb> + +</slide> + diff --git a/slides/internals/php74-preloading.xml b/slides/internals/php74-preloading.xml new file mode 100644 index 00000000..3f78a7ac --- /dev/null +++ b/slides/internals/php74-preloading.xml @@ -0,0 +1,22 @@ +<slide> +<title>Preloading</title> + +Preloading โ Dmitri Stogov + +<list> + <bullet>OPcache is awesome</bullet> + <bullet>It prevents a lot of work "compiling" PHP files</bullet> + <bullet>Still overhead: class resolving, checking whether files have modified, cache size/evictions</bullet> +</list> + +<div effect="fade-in"> +<break lines="2"/> +<blurb>Added in 7.4:</blurb> +<blurb class="center">A new %php.ini% directive: *%opcache.preload%*</blurb> +<blurb>With this directive you can specify a single PHP file which will perform the preloading task.</blurb> + +<break lines="2"/> +<blurb align="right">https://wiki.php.net/rfc/preload</blurb> โ https://github.com/php/php-src/pull/3538 +</div> +</slide> + diff --git a/slides/internals/php74-reference-reflection.xml b/slides/internals/php74-reference-reflection.xml new file mode 100644 index 00000000..407f0341 --- /dev/null +++ b/slides/internals/php74-reference-reflection.xml @@ -0,0 +1,43 @@ +<slide> +<title>Reflection for references</title> + +Reflection for references โ Nikita Popov +https://wiki.php.net/rfc/reference_reflection โ https://github.com/php/php-src/pull/3550/files#diff-3d0f8818dac092be87cf355bee98bccfR2 + +<div effect="fade-out"> +<blurb>Detecting if %$array1[$key]% is a reference:</blurb> +<example> +<?php +$array2 = $array1; +$array2[$key] = $unique_cookie; +if ($array1[$key] === $unique_cookie) { + // $array1[$key] is a reference +} +?> +</example> +<blurb>No longer will work reliably in PHP 7.4 due to typed properties, so %ReferenceReflection% was added.</blurb> +</div> + +<div effect="fade-in"> +<example result="1"> +<?php +$array = [0, 1, 2]; +$ref1 =& $array[1]; +$ref2 =& $array[2]; +$array[3] =& $array[2]; + +$r0 = ReflectionReference::fromArrayElement($array, 0); +$r1 = ReflectionReference::fromArrayElement($array, 1); +$r2 = ReflectionReference::fromArrayElement($array, 2); +$r3 = ReflectionReference::fromArrayElement($array, 3); + +var_dump( $r0, $r1 ); + +echo base64_encode( $r1->getId() ), "\n"; +echo base64_encode( $r2->getId() ), "\n"; +echo base64_encode( $r3->getId() ), "\n"; +</example> +</div> + +</slide> + diff --git a/slides/internals/php74-saner-string-number-comparisons.xml b/slides/internals/php74-saner-string-number-comparisons.xml new file mode 100644 index 00000000..238bbc7e --- /dev/null +++ b/slides/internals/php74-saner-string-number-comparisons.xml @@ -0,0 +1,28 @@ +<slide> +<title>Episode #1: Saner String Number Comparisons</title> + +<audio filename="nikita-popov-first.mp3"/> + +<image filename="nikita-popov.jpg" align="left" attr="Nikita Popov"/> + +<div effect="fade-out"> +<blurb>Proposal:</blurb> + +<table style="width: 70%; align: right; font-size: 200%"> +<tr><th>Comparison</th><th>Before</th><th>After</th></tr> +<tr><td>% 0 == "0" %</td><td>true </td><td>true</td></tr> +<tr><td>% 0 == "0.0" %</td><td>true </td><td>true</td></tr> +<tr><td>% 0 == "foo" %</td><td>true </td><td>false</td></tr> +<tr><td>% 0 == "" %</td><td>true </td><td>false</td></tr> +<tr><td>%42 == "    42"%</td><td>true </td><td>true</td></tr> +<tr><td>%42 == "42foo"%</td><td>true </td><td>false</td></tr> +</table> + +<blurb align="right">*RFC*: https://wiki.php.net/rfc/string_to_number_comparison</blurb> โ https://github.com/php/php-src/pull/3787/files +</div> + +<div effect="fade-in"> +<blurb class="big-centre">PHP 8?</blurb> +</div> +</slide> + diff --git a/slides/internals/php74-short-arrow-functions-example.xml b/slides/internals/php74-short-arrow-functions-example.xml new file mode 100644 index 00000000..37de34b7 --- /dev/null +++ b/slides/internals/php74-short-arrow-functions-example.xml @@ -0,0 +1,32 @@ +<slide> +<title>Episode #4: Short Arrow Functions</title> + +<blurb>Syntax:</blurb> + +<example> +$arrow = fn($x) => $x + $y; +</example> +<break/> + + +<list> + <bullet>Variables automatically captured *by-value*</bullet> + <bullet>Shorter prefix: %fn%</bullet> + <bullet>Implicit return is *one* expression</bullet> +</list> + +<break/> + +<blurb>Great for filter:</blurb> +<example> +$this->existingSchemaPaths = array_filter($paths, function ($v) use ($names) { + return in_array($v, $names); +}); +</example> +<blurb>Becomes:</blurb> +<example> +$this->existingSchemaPaths = array_filter($paths, fn($v) => in_array($v, $names)); +</example> + +</slide> + diff --git a/slides/internals/php74-short-arrow-functions.xml b/slides/internals/php74-short-arrow-functions.xml new file mode 100644 index 00000000..bb4fda4e --- /dev/null +++ b/slides/internals/php74-short-arrow-functions.xml @@ -0,0 +1,38 @@ +<slide> +<title>Episode #4: Short Arrow Functions</title> + +Episode 4 โ Short Arrow Functions โ Nikita Popov + +<audio filename="nikita-popov.mp3"/> + +<image filename="nikita-popov.jpg" align="left" attr="Nikita Popov"/> + +<blurb>Arrow functions have the following basic form:</blurb> + +<example> +fn(parameter_list) => expr +</example> + +<blurb>Traditional Closure:</blurb> + +<example> +$arrow = function ($x) use ($y) { + return $x + $y; +}; +</example> + +<div effect="fade-out"> +<break lines="9"/></div> +<div effect="fade-in"> +<blurb>New Short Closure:</blurb> + +<example> +$arrow = fn($x) => $x + $y; +</example> +<break lines="5"/> +</div> + +<blurb align="right">https://wiki.php.net/rfc/arrow_functions_v2</blurb> โ https://github.com/php/php-src/pull/3941/files + +</slide> + diff --git a/slides/internals/php74-spread-operator.xml b/slides/internals/php74-spread-operator.xml new file mode 100644 index 00000000..03fbdcd7 --- /dev/null +++ b/slides/internals/php74-spread-operator.xml @@ -0,0 +1,17 @@ +<slide> +<title>Spread Operator in Array Expression</title> + +Spread Operator in Array Expression โ CHU Zhaowei +https://wiki.php.net/rfc/spread_operator_for_array โ https://github.com/php/php-src/pull/3640/files#diff-09edb373156c57c4d53fe48c3f3b5adbR17 + +<example class="big" result="1"> +<?php +$apples = [ '๐', '๐' ]; +$fruits = [ '๐', '๐', ...$apples, '๐', '๐ ' ]; + +echo "Fruit salad: ", implode( '', $fruits ), "\n"; +?> +</example> + +</slide> + diff --git a/slides/internals/php74-timeline.xml b/slides/internals/php74-timeline.xml new file mode 100644 index 00000000..3aba13ec --- /dev/null +++ b/slides/internals/php74-timeline.xml @@ -0,0 +1,11 @@ +<slide> +<title>WHEN IS IT READY?!</title> + +<break lines="5"/> +<div effect="fade-in"> +<blurb class="big-centre">November 28th</blurb> +</div> +<div effect="fade-in"> +<blurb class="centre">(possibly) ๐ </blurb> +</div> +</slide> diff --git a/slides/internals/php74-typed-properties-read.xml b/slides/internals/php74-typed-properties-read.xml new file mode 100644 index 00000000..1a72b719 --- /dev/null +++ b/slides/internals/php74-typed-properties-read.xml @@ -0,0 +1,27 @@ +<slide> +<title>Typed Properties</title> + +<example> +<?php +class ๐ฅ +{ + public int $age; + protected Distillery $distillery; + private ?Bottler $bottler; +} + +$whisky = new ๐ฅ; + +echo $whisky->age; +?> +</example> +<break/> +<div effect="fade-in"> +<blurb class="error"> +Error: Typed property ๐ฅ::$age must not be accessed before initialization +</blurb> + +<break lines="2"/> +<blurb class="centre">Uninitialized state is checked when reading</blurb> +</div> +</slide> diff --git a/slides/internals/php74-typed-properties-write-coersive.xml b/slides/internals/php74-typed-properties-write-coersive.xml new file mode 100644 index 00000000..81bfc465 --- /dev/null +++ b/slides/internals/php74-typed-properties-write-coersive.xml @@ -0,0 +1,25 @@ +<slide> +<title>Typed Properties</title> + +<example result="1"> +<?php +class ๐ฅ +{ + public int $age; + protected Distillery $distillery; + private ?Bottler $bottler; +} + +$whisky = new ๐ฅ; +$whisky->age = "29"; + +var_dump($whisky); +?> +</example> +<break/> + +<div effect="fade-in"> +<break lines="2"/> +<blurb class="centre">Type-coercion when %strict_types=0%</blurb> +</div> +</slide> diff --git a/slides/internals/php74-typed-properties-write-strict.xml b/slides/internals/php74-typed-properties-write-strict.xml new file mode 100644 index 00000000..9fe80e16 --- /dev/null +++ b/slides/internals/php74-typed-properties-write-strict.xml @@ -0,0 +1,26 @@ +<slide> +<title>Typed Properties</title> + +<example result="0"> +<?php +declare(strict_types=1); + +class ๐ฅ +{ + public int $age; + public Distillery $distillery; + private ?Bottler $bottler; +} + +$whisky = new ๐ฅ; +$whisky->age = 29; +?> +</example> +<break/> + +<div effect="fade-in"> +<blurb class="error"> +TypeError: Typed property ๐ฅ::$age must be int, string used +</blurb> +</div> +</slide> diff --git a/slides/internals/php74-typed-properties-write.xml b/slides/internals/php74-typed-properties-write.xml new file mode 100644 index 00000000..dbde2540 --- /dev/null +++ b/slides/internals/php74-typed-properties-write.xml @@ -0,0 +1,27 @@ +<slide> +<title>Typed Properties</title> + +<example result="0"> +<?php +class ๐ฅ +{ + public int $age; + public Distillery $distillery; + private ?Bottler $bottler; +} + +$whisky = new ๐ฅ; +$whisky->distillery = "Lagavullin"; +?> +</example> +<break/> + +<div effect="fade-in"> +<blurb class="error"> +TypeError: Typed property ๐ฅ::$distillery must be an instance of Distillery, string used +</blurb> + +<break lines="2"/> +<blurb class="centre">Type validation is checked when writing</blurb> +</div> +</slide> diff --git a/slides/internals/php74-typed-properties.xml b/slides/internals/php74-typed-properties.xml new file mode 100644 index 00000000..d55acfb4 --- /dev/null +++ b/slides/internals/php74-typed-properties.xml @@ -0,0 +1,47 @@ +<slide> +<title>Typed Properties</title> +Typed Properties 2.0 โ Bob Weinand and Nikita Popov +https://wiki.php.net/rfc/typed_properties_v2 โ https://wiki.php.net/rfc/typed_properties_v2 + +<example> +<?php +class ๐ฅ +{ +</example> +<div effect="fade-in"> +<blurb> +All types with the exception of %void% and %callable% are supported: +</blurb> +<example> + public int $age; + protected Distillery $distillery; + private ?Bottler $bottler; +</example> +</div> +<div effect="fade-in"> +<blurb> + Types are also legal on static properties: +</blurb> +<example> + public static iterable $tastingNotes; +</example> +</div> +<div effect="fade-in"> +<blurb> + Typed properties may have default values: +</blurb> +<example> + public int $rating = 92; + public ?string $nullableStr = null; +</example> +</div> +<div effect="fade-in"> +<blurb> + The type applies to all properties in one declaration: +</blurb> +<example> + public bool $chillFiltered, $colouringAdded; +} +</example> +</div> +</slide> diff --git a/slides/internals/php74-unbundle.xml b/slides/internals/php74-unbundle.xml new file mode 100644 index 00000000..bd657155 --- /dev/null +++ b/slides/internals/php74-unbundle.xml @@ -0,0 +1,26 @@ +<slide> +<title>Unbundling Extensions</title> + +<blurb>The following extensions are following ๐ฆ and ๐ฆ, like when the โ๏ธ hit:</blurb> + +<div effect="fade-in"> +<blurb>%ext/recode%<br/>โ <small>Depends on the Recode library which had its latest release in 2001</small><br/>โ Alternative: %iconv%</blurb> +Unbundle ext/recode +https://wiki.php.net/rfc/unbundle_recode +</div> + +<div effect="fade-in"> +<break/> +<blurb>%ext/wddx%<br/>โ <small>Entirely useless as everybody now uses JSON for this</small><br/>โ Moved to Siberia^WPECL โ๏ธ โ๏ธ โ </blurb> +Unbundle ext/wddx +https://wiki.php.net/rfc/deprecate-and-remove-ext-wddx +</div> + +<div effect="fade-in"> +<break/> +<blurb>%ext/interbase%<br/>โ <small>Access to Interbase and Firebird databases</small><br/>โ Moved to PECL</blurb> +Deprecate and remove ext/interbase +https://wiki.php.net/rfc/deprecate-and-remove-ext-interbase +</div> +</slide> + diff --git a/slides/internals/php74-variance-argument-ok.xml b/slides/internals/php74-variance-argument-ok.xml new file mode 100644 index 00000000..e11b40ac --- /dev/null +++ b/slides/internals/php74-variance-argument-ok.xml @@ -0,0 +1,24 @@ +<slide> +<title>Contravariant Argument Types</title> + +<example result="1"> +<?php +class ๐ {} +class ๐ extends ๐ {} + +class Asterix +{ + public function hunt(๐ $animal) {} +} + +class Gauls extends Asterix +{ + public function hunt(๐ $animal) {} +} +?> +</example> + +<break lines="2"/> +<blurb class="center">Arguments types are *contra-variant*:<br/>~they can accept a more broad type~</blurb> +</slide> + diff --git a/slides/internals/php74-variance-argument-wrong.xml b/slides/internals/php74-variance-argument-wrong.xml new file mode 100644 index 00000000..876174a7 --- /dev/null +++ b/slides/internals/php74-variance-argument-wrong.xml @@ -0,0 +1,25 @@ +<slide> +<title>Contravariant Argument Types</title> + +<example result="0"> +<?php +class ๐ {} +class ๐ extends ๐ {} + +class Asterix +{ + public function hunt(๐ $animal) {} +} + +class Gauls extends Asterix +{ + public function hunt(๐ $animal) {} +} +?> +</example> + +<blurb class="error">Warning: Declaration of Gauls::hunt(๐ $animal) should be compatible with Asterix::hunt(๐ $animal)</blurb> +<break lines="2"/> +<blurb class="center">Arguments types are *contra-variant*:<br/>~they can *not* accept a more specific type~</blurb> +</slide> + diff --git a/slides/internals/php74-variance-properties-ok.xml b/slides/internals/php74-variance-properties-ok.xml new file mode 100644 index 00000000..492ac4b9 --- /dev/null +++ b/slides/internals/php74-variance-properties-ok.xml @@ -0,0 +1,29 @@ +<slide> +<title>Invariant Property Types</title> + +Covariant Returns and Contravariant Parameters โ Levi Morrison +https://wiki.php.net/rfc/covariant-returns-and-contravariant-parameters โ + +typed properties are invariant + +<example> +<?php +class ๐ {} +class ๐ extends ๐ {} + +class Bakery +{ + public ๐ $gravity; +} + +class Patisserie extends Bakery +{ + public ๐ $gravity; +} +?> +</example> + +<break lines="2"/> +<blurb class="center">Property types are *in-variant*:<br/>~they can *not* represent a more specific or a more broad type~</blurb> +</slide> + diff --git a/slides/internals/php74-variance-properties-wrong.xml b/slides/internals/php74-variance-properties-wrong.xml new file mode 100644 index 00000000..c9f6603a --- /dev/null +++ b/slides/internals/php74-variance-properties-wrong.xml @@ -0,0 +1,30 @@ +<slide> +<title>Invariant Property Types</title> + +Covariant Returns and Contravariant Parameters โ Levi Morrison +https://wiki.php.net/rfc/covariant-returns-and-contravariant-parameters โ + +typed properties are invariant + +<example return="1"> +<?php +class ๐ {} +class ๐ extends ๐ {} + +class Bakery +{ + public ๐ $temperature; +} + +class Patisserie extends Bakery +{ + public ๐ $temperature; +} +?> +</example> + +<blurb class="error">Fatal error: Type of Patisserie::$temperature must be ๐ (as in class Bakery)</blurb> +<break lines="2"/> +<blurb class="center">Property types are *in-variant*:<br/>~they can *not* represent a more specific or a more broad type~</blurb> +</slide> + diff --git a/slides/internals/php74-variance-return-ok.xml b/slides/internals/php74-variance-return-ok.xml new file mode 100644 index 00000000..3bfd3f9e --- /dev/null +++ b/slides/internals/php74-variance-return-ok.xml @@ -0,0 +1,29 @@ +<slide> +<title>Covariant Return Types</title> + +Covariant Returns and Contravariant Parameters โ Levi Morrison +https://wiki.php.net/rfc/covariant-returns-and-contravariant-parameters โ + +typed properties are invariant + +<example result="1"> +<?php +class ๐ {} +class ๐ฅ extends ๐ {} + +class Bakery +{ + public function gimme(): ๐ {} +} + +class Patisserie extends Bakery +{ + public function gimme(): ๐ฅ {} +} +?> +</example> + +<break lines="2"/> +<blurb class="center">Return types are *co-variant*:<br/>~they can return a more specific type~</blurb> +</slide> + diff --git a/slides/internals/php74-variance-return-wrong.xml b/slides/internals/php74-variance-return-wrong.xml new file mode 100644 index 00000000..5b4bc7a5 --- /dev/null +++ b/slides/internals/php74-variance-return-wrong.xml @@ -0,0 +1,30 @@ +<slide> +<title>Covariant Return Types</title> + +Covariant Returns and Contravariant Parameters โ Levi Morrison +https://wiki.php.net/rfc/covariant-returns-and-contravariant-parameters โ + +typed properties are invariant + +<example> +<?php +class ๐ {} +class ๐ฅ extends ๐ {} + +class Bakery +{ + public function gimme(): ๐ฅ {} +} + +class Patisserie extends Bakery +{ + public function gimme(): ๐ {} +} +?> +</example> + +<blurb class="error">Fatal error: Declaration of Patisserie::gimme(): ๐ must be compatible with Bakery::gimme(): ๐ฅ</blurb> +<break lines="2"/> +<blurb class="center">Return types are *co-variant*:<br/>~they can *not* return a more broad type~</blurb> +</slide> + diff --git a/slides/internals/php74-weakref.xml b/slides/internals/php74-weakref.xml new file mode 100644 index 00000000..37373f61 --- /dev/null +++ b/slides/internals/php74-weakref.xml @@ -0,0 +1,31 @@ +<slide> +<title>Episode #3: Weak References</title> + +<audio filename="joe-watkins.mp3"/> + +<image filename="joe-watkins.jpg" align="left" attr="Joe Watkins"/> +Episode 3 โ Weak References โ Joe Watkins + +<example> +final class WeakReference { + public static function create(object $object) : WeakReference; + public function get() : ?object; +} +</example> + +<blurb>Example:</blurb> +<example result="1"> +<?php +class ๐ป { function boo() { echo "BOO!\n"; } } +$boo = new ๐ป ; +$ref = WeakReference::create( $boo ); + +$ref->get()->boo(); +unset( $boo ); +var_dump( $ref->get() ); +</example> + + +<blurb align="right">*RFC*: https://wiki.php.net/rfc/weakrefs</blurb> โ https://github.com/php/php-src/pull/3787/files +</slide> + diff --git a/slides/internals/phpinternalsnews-me.xml b/slides/internals/phpinternalsnews-me.xml new file mode 100644 index 00000000..dba2a828 --- /dev/null +++ b/slides/internals/phpinternalsnews-me.xml @@ -0,0 +1,7 @@ +<slide> +<title>Your Host!</title> + +<audio filename="phpintnews-intro.mp3"/> + +<image filename="phpintnews-small.jpg"/> +</slide> diff --git a/slides/internals/phpintnews-intro.mp3 b/slides/internals/phpintnews-intro.mp3 new file mode 100644 index 00000000..383407e1 Binary files /dev/null and b/slides/internals/phpintnews-intro.mp3 differ diff --git a/slides/internals/phpintnews-outro.mp3 b/slides/internals/phpintnews-outro.mp3 new file mode 100644 index 00000000..edf197d4 Binary files /dev/null and b/slides/internals/phpintnews-outro.mp3 differ diff --git a/slides/internals/phpintnews.jpg b/slides/internals/phpintnews.jpg new file mode 100644 index 00000000..0f2399ae Binary files /dev/null and b/slides/internals/phpintnews.jpg differ diff --git a/slides/internals/queries.jpg b/slides/internals/queries.jpg new file mode 100644 index 00000000..91a4b25b Binary files /dev/null and b/slides/internals/queries.jpg differ diff --git a/slides/internals/questions-new.xml b/slides/internals/questions-new.xml new file mode 100644 index 00000000..e3f21586 --- /dev/null +++ b/slides/internals/questions-new.xml @@ -0,0 +1,6 @@ +<slide style="title" background="queries.jpg" background_attr="Vรฉronique Debord-Lazaro โ https://www.flickr.com/photos/debord/4932655275"> +<title>Any Queries?</title> + +<audio filename="phpintnews-outro.mp3"/> + +</slide> diff --git a/slides/internals/sara-golemon.jpg b/slides/internals/sara-golemon.jpg new file mode 100644 index 00000000..076418e0 Binary files /dev/null and b/slides/internals/sara-golemon.jpg differ diff --git a/slides/internals/sara-golemon.mp3 b/slides/internals/sara-golemon.mp3 new file mode 100644 index 00000000..92793e83 Binary files /dev/null and b/slides/internals/sara-golemon.mp3 differ diff --git a/slides/internals/scott-dutton.jpg b/slides/internals/scott-dutton.jpg new file mode 100644 index 00000000..159a8ad5 Binary files /dev/null and b/slides/internals/scott-dutton.jpg differ diff --git a/slides/internals/scott-dutton.mp3 b/slides/internals/scott-dutton.mp3 new file mode 100644 index 00000000..1b49b369 Binary files /dev/null and b/slides/internals/scott-dutton.mp3 differ diff --git a/slides/internals/theodore-and-bishop.mp3 b/slides/internals/theodore-and-bishop.mp3 new file mode 100644 index 00000000..520dfeb3 Binary files /dev/null and b/slides/internals/theodore-and-bishop.mp3 differ diff --git a/slides/internals/theodore-brown-big.jpeg b/slides/internals/theodore-brown-big.jpeg new file mode 100644 index 00000000..1ea13556 Binary files /dev/null and b/slides/internals/theodore-brown-big.jpeg differ diff --git a/slides/internals/theodore-brown.jpeg b/slides/internals/theodore-brown.jpeg new file mode 100644 index 00000000..e25e395f Binary files /dev/null and b/slides/internals/theodore-brown.jpeg differ diff --git a/slides/internals/theodore-brown.mp3 b/slides/internals/theodore-brown.mp3 new file mode 100644 index 00000000..7afd3cda Binary files /dev/null and b/slides/internals/theodore-brown.mp3 differ diff --git a/slides/mongodb/me.xml b/slides/mongodb/me.xml index 61fa13a2..5c7ca251 100644 --- a/slides/mongodb/me.xml +++ b/slides/mongodb/me.xml @@ -7,7 +7,7 @@ <blurb>Derick Rethans</blurb> <list> <bullet>I'm European, living in London</bullet> - <bullet>I work on *PHP things*</bullet> + <bullet>PHP 7.4 *Release Manager*</bullet> <bullet>*Xdebug* & PHP's Date/Time support</bullet> <bullet>Host of *https://phpinternals.news* podcast</bullet> <bullet>I โฅ๐ maps, I โฅ๐บ beer, I โฅ๐ฅ whisky</bullet> diff --git a/templates/default/audio.ezt b/templates/default/audio.ezt new file mode 100644 index 00000000..e01128bf --- /dev/null +++ b/templates/default/audio.ezt @@ -0,0 +1,5 @@ +{use $node, $pres} +{var $filename = get_attribute( $node, 'filename' )} +<audio autoplay> +<source src="{$pres->base}{$filename}" type="audio/mpeg"> +</audio> diff --git a/templates/default/example.ezt b/templates/default/example.ezt index e30c75fe..ffa81fca 100644 --- a/templates/default/example.ezt +++ b/templates/default/example.ezt @@ -1,5 +1,7 @@ {use $pres, $node} {var $result} +{var $class = get_attribute( $node, 'class' )} +<div{if $class} class='{$class}'{/if}> {if get_attribute( $node, 'inline' ) >= 1} <pre class='code'>{raw format_text( $pres, $node->nodeValue )}</pre> {else} @@ -22,3 +24,4 @@ </div> {/if} {/if} +</div> diff --git a/templates/default/table.ezt b/templates/default/table.ezt index fc5cf6d9..0378b3d8 100644 --- a/templates/default/table.ezt +++ b/templates/default/table.ezt @@ -1,7 +1,8 @@ {use $node, $pres} {var $class = get_attribute( $node, 'class' )} +{var $style = get_attribute( $node, 'style' )} <div> -<table{if $class} class="{$class}"{/if}> +<table{if $class} class="{$class}"{/if} {if $style} style="{$style}"{/if}> {foreach $node->childNodes as $child} {if is_set( $child->tagName )} {include $child->tagName . '.ezt' send $child as $node, $pres} diff --git a/xdebug-phpworld19.xml b/xdebug-phpworld19.xml index b3b98d9c..4f3aa062 100644 --- a/xdebug-phpworld19.xml +++ b/xdebug-phpworld19.xml @@ -9,7 +9,7 @@ <email>[email protected]</email> <twitter>derickr</twitter> <url>https://derickrethans.nl/talks/xdebug-phpworld19</url> -<joindin></joindin> +<joindin>https://joind.in/26837</joindin> <slide>slides/xdebug/title.xml</slide> <slide>slides/mongodb/me.xml</slide>