2015/11/25に行われた第96回PHP勉強会のLTで発表した資料です。
Mammouth is a small language that compiles into PHP, inspired by CoffeeScript. It's compiled to PHP code/files that you can run on your PHP server. Mammouth is created by Wael Amine Boutglay (wamalaka). Latest Version: 0.1.7 sudo npm install -g mammouth Overview Mammouth on the left, compiled PHP output on the right. {{ number = 42 opposite = true square = (x) -> return(x * x) $square() list = [1,
Transcript ΅͘ͷߟ͍͖͑ͨ͞ΐ͏ͷ։ൃϑϩʔ PHPฤ Yuta Adachi ࣗݾհ ҆ୡ ༐ଠ (@UAdachi) ! ग़ɿౡࠜݝদߐࢢ ͓ࣄɿChatWork ΠϯϑϥνʔϜ ! ڵຯ͋Δ͜ͱɿυϝΠϯۦಈઃܭɺScalaɺςχε (Οϯϒϧυϯ։࠵த) ! IUUQT���DJSDMFDJ�DPN ͓ॻ͖ • ։ൃϑϩʔΛ࠷దԽ͍ͯ͘͠త • ։ൃڥ • ίϛϡχέʔγϣϯ • CI • σϓϩΠ త ! • ։ൃͷߴԽ • ΦϖϨʔγϣϯϛεͷ༧ • ϓϩμΫτͷ্࣭ + ՄࢹԽ ։ൃڥ Ͳ͏ͬͯߏஙͯ͠·͔͢ʁ • Vagrantͬͯͬͯ·͔͢ʁ ϝϯςφϯε • ։ൃڥͩͬͯߋ৽͞Εଓ͚Δ • ߏஙखॱॻΛ࡞Δͷେม " εΫϦʔϯγϣοτʹҹॻ͍ͯɺઆ໌จΛఴ͑ͯ… ʮԶͷڥʯ ྫ. Aʮಈ͔Ͷʔʯ BʮԶͷڥͩͱಈ͘
HackHack is an object-oriented programming language for building reliable websites at epic scale Hack reconciles the fast development cycle of a dynamically typed language with the discipline provided by static typing, while adding many features commonly found in other modern programming languages. Hack provides instantaneous type checking by incrementally checking your files as you edit them. It
正規表現によるバリデーション等で、完全一致を示す目的で ^ と $ を用いる方法が一般的ですが、正しくは \A と \z を用いる必要があります。Rubyの場合 ^ と $ を使って完全一致のバリデーションを行うと脆弱性が入りやすいワナとなります。PerlやPHPの場合は、Ruby程ではありませんが不具合が生じるので \A と \z を使うようにしましょう。 はじめに 大垣さんのブログエントリ「PHPer向け、Ruby/Railsの落とし穴」には、Rubyの落とし穴として、完全一致検索の指定として、正規表現の ^ と $ を指定する例が、Ruby on Rails Security Guideからの引用として紹介されています。以下の正規表現は、XSS対策として、httpスキームあるいはhttpsスキームのURLのみを許可する正規表現のつもりです。 /^https?:\/\/[^\n]+$/
PHP の三項演算子が左結合で使いにくいという話題についてです。 次のプログラムは大抵の言語では one を表示するのですが、PHP では two になってしまいます。 <?php $var = 1; echo ($var == 1 ? 'one' : $var == 2 ? 'two' : 'three') . "\n"; 三項演算子が左結合なので、このコードは次のように解釈され、 <?php $var = 1; echo (($var == 1 ? 'one' : $var == 2) ? 'two' : 'three') . "\n"; 文字列 'one' は真偽値としては true になるので、結果的に 'two' が戻されるというわけです。 このような言語仕様になっている理由が気になったので、探してみました。 Bug #61915 incorrect associativity
2018年1月10日に開催された DCI Tokyo 1 に続き、2018年3月27日に DCI Tokyo 2 が開催されました。今回も James Coplien @jcoplien さんをお招きしてのトークセッションとなりました。会場は 株式会社ヴァル研究所 様に提供していただきました。 セッションは、前回同様 @remore さんと @ganchiku さんによる同時通訳とともに進められました。 今回のテーマはマルチパラダイムデザイン(Multi-Paradigm Design: MPD)の中核を成し、DCI / リーンアーキテクチャ(Lean Architecture)とも深く関係する 共通性/可変性分析 でした。 レポートは @smori1983 が担当させていただきます。 当日の様子は Coplien さんの許可を得て YouTube の DCI Tokyo 公式アカウントに
Comment Facile Est Laravel À Utiliser? tutoriel Laravel Taylor Otwell, publié au printemps 2020, a é tutoriel Laravel Taylor Otwell, publié au printemps 2020, a été un énorme percée dans le développement web. Aujourd'hui, plus de cinq ans plus tard, il est encore utilisé par de nombreux développeurs web pour créer des applications web belles et puissantes. Dans le monde des applications web, il y
A command line refactoring tool for PHP View the Project on GitHub QafooLabs/php-refactoring-browser Download PHAR View On GitHub Built by Qafoo Note: This software is under development and in alpha state. Refactorings do not contain all necessary pre-conditions and might mess up your code. Check the diffs carefully before applying the patches. PHP Refactoring Browser Note: This software is under
しばしば三項演算子やdo-while構文が禁止されているコーディング規約に遭遇する。それは今すぐ撤廃すべきという論理武装を考えてみよう。事例はPHPだが、このことはすべての言語にいえる。 例 あるサービスから何らかのデータを取り出し、それをクライアント側で使うという手続きを考える。 ここで、サービス側のAPIとクライアント側のAPIに仕様ギャップがあったとしよう。$service は古く、うまく行かなかったとき例外ではなく null 的なもの(PHPではもしかするとfalseかもしれない)を返す習慣で作られていた。いっぽう $client は null を入力される想定がない。何もしないで欲しいときは空の array を入力する仕様だった。 以下の実装例を見てほしい。 <?php $data = $service->getSomeData(); if ($data === null ||
(Last Updated On: 2018年8月18日)徳丸さんから「ブログ読みました。サンプルも動かしました。問題は分かるのですが、セッションアダプションがないPHPだと、何が改善されるのかが分かりません。教えて下さい 」とあったのでツイッターで返信するには少し長いのでこちらに書きます。まだ直していない脆弱性を詳しく解説するのはあまりよくないのですが、今なら影響を受けるアプリはほぼないと思うので構わないでしょう。 まず前提として、Webサーバと同様にJavascriptからもクッキーが設定できます。Javascriptインジェクションに脆弱なコードがサイトに1つでもあると、サイト上のセッションアダプション脆弱性をもつアプリへの攻撃が可能になります。この攻撃を緩和する対策もありますが、それはそれ、これはこれなので省略します。 セッションアダプションに脆弱なセッション管理機構で困る代表的な
Posted on: 2011/11/18 CakePHP セキュリティ対策について考える(SQLインジェクション、XSS、CSRF) 概要 SQLを使って不正にデータベースを操作する攻撃 攻撃例 ユーザー名とパスワードを入力してログインする処理があるとする。 username と password の組み合わせが、データベースのものと一致すれば認証するという仕組みだとする。 SELECT * FROM users WHERE username='$username' AND password='$password' ここで、($username: admin, $password: ' OR 'a'='a)と入力すると、SQLは以下のようになる。 SELECT * FROM users WHERE username='admin' AND password='' OR 'a'='a' こ
すみません。LINQって初めて見ました(多分)。C#方面の機能(?)みたいです。で、これをPHPで部分的に実装してみた方(ベルギーの方ですかね)がいらっしゃるようです。 Perhaps you have already heard of C# 3.5's "LINQ" component. LINQ, or Language Integrated Query, is a component inside the .NET framework which enables you to perform queries on a variety of data sources like arrays, XML, SQL server, ... These queries are defined using a syntax which is very similar to SQL. There
ようこそ 時代遅れの情報がウェブ上にあふれている。そんな情報を見たPHP初心者は戸惑ってしまうだろう。そして、まずい手法やまずいコードが広まってしまう。 そんなのはもうやめよう。PHP: The Right Way は気軽に読めるクイックリファレンスだ。PHPの一般的なコーディング規約、 ウェブ上のよくできたチュートリアルへのリンク、そして現時点でのベストプラクティスだと執筆者が考えていることをまとめた。 大事なのは、 PHPを使うための正式なお作法など存在しない ってこと。 このサイトの狙いは、はじめて PHP を使うことになった開発者に、いろんなトピックを紹介すること。 経験豊富なプロの人にとっても、これまで深く考えることなく使ってきた内容について、新鮮な見方を伝えられるだろう。 このサイトは、決して「どのツールを使えばいいのか」を教えるものじゃない。 いくつかの選択肢を示して、それぞ
段田です。 最近、PHPからiphone端末にPUSH通知を送る機能の開発に携わりました。PHPでプログラムを実装する場合、フルスクラッチとライブラリを使用するケースがあるのですが、各ケースでのポイントを忘れないよう書きたいと思います。 なおPUSH通知の概要、証明証の作成については省略します。概要などは下記の記事がわかりやすく、参考になりました。 Apple Push Notification サービス(APNs) の実装方法 iPhoneプッシュ通知まとめ フルスクラッチのケース フルスクラッチでやる場合、こちらのはてなの記事が参考になりました。 https://irss.hatenablog.com/entry/20111026/1319632548 しかし、試しに作成すると送信はできるのですが、下記の様な制約があることを知ります。 1つのメッセージで256バイトを超えてはいけない
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く